]> git.kaiwu.me - nginx.git/commitdiff
clear r->lingering_close to disable preventively calling
authorIgor Sysoev <igor@sysoev.ru>
Fri, 2 Oct 2009 11:32:56 +0000 (11:32 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Fri, 2 Oct 2009 11:32:56 +0000 (11:32 +0000)
ngx_http_set_lingering_close() while request cleanup

src/http/ngx_http_request_body.c

index 83e2d015bc45658e7f81c57da06eb6588354f09e..3ee2ea4776f2f1b4a1f704c37c71e7460412023a 100644 (file)
@@ -475,7 +475,10 @@ ngx_http_discard_request_body(ngx_http_request_t *r)
         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;
     }
@@ -508,6 +511,7 @@ ngx_http_read_discarded_request_body_handler(ngx_http_request_t *r)
 
         if (timer <= 0) {
             r->discard_body = 0;
+            r->lingering_close = 0;
             ngx_http_finalize_request(r, 0);
             return;
         }
@@ -521,6 +525,7 @@ ngx_http_read_discarded_request_body_handler(ngx_http_request_t *r)
     if (rc == NGX_OK) {
 
         r->discard_body = 0;
+        r->lingering_close = 0;
 
         if (r->done) {
             ngx_http_finalize_request(r, 0);