Sub-request using Parent Request Body
Roman Vasilyev
roman at anchorfree.com
Tue Jan 4 06:51:13 MSK 2011
On 01/03/2011 07:19 PM, agentzh wrote:
> On Tue, Jan 4, 2011 at 10:57 AM, Roman Vasilyev<roman at anchorfree.com> wrote:
>
>> Hello,
>>
>> I'm trying to make POST analyzer module. To have ability with SPAM detection
>> for passing throw traffic, for this I need to have request_body in
>> subrequest, for that I took agentzh / nginx-eval-module
>>
>> http://forum.nginx.org/read.php?2,84026,84605
>>
>>
> I don't think it's the right place to look into :)
>
>
>> and after reading this posts made small changes (please find it below)
>> on small tests it working fine, but on something with big POSTs it loosing
>> information, could somebody help me with understanding how better fix this.
>>
>>
> I am afraid you're using ngx_http_read_client_request_body in a wrong
> way. When the request body is big enough to exceed the preread part of
> the request headers or the network is bad enough, you'll surely loose
> data in the request body.
>
> Nginx works in a streaming and non-blocking manner, so you have to
> *wait* for the ngx_http_read_client_request_body fully complete (not
> just when this function returns but when your ngx_http_stub is called)
> before continuing with your rewrite-phase handler. So it's totally
> wrong to do nothing in your ngx_http_stub callback. It should be the
> key part for your logic.
>
> Please take a peek at the ngx_form_input module to have a live demo for this:
>
> http://github.com/calio/form-input-nginx-module
>
>
This module was from which I begun. Originally I saved all input data
into variable and tried to pass it into fastcgi subrequest,
unfortunately when I'm passing this variable in subrequest request_body
is already empty, because subrequest have empty request_body, that's was
the reason why I'm trying to pass request_body to subrequest. May be
people here tried other variants or have some ideas to have good quality
of post analysis internally?
> It was originally written by one of my intern students and now
> maintained by me :)
>
Thank you for eval extention :)
> Good luck!
> -agentzh
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://nginx.org/mailman/listinfo/nginx
>
More information about the nginx
mailing list