[dev] possible "bug" in ngx_http_read_discarded_body_handler

Igor Sysoev is at rambler-co.ru
Wed Oct 3 19:03:42 MSD 2007


On Mon, Oct 01, 2007 at 08:46:56PM +0200, Manlio Perillo wrote:

> I'm reading the ngx_http_request_body source file version 0.5.31, and I 
> have found a possible "bug":
> 
> 
> static void
> ngx_http_read_discarded_body_handler(ngx_http_request_t *r)
> {
>     ngx_int_t  rc;
> 
>     rc = ngx_http_read_discarded_body(r);
> 
>     if (rc == NGX_AGAIN) {
>         if (ngx_handle_read_event(r->connection->read, 0) == NGX_ERROR) 
>    {
>             ngx_http_finalize_request(r, rc);
>             return;
>         }
>     }
> 
> 
> I think that the code should be:
> 
>     if (rc == NGX_AGAIN) {
>         if (ngx_handle_read_event(r->connection->read, 0) == NGX_ERROR) 
>    {
>             ngx_http_finalize_request(r, NGX_ERROR);
>             return;
>         }
>     }
> 
> 
> If I'm wrong, then I do not understand why to finalize with NGX_AGAIN.

Yes, you right. Fortunatly, ngx_handle_read_event() should never fail,
only if something wrong in kernel.


-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list