Обратите внимание на вот эту часть:
Спасибо, получилось.
Помогите пожалуйста добавить эти строки в код выше, чтобы я мог определенным пользователям и сайты и онлайн видео/аудио просмотр блокировать.
--[[ <HCExtension>
@name eA_OnlyFromCache_media_by_type (OFC-media)
@author mai62
@description Загружать медиа-файлы только из кэша
@exception \.swf($|\?)
@event AnswerHeaderReceived/Answer
</HCExtension> ]]
function GetContentType(s)
_,_,x = string.find(s, '[cC]ontent%-[tT]ype: *([^;\r\n]+)')
if x~=nil then x = string.lower(x) end
return x
end
function GetContentLength(s)
_,_,x = string.find(s, '[cC]ontent%-[lL]ength: *(%d+)')
if x==nil then return -1 else return tonumber(x) end
end
function Answer()
-- Только для GET-запросов
if hc.method == 'GET' then
-- забираем тип файла из заголовка 'Content-Type'
type = GetContentType(hc.answer_header)
if type~=nil then
local media= nil
media = string.find(type,'video',1,true)
if media==nil then media = string.find(type,'audio',1,true) end
-- если в поле заголовка 'Content-Type' есть слово 'video' или 'audio'
-- и файла нет в кэше
if media~=nil and hc.cache_file_size<0 then
-- то останавливаем загрузку
hc.action = 'stop-'
hc.monitor_string = hc.monitor_string..'OFC-media '
end
end
end
end -- Конец функции Answer