Question about request_body and redirect

quan nexthop quan.nexthop at gmail.com
Wed Aug 19 13:33:03 MSD 2009


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 ?


Other issue:
I want to redirect some unsafe URLs to different safe URL, like
 http://www.abc.com/a.index redirect to http://www.1234.com/a.index
http://www.abc.com/b.index  rediect to http://www.5566.com/b.index

I use  the function: ngx_http_internal_redirect() to implementate,  but I
always get a crash.
Any idea about these ?


thanks
NextHop.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20090819/fe22f6d2/attachment.html>


More information about the nginx mailing list