Welcome! Log In Create A New Profile

Advanced

Re: Subrequest using Parent Request Body

Maxim Dounin
May 12, 2010 05:26PM
Hello!

On Wed, May 12, 2010 at 12:15:22PM -0700, Matthieu Tourne wrote:

[...]

> So the way I solved this is to make a full copy of r->request_body into
> temporary bufs of the subrequest.
>
> I would create a subrequest using ngx_http_subrequest(),
> then use ngx_http_read_client_request_body(r, post_handler), to read
> r->request_body and set a function to copy it in the subrquest as the
> post_handler.
>
> I was wondering if this could be dangerous, if the subrequest could be fired
> before r->request_body would be completely read, or is it done in a
> sequential order ?

You have to read body and call ngx_http_subrequest() only when
it's fully read (i.e. from post_handler).

> Concerning malloc, is :
> env MALLOC_OPTIONS=J;
> in nginx.conf sufficient ?

No. Under FreeBSD nginx respects MALLOC_OPTIONS=J in environment
and activates the same logic as with -DNGX_DEBUG_MALLOC, but it
has to be already set at master process startup.

On other OSes the only available option is
../configure --with-cc-opts="-D NGX_DEBUG_MALLOC".

> Also, is it possible to something such as Valgrind on nginx workers ?

Never tried. Though you may disable daemon mode and master process
completely with "daemon off; master_process off;". This turns
nginx into simple single-process programm which may be
debugged/profiled by almost anything. There are some limitations
(reconfiguration and binary update doesn't work), but they are
minimal.

Maxim Dounin

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

Subrequest using Parent Request Body

Matthieu Tourne May 07, 2010 06:42PM

Re: Subrequest using Parent Request Body

peterjanovsky May 09, 2010 08:30PM

Re: Subrequest using Parent Request Body

agentzh May 09, 2010 11:16PM

Re: Subrequest using Parent Request Body

Maxim Dounin May 10, 2010 09:48PM

Re: Subrequest using Parent Request Body

Matthieu Tourne May 12, 2010 03:20PM

Re: Subrequest using Parent Request Body

Maxim Dounin May 12, 2010 05:26PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 282
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready