Welcome! Log In Create A New Profile

Advanced

Question about request_body and redirect

August 19, 2009 05:33AM
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.
Subject Author Posted

Question about request_body and redirect

nexthop August 19, 2009 05:33AM

Re: Question about request_body and redirect

Weibin Yao August 19, 2009 06:00AM

Re: Question about request_body and redirect

nexthop August 19, 2009 07:24AM

Re: Question about request_body and redirect

Joshua Zhu August 19, 2009 09:04AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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