pankaj17939
Новичок
Репутация: +0/-0
Offline
Сообщений: 43
|
|
« : 11 февраля 2013, 13:17:17 » |
|
I want to block small images files from caching on disk, I had edited the script it, but it is not working. Please guide...
--[[ <HCExtension> @name Block File < 1 kb Img or Vid @author ABCD @version 1.1 HC v1.00 RC2 (1.0.0.175) @description Stop cache file size Smaller then 1 KB Image and video @event AnswerHeaderReceived/Answer </HCExtension> ]]
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 GetContentType(s) _,_,x = string.find(s, '[cC]ontent%-ype: *([^;\r\n]+)') if x~=nil then x = string.lower(x) end return x end
function Answer()
-- Method GET -- if hc.method == 'GET' then
-- 'Content-Length' len = GetContentLength(hc.answer_header)
-- 'Content-Type' type = GetContentType(hc.answer_header)
-- Check 'Content-Type' is 'image' if type~=nil then img = string.find(type,'image',1,true) else img = nil end
-- Check 'Content-Type' is 'video' if type~=nil then vid = string.find(type,'video',1,true) else vid = nil end
-- Check 'Content-Type' is 'Audio' if type~=nil then aud = string.find(type,'audio',1,true) else aud = nil end
-- Check type is image or video or Audio' if img~=nil or vid~=nil or aud~=nil then act = 1 else act = nil end
-- .25 mb that is 256kb -- if len < 500 and act~= nil then if len < 25 and act~= nil then if hc.action=='' or hc.action==nil or hc.action=='save' then hc.action = 'save-' hc.monitor_string = hc.monitor_string..'Small Media File' end end
-- end
end -- Answer
|