Hello
is it possible to send POST data using HC ?
I've read the documentation and it said I can use hc.send_request to do that
Arguments to the function:
header - the header http-request;
body - the body of http-request for the method POST.
https_header - heading to form https-request to the proxy server.
this is my extension, I want to ask sitereview.bluecoat.com about site categories and use it for blocking porn
--[[ <HCExtension>
@name Web Filter ( blue coat )
@version 1
@event RequestHeaderReceived/request
@event Init/init
</HCExtension> ]]
function init()
hc.put_msg(3, 'hc_bluecoat')
end
function request()
if re.find(hc.request_header, [[^Accept:\stext/html]]) then
local crc_r = re.find(hc.url, [[\b([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}\b]])
local crc_r = hc.crc32(crc_r)
--local pat = hc.cache_path ..'temp\\webfilter\\bluecoat\\'..'data='..crc_r
local hdr = 'POST /rest/categorization HTTP/1.1\r\nHost: sitereview.bluecoat.com\r\nUser-Agent: Mozilla/5.0 (Windows NT 5.1; rv:30.0) Gecko/20100101 Firefox/30.0\r\nAccept: */*\r\nAccept-Language: en-US,en;q=0.5\r\nAccept-Encoding: gzip, deflate\r\nContent-Type: application/x-www-form-urlencoded; charset=UTF-8\r\nX-Requested-With: XMLHttpRequest\r\nReferer: http://sitereview.bluecoat.com/sitereview.jsp\r\nConnection: keep-alive\r\nPragma: no-cache\r\nCache-Control: no-cache\r\n\r\n'
hc.send_request(hdr, 'url=kaskus.co.id')
end
end
It fails to send the data, i check using charles and the POST data is empty