Get ngx_http_request_t as a char array

Tigran Bayburtsyan tigran.bayburtsyan at gmail.com
Fri Feb 27 12:40:14 UTC 2015


So there is now way of getting or transforming ngx_http_request_t to char *
or byte array ? 
In any case C/C++ socket receiving data as a byte array .... For example
here we can log full request to file as a char * (or string)
https://gist.github.com/morhekil/1ff0e902ed4de2adcb7a 

When I'm saying "string" I don't mean string type, I mean something with a
pointer and size where I can read all request from start to end .... I think
I need something very similar to file logging.

Thanks.

-----Original Message-----
From: nginx-devel-bounces at nginx.org [mailto:nginx-devel-bounces at nginx.org]
On Behalf Of Maxim Dounin
Sent: Friday, February 27, 2015 4:24 PM
To: nginx-devel at nginx.org
Subject: Re: Get ngx_http_request_t as a char array

Hello!

On Fri, Feb 27, 2015 at 02:56:46PM +0400, Tigran Bayburtsyan wrote:

> Hi.
> 
> I'm trying to make a smart logging module for Nginx and I need to get 
> all HTTP request from client as a string (char *).
> 
> I know that ngx_http_request_t contains all HTTP request data , but I 
> don't need to make a loop through all headers_in parameters or request 
> structure parameters.
> 
> I want to get all request with body as a char * array, like Nginx is 
> receiving from tcp socket.

There are two problems here:

- nginx is not receiving a request as a string from tcp socket,
  even if you talk about headers only;

- consequently, it is not available as a string within nginx.

--
Maxim Dounin
http://nginx.org/

_______________________________________________
nginx-devel mailing list
nginx-devel at nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


---
This email has been checked for viruses by Avast antivirus software.
http://www.avast.com



More information about the nginx-devel mailing list