]> git.kaiwu.me - nginx.git/commitdiff
Upstream: avoided directly terminating the connection.
authorFengGu <flygoast@126.com>
Wed, 13 Aug 2014 06:53:55 +0000 (14:53 +0800)
committerFengGu <flygoast@126.com>
Wed, 13 Aug 2014 06:53:55 +0000 (14:53 +0800)
When memory allocation failed in ngx_http_upstream_cache(), the connection
would be terminated directly in ngx_http_upstream_init_request().
Return a INTERNAL_SERVER_ERROR response instead.

src/http/ngx_http_upstream.c

index 94dd466af9e41cc42a38a93d82a24ccdf3867616..996dc8a8501a0b824cdec27d351fcaead768d1a7 100644 (file)
@@ -519,6 +519,11 @@ ngx_http_upstream_init_request(ngx_http_request_t *r)
             return;
         }
 
+        if (rc == NGX_ERROR) {
+            ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
+            return;
+        }
+
         if (rc != NGX_DECLINED) {
             ngx_http_finalize_request(r, rc);
             return;