diff options
author | Maxim Dounin <mdounin@mdounin.ru> | 2012-11-21 00:57:56 +0000 |
---|---|---|
committer | Maxim Dounin <mdounin@mdounin.ru> | 2012-11-21 00:57:56 +0000 |
commit | c29837fc4dad250d6d332eddea8edbaae7af5056 (patch) | |
tree | 34bde48fdcb9d58490d49885e977a9628ddc70d7 /src | |
parent | e1bd52041bb14f4422cd809e3ff36ec039a7ac6f (diff) | |
download | nginx-c29837fc4dad250d6d332eddea8edbaae7af5056.tar.gz nginx-c29837fc4dad250d6d332eddea8edbaae7af5056.zip |
Request body: properly handle events while discarding body.
An attempt to call ngx_handle_read_event() before actually reading
data from a socket might result in read event being disabled, which is
wrong. Catched by body.t test on Solaris.
Diffstat (limited to 'src')
-rw-r--r-- | src/http/ngx_http_request_body.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/http/ngx_http_request_body.c b/src/http/ngx_http_request_body.c index 691f10e84..3c69d052c 100644 --- a/src/http/ngx_http_request_body.c +++ b/src/http/ngx_http_request_body.c @@ -482,19 +482,21 @@ ngx_http_discard_request_body(ngx_http_request_t *r) } } + if (ngx_http_read_discarded_request_body(r) == NGX_OK) { + r->lingering_close = 0; + return NGX_OK; + } + + /* == NGX_AGAIN */ + r->read_event_handler = ngx_http_discarded_request_body_handler; if (ngx_handle_read_event(rev, 0) != NGX_OK) { return NGX_HTTP_INTERNAL_SERVER_ERROR; } - if (ngx_http_read_discarded_request_body(r) == NGX_OK) { - r->lingering_close = 0; - - } else { - r->count++; - r->discard_body = 1; - } + r->count++; + r->discard_body = 1; return NGX_OK; } |