Welcome! Log In Create A New Profile

Advanced

Re: request hangs

February 28, 2011 01:33AM
magz Wrote:
-------------------------------------------------------
> Hi,
>
> I have strange problem with main request hand if
> I call for sub-request. Maybe somebody can help
> me with it?
>
> I do spam filtering in post request. So I added
> location to nginx.conf and call sub-request for
> that location. Then read output from sub-request
> and set up nginx variable according to output.
>
> So config looks like:
> location = /checkspam {
> internal;
> include spam_fastcgi.conf;
> }
>
>
> SOURCE code is here:
> http://codepaste.net/17tfmu
>
> From client side it looks like client can not
> receive last chank of original request (last 10-50
> bytes). And it's not easy to understand what is
> going on. Any advises are welcome.
>
> I put debug log here:
> http://codepaste.net/ceiian
>
> Thanks,
> Max.


Silence here means that question was not clear or nobody knows the answer. I will try to ask my question in another way. If you know the answer please respond to me.

I do:
1. register handler in REWRITE_PHASE
h = ngx_array_push(&cmcf->phases[NGX_HTTP_REWRITE_PHASE].handlers);
*h = ngx_http_form_input_handler;

2. In ngx_http_form_input_handler() read POST body and act the handler:
r->request_body_in_single_buf = 1;
rc = ngx_http_read_client_request_body(r, ngx_http_form_input_post_read);

3. In ngx_http_form_input_post_read() call subsequent with POST body to different location
psr->handler = ngx_http_form_input_post_subrequest_handler;
rc = ngx_http_subrequest(r, &uri, &args, &sr, psr, 0);


Now the question is why original request hands on returning last buffer chank to client?

It looks like client holds on read() forever. If kill signal is sent to nginx client receives this last buffer. Also sub-request works fine (send all POST data from client and receives what is should receive). Without sub-request everything works fine too.

Is it know nginx issue?

What workaround can be applied here? Maybe create create additional filter and terminate request? Or adjust request buffers after sub-request is done?
Subject Author Posted

request hangs

magz February 25, 2011 08:27PM

Re: request hangs

magz February 28, 2011 01:33AM

Re: request hangs

agentzh February 28, 2011 02:54AM

Re: request hangs

magz February 28, 2011 03:23AM

Re: request hangs

magz February 28, 2011 01:26PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 52
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready