diff src/http/ngx_http_request_body.c @ 532:f7ec98e3caeb NGINX_0_8_18

nginx 0.8.18 *) Feature: the "read_ahead" directive. *) Feature: now several "perl_modules" directive may be used. *) Feature: the "limit_req_log_level" and "limit_conn_log_level" directives. *) Bugfix: now "limit_req" directive conforms to the leaky bucket algorithm. Thanks to Maxim Dounin. *) Bugfix: nginx did not work on Linux/sparc. Thanks to Marcus Ramberg. *) Bugfix: nginx sent '\0' in a "Location" response header line on MKCOL request. Thanks to Xie Zhenye. *) Bugfix: zero status code was logged instead of 499 status code; the bug had appeared in 0.8.11. *) Bugfix: socket leak; the bug had appeared in 0.8.11.
author Igor Sysoev <http://sysoev.ru>
date Tue, 06 Oct 2009 00:00:00 +0400
parents 4c5d2c627a6c
children 1dcf6adad484
line wrap: on
line diff
--- a/src/http/ngx_http_request_body.c
+++ b/src/http/ngx_http_request_body.c
@@ -469,16 +469,18 @@ ngx_http_discard_request_body(ngx_http_r
         }
     }
 
-    r->discard_body = 1;
-
     r->read_event_handler = ngx_http_read_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) {
+    if (ngx_http_read_discarded_request_body(r) == NGX_OK) {
+        r->lingering_close = 0;
+
+    } else {
         r->count++;
+        r->discard_body = 1;
     }
 
     return NGX_OK;
@@ -509,6 +511,7 @@ ngx_http_read_discarded_request_body_han
 
         if (timer <= 0) {
             r->discard_body = 0;
+            r->lingering_close = 0;
             ngx_http_finalize_request(r, 0);
             return;
         }
@@ -522,6 +525,7 @@ ngx_http_read_discarded_request_body_han
     if (rc == NGX_OK) {
 
         r->discard_body = 0;
+        r->lingering_close = 0;
 
         if (r->done) {
             ngx_http_finalize_request(r, 0);