Accessing original/raw HTTP request

Srebrenko Šehić ssehic at gmail.com
Tue Apr 6 11:50:21 MSD 2010


On Tue, Apr 6, 2010 at 9:09 AM, agentzh <agentzh at gmail.com> wrote:

>> 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.

Thanks. That's exactly what I was looking for.



More information about the nginx-devel mailing list