Welcome! Log In Create A New Profile

Advanced

Re: $request_body bug?

agentzh
October 22, 2009 09:50PM
On Thu, Oct 22, 2009 at 3:57 PM, agentzh <agentzh@gmail.com> wrote:
>
> The $request_body variable only has values when the underlying content
> handler or upstream handler or anything else has actually *read* the
> request body from the tcp connection and stored it into
> r->request_body slot.
>

Sorry, forgot to mention that for POST data that has well exceeded
"client_body_buffer_size", Nginx will write the data into temporary
files on the disk. In this case, the $request_body variable is also
evaluated to an empty string ("").

To help demonstrating this, I've added the "read_request_body"
directive to my "echo" module (released as v0.14), which calls the
"ngx_http_read_client_request_body" function, just as the "proxy"
module and many others. The following example clearly shows the
situation described above.

In the nginx.conf:

location /echobody {
client_body_buffer_size 2;
echo_read_request_body;
echo $request_body;
}

On the client side:

$ perl -e 'print "a"x2' | lwp-request -m POST 'http://localhost:8080/echobody'
aa

$ perl -e 'print "a"x1024' | lwp-request -m POST
'http://localhost:8080/echobody'

As we can see, the second request feeds 1KB POST request body, well
above the 2 bytes "client_body_buffer_size" setting and $request_body
yields empty.

I'm guessing this is more likely in your situation but I could be wrong :)

Cheers,
-agentzh
Subject Author Posted

FCGI Perl

Gordon Pettey October 02, 2009 05:52PM

Re: FCGI Perl

Cliff Wells October 02, 2009 06:06PM

Re: FCGI Perl

Gordon Pettey October 02, 2009 07:58PM

Re: FCGI Perl

mike October 02, 2009 08:12PM

Re: FCGI Perl

Gordon Pettey October 03, 2009 12:42PM

Re: FCGI Perl

davidc October 05, 2009 05:25AM

$request_body bug?

dennisjanuary October 05, 2009 07:16AM

Re: FCGI Perl

Johnny fox Ucklenberg October 16, 2009 07:04PM

Re: FCGI Perl

Aleksandar Lazic October 16, 2009 07:14PM

Re: FCGI Perl

Kiswono Prayogo October 17, 2009 04:26AM

Re: FCGI Perl

Cliff Wells October 17, 2009 05:32AM

Re: FCGI Perl

Aleksandar Lazic October 17, 2009 06:50AM

Re: FCGI Perl

Johnny fox Ucklenberg October 17, 2009 11:54AM

Re: FCGI Perl

Aleksandar Lazic October 17, 2009 12:16PM

Re: FCGI Perl

Johnny Fox Ucklenberg October 17, 2009 02:20PM

Re: FCGI Perl

Aleksandar Lazic October 17, 2009 04:44PM

Re: FCGI Perl

Johnny Fox Ucklenberg October 17, 2009 06:22PM

Re: $request_body bug?

agentzh October 22, 2009 04:02AM

Re: $request_body bug?

agentzh October 22, 2009 09:50PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 213
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