ngx_http_read_client_request_body() and ACCESS_PHASE handler

Srebrenko Šehić ssehic at gmail.com
Fri Apr 23 01:48:16 MSD 2010


On Thu, Apr 22, 2010 at 6:16 PM, Yuriy Taraday <yorik.sar at gmail.com> wrote:

> The return code NGX_AGAIN means that you should wait for more data
> before you proceed. This behavior is quite clear when you understand
> that you have to wait for next TCP packet for some data. You should
> expect you handler to be called at least one more time when more data
> will be received.

Hi,

I probably didn't express my self clearly enough. I know that my
handler will get NGX_AGAIN in case there is more data pending from the
client. However, I simply return the return code that I get (for
testing purposes) and then nothing happens. My handler gets called
once more, but the request seems to hangs afterwards and the client
never receives anything.

So the real question is I guess:

Is there anything special that needs to be done to in a ACCESS_PHASE
handler that reads the POST payload via
ngx_http_read_client_request_body()? Like returning a special code or
calling ngx_http_special_response() or ngx_http_finalize_request()?

Other content handlers that do this (but not in ACCSS_PHASE), do
something like this:

static ngx_int_t some_handler(ngx_http_request_t *r)
{

   [ ...snip... ]

    rc = ngx_http_read_client_request_body(r, my_handler);

    if (rc >= NGX_HTTP_SPECIAL_RESPONSE) {
        return rc;
    }

    return NGX_DONE;
}

Anybody?

Thanks,
Srebrenko



More information about the nginx-devel mailing list