Brian Bruns brian.bruns at
Wed Oct 15 07:42:34 MSD 2008

I believe I have solved my problem.  At the end of my request body
post_handler, I am now doing this:

    rc = ngx_http_output_filter(r, &out);
    ngx_http_finalize_request(r, rc);

I still not sure this is quite right, particularly on which value I
should be sending for the second argument to
ngx_http_finalize_request(), but it does seem to work reliably.

Thank you for all your help,


2008/10/14 Brian Bruns <brian.bruns at>:
> Hi Valery,
> First, thanks for all your help, I'm slowing getting a handle on the
> internal workings of nginx but it's been a bit of a learning curve.
> I did some more digging and what I'm finding is that everything is
> indeed working correctly except the connection is not closed after the
> results are returned.  Here is the transaction with my module in the
> loop:
> request:
> POST /hello HTTP/1.0
> Content-Length: 10
> abcd=12345
> response:
> HTTP/1.1 200 OK
> Server: nginx/0.7.19
> Date: Wed, 15 Oct 2008 03:02:41 GMT
> Content-Type: text/plain
> Content-Length: 11
> Last-Modified: Mon, 28 Sep 1970 06:00:00 GMT
> Connection: close
> hello world
> The connection then hangs until another character is sent from the
> client to the server at which time it closes.
> I've replicated the same request using fastcgi/perl and it works flawlessly.
> Any thoughts on why my module would require additional input from the
> client to close the connection?
> Thanks again,
> Brian
> 2008/10/9 Valery Kholodkov <valery+nginxen at>:
>>> What I want to do is "return ngx_http_output_filter(r, &out);" just
>>> like before, but that seems to not work, my question is should it work
>>> from the request_body_handler and is there any special trick to doing
>>> so or better yet an existing module I can look at for pointers? I
>>> couldn't find one, virtually everything that uses
>>> ngx_http_read_client_request_body is an upstream module.
>> I don't know whether a module doing similar thing exists, but I assume you
>> invoke ngx_http_send_header, interpret the result, call
>> ngx_http_output_filter and it should be ok.
>> --
>> Best regards,
>> Valery Kholodkov

More information about the nginx mailing list