--[[ <HCExtension>@name Test-image@event BeforeRequestHeaderSend/Request@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 xendfunction Request() if re.find(hc.url, [[^[^?]+\.(ani|bmp|cal|fax|gif|img|jbg|jpe|jpeg|jpg|mac|pbm|pcd|pcx|pct|pgm|png|ppm|psd|ras|tga|tiff|wmf)(\?|$)]], 0) and if hc.cache_file_name== '' then hc.sleep(2000) hc.monitor_string = hc.monitor_string..'Ext-Image ' endendfunction Answer() if hc.method == 'GET' then type = GetContentType(hc.answer_header) if type~=nil then img = string.find(type,'image',1,true) else img = nil end if img~=nil and hc.cache_file_name== '' then hc.sleep(2000) hc.monitor_string = hc.monitor_string..'Ext-Image ' end endend
--[[ <HCExtension>@name Test-image@event BeforeRequestHeaderSend/Request@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 xendfunction Request() if re.find(hc.url, [[^[^?]+\.(ani|bmp|cal|fax|gif|img|jbg|jpe|jpeg|jpg|mac|pbm|pcd|pcx|pct|pgm|png|ppm|psd|ras|tga|tiff|wmf)(\?|$)]], 0) and if hc.cache_file_name== '' then hc.sleep(2000) hc.monitor_string = hc.monitor_string..'Ext-Image ' endendfunction Answer() if hc.method == 'GET' then type = GetContentType(hc.answer_header) if type~=nil then img = string.find(type,'image',1,true) else img = nil end if img~=nil and if hc.cache_file_name== '' then hc.sleep(2000) hc.monitor_string = hc.monitor_string..'Ext-Image ' end endend
--[[ <HCExtension>@name Test-image@event BeforeRequestHeaderSend</HCExtension> ]]function BeforeRequestHeaderSend() if re.find(hc.url, [[\A[^?]+\.(ani|bmp|cal|fax|gif|img|jbg|jpe|jpeg|jpg|mac|pbm|pcd|pcx|pct|pgm|png|ppm|psd|ras|tga|tiff|wmf)(\?|\z)]]) then hc.sleep(2000) hc.monitor_string = hc.monitor_string..'Ext-Image ' hc.action = 'dont_update' else hc.call_me_for('AnswerHeaderReceived') endendfunction AnswerHeaderReceived() if not re.find(hc.answer_header, [[\A\S++\s*+200.*?^content-type:\s*+image]]) then return end hc.sleep(2000) hc.monitor_string = hc.monitor_string..'Ext-Image ' hc.action = 'dont_update'end
--[[ <HCExtension>@name Test-image (E.Delay)@description http://handycache.ru/forum/index.php?topic=5913.0@event BeforeRequestHeaderSend</HCExtension> ]]function BeforeRequestHeaderSend() hc.call_me_for('AnswerHeaderReceived')endfunction AnswerHeaderReceived() if re.find(hc.answer_header, [[\A\S++\s*+200.*?^content-type:\s*+image]]) then hc.sleep(4000) hc.monitor_string = hc.monitor_string..'E.Delay ' endend