NGX_AGAIN and POST data

Valery Kholodkov valery+nginxen at grid.net.ru
Mon Oct 6 15:29:59 MSD 2008


> The confusing part to me is the following lines from
> src/http/ngx_http_core_module.c:
>
>     if (r->content_handler) {
>         r->write_event_handler = ngx_http_request_empty_handler;
>         ngx_http_finalize_request(r, r->content_handler(r));
>         return NGX_OK;
>     }
>
> which appears to (according the debug stuff in the log) simply close
> out the connection regardless of the return value from
> content_handler().  Shouldn't my module be getting re-called when more
> data is available from the connection or am I misunderstanding
> something?

No. post_handler (the second argument of
ngx_http_read_client_request_body) should be called when the body will be
successfully received.

ngx_http_finalize_request does not close the connection whenever rc ==
NGX_AGAIN. Instead ngx_http_read_client_request_body sets read handler to
ngx_http_read_client_request_body_handler. Therefore the read handler will
be recalled, not your handler.

-- 
Best regards,
Valery Kholodkov





More information about the nginx mailing list