Question about request_body and redirect

Joshua Zhu zhuzhaoyuan at gmail.com
Wed Aug 19 17:04:51 MSD 2009


Hi,

On Wed, Aug 19, 2009 at 5:33 PM, quan nexthop<quan.nexthop at gmail.com> wrote:
> Hi all:
>
> I try to implemente a module based on NGINX, which will filter the content
> of request body.
> Now,  I met a problem: I can not get the whole request body
>
> my code is as following:
> ---------------------------------------------
>    len = rb->buf->last - rb->buf->pos ;
>    post_content = ngx_palloc(r->pool, len + 1);
>    ngx_cpystrn(post_body, rb->buf->pos, len);
> ---------------------------------------------
>
> it seems that if the body size is over 256 Bytes, we can not get the right
> request body length.
>
> my questions are:
> 1) how can I get the correct length of request body ?
> 2) Do I need copy the request body to a buffur and then filter? Does
> serverar buff hold the data and link the buff-chain ?
>

You should use 'r->request_body->bufs'. And keep in mind that there
might be one or two buffers in the chain.

Cheers!

-- 
Joshua Zhu





More information about the nginx mailing list