hey tokers...thanks a lot... your suggestion is ok and I have solved it!
function fixedRawReqHeader()
local result = ""
result = ngx.req.get_method() .. " " .. ngx.var.uri .. " HTTP/" ..ngx.req.http_version() .. "\n"
for k, v in pairs(ngx.req.get_headers()) do
result = result .. tostring(k) .. ":" .. tostring(v) .. "\n"
end
return result
end
just another simple question!
I want to get the size (length) of request header , request body , response header and response body! I need to know the main size of original data (not my generated header) how can I do that?
I think if we have req or resp body, we can get the size of req or resp body using ngx.req.get_headers()["Content-Length"] or ngx.resp.get_headers()["Content-Length"]
but I have no Idea for getting the size of headers using nginx methods!
thanks a lot...
Best,