When using lighttpd, mod_magnet and lua, can I access the raw request headers?

Viewed 20

For a PoC I'm building I need to emulate the TRACE method in lighttpd. Using mod_magnet and lua I can reconstruct the request using the method/version/headers functions. But by doing so, the header order, case etc will be changed from the original.

Is it possible to improve upon this by accessing the raw headers, as received? Or is there a better way to achieve the desired outcome?

2 Answers

In the end I just used the mod_magnet module plus LUA, and whilst not perfect, it is actually close enough not to matter. Et voilla, a TRACE response:

lighty.header["Content-Type"] = "message/http" 
lighty.r.resp_body.add(lighty.r.req_attr["request.method"] .. " " .. lighty.r.req_attr["request.orig-uri"] .. " HTTP/1.1\n")
for k, v in pairs(lighty.r.req_header) do
    lighty.r.resp_body.add( k .. ": " .. v .. "\n")
end
lighty.r.resp_body.add( "\n" )
return 200
Related