Is there a way to get the raw request from the client in a handler?

Maxim Dounin mdounin at mdounin.ru
Wed Jan 9 17:18:48 UTC 2019


Hello!

On Wed, Jan 09, 2019 at 03:16:16PM +0100, Ottavio Campana wrote:

> Dear Maxim,
> 
> in the nginx documentation
> http://nginx.org/en/docs/http/ngx_http_core_module.html#var_request I find
> 
> $request full original request line
> 
> How is this variable populated? I was expecting that this variable is taken
> from an internal buffer. Or is it reconstructed?

For HTTP/1.x (and HTTP/0.9), a reference to the request line is 
explicitly saved in the r->request_line field when parsing a request, 
see ngx_http_process_request_line() in src/http/ngx_http_request.c.

For HTTP/2, it is reconstructed.  See ngx_http_v2_construct_request_line() 
in src/http/v2/ngx_http_v2.c.

-- 
Maxim Dounin
http://mdounin.ru/


More information about the nginx mailing list