]> git.kaiwu.me - nginx.git/commitdiff
finalizing with rc == 0 in unbuffered proxy mode caused nginx to wait
authorIgor Sysoev <igor@sysoev.ru>
Fri, 22 Jul 2011 13:30:16 +0000 (13:30 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Fri, 22 Jul 2011 13:30:16 +0000 (13:30 +0000)
for another send_timeout before actually closing client's connection
if client timed out while still talking to upstream server

patch by Maxim Dounin

src/http/ngx_http_upstream.c

index ad5b449ec5915a1b5e772942f4204997cd0c7149..42b351c4d18575b4aa80cc10bc66d62929ddc193 100644 (file)
@@ -2317,7 +2317,7 @@ ngx_http_upstream_process_non_buffered_downstream(ngx_http_request_t *r)
     if (wev->timedout) {
         c->timedout = 1;
         ngx_connection_error(c, NGX_ETIMEDOUT, "client timed out");
-        ngx_http_upstream_finalize_request(r, u, 0);
+        ngx_http_upstream_finalize_request(r, u, NGX_HTTP_REQUEST_TIME_OUT);
         return;
     }
 
@@ -3013,6 +3013,7 @@ ngx_http_upstream_finalize_request(ngx_http_request_t *r,
 #endif
 
     if (u->header_sent
+        && rc != NGX_HTTP_REQUEST_TIME_OUT
         && (rc == NGX_ERROR || rc >= NGX_HTTP_SPECIAL_RESPONSE))
     {
         rc = 0;