Even when it does not work fix. Strange is that it fails Request section.
--[[ <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 x
end
function 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 '
end
end
function 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
end
end