Accessing original/raw HTTP request

agentzh agentzh at gmail.com
Tue Apr 6 11:09:16 MSD 2010


On Mon, Apr 5, 2010 at 10:08 PM, Srebrenko Šehić <ssehic at gmail.com> wrote:
> Hi list,
>
> I'm working on a module that needs to get access to the original/raw
> HTTP request from the client. I don't need the request body, but only
> the raw HTTP headers.

See the r->header_in buffer. You can look into the implementation of
the ngx_echo module's $echo_client_request_body variable for details:

http://wiki.nginx.org/NginxHttpEchoModule#.24echo_client_request_headers

> Furthermore, if the request
> contains garbage, I want that too, but I'm afraid that garbage will
> not always be available via r->headers_in.

Use error_page 400 to capture requests with invalid headers because
the nginx header parser will throw an exception immediately when it
sees invalid headers. And the "garbage" will still be in r->header_in
but may be incomplete.

Cheers,
-agentzh



More information about the nginx-devel mailing list