[PATCH]Upstream: avoided directly terminating the connection.

flygoast flygoast at 126.com
Wed Aug 13 07:03:52 UTC 2014


# HG changeset patch
# User FengGu <flygoast at 126.com>
# Date 1407912835 -28800
#      Wed Aug 13 14:53:55 2014 +0800
# Node ID 9dd4e38fcce05bcbba4747873a579bc2c9392dd2
# Parent  92490a725fef588939abfe0e1fe89cda0788d02d
Upstream: avoided directly terminating the connection.


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.


diff -r 92490a725fef -r 9dd4e38fcce0 src/http/ngx_http_upstream.c
--- a/src/http/ngx_http_upstream.c  Sun Aug 10 17:44:46 2014 +0400
+++ b/src/http/ngx_http_upstream.c  Wed Aug 13 14:53:55 2014 +0800
@@ -519,6 +519,11 @@ ngx_http_upstream_init_request(ngx_http_
             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;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20140813/de9b54ea/attachment.html>


More information about the nginx-devel mailing list