No show text from this.
And second question. How add combine with apply one file type?
My script based on filetype is:
No show text in monitorfunction Test()
if re.match (hc.url, [[\.(jpe?g|bmp|png|webp|gif)(\?|$)]]) then
hc.answer_header = [[200 OK From Cache (HC)]]
hc.monitor_string = hc.monitor_string..'Images - Cache'
else
hc.monitor_string = hc.monitor_string..'Images - WAN '
end
end
This show text monitorfunction Test()
if re.match (hc.url, [[\.(jpe?g|bmp|png|webp|gif)(\?|$)]]) then
hc.monitor_string = hc.monitor_string..'Images - From WAN '
hc.monitor_text_color = 0 + 90*256 + 0*256*256 -- Green (R+G+B)
end
end
----------------------
And bug:
If add this:
if re.match(hc.answer_header, [[^HTTP/1\.1\s304[^\r\n]+]]) then
hc.monitor_string = hc.monitor_string..'Client Cache'
hc.monitor_text_color = 4557568
end
then show line "304 Not modified" only as green (no 304 Not modified (HC)), and "200 OK From Cache (HC)" show as green.
----------
Complette test script:
--[[ <HCExtension>
@name Test
@description For testing
@event AnswerHeaderReceived
</HCExtension> ]]
function AnswerHeaderReceived()
if re.match (hc.url, [[\.(jpe?g|bmp|png|webp|gif)(\?|$)]]) then
hc.monitor_string = hc.monitor_string..'Images - From WAN'
hc.monitor_text_color = 0 + 90*256 + 0*256*256 -- Green (R+G+B)
end
if re.find(hc.answer_header, [[200 OK From Cache (HC)]]) then
hc.monitor_string = hc.monitor_string..'Images - Cache'
hc.monitor_text_color = 0 + 90*256 + 0*256*256 -- Green (R+G+B)
end
if re.match(hc.answer_header, [[^HTTP/1\.1\s304[^\r\n]+]]) then
hc.monitor_string = hc.monitor_string..'Client Cache'
hc.monitor_text_color = 0 + 90*256 + 0*256*256 -- Green (R+G+B)
end
end
function Test()
if re.match (hc.url, [[\.(jpe?g|bmp|png|webp|gif)(\?|$)]]) then
hc.answer_header = [[200 OK From Cache (HC)]]
hc.monitor_string = hc.monitor_string..'Images - Cache'
else
hc.monitor_string = hc.monitor_string..'Images - WAN'
end
end