Trouble getting the Request Body of a HTTP Post

Tronman nginx-forum at nginx.us
Thu Dec 17 23:33:04 MSK 2009


> Most likely you did something wrong, either while
> telneting or in you module.

Precisely, it was a mistake I was making with my telnet session. I misinterpreted "sending" as really just inserting a couple of new lines. Also, it worked properly when I wrote a simple form to POST in Firefox.

Great! Your response cleared up nearly everything for me, the only other thing I'm not completely clear on is the difference between:

ngx_chain_t                      *bufs;

and

ngx_buf_t                        *buf;

in ngx_http_request_body_t. What is the difference between them? When should I use either to access the body?

I seem to be able to access:

r->request_body->buf->start  and
r->request_body->buf->pos

the same as I can use:

r->request_body->bufs->buf->start  and
r->request_body->bufs->buf->pos

While r->request_body->bufs->next is NULL.  So obviously the chain is some sort of linked list.

My only clue here are the:

client_body_in_single_buffer   and
client_body_buffer_size  

directives in NginxHttpCoreModule

So if I specify "client_body_in_single_buffer" as "true", does it store the entire client request in r->request_body->buf?
But if not, does it separate the client request body into the chunks of whatever client_body_buffer_size is set to, and then you use the chain to gain access to the entire thing?

Thanks again!

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,31312,31404#msg-31404




More information about the nginx mailing list