Upstream: jump out of unnecessary loop after matching the status code.

Jim T h312841925 at gmail.com
Wed May 13 14:17:18 UTC 2020


Hi:

In ngx_http_upstream_test_next, the loop will continue when the status is
matched, and the ngx_http_upstream_next_errors is non-repeating. I think we
can jump out of for the unnecessary loop, and here is my patch:

# HG changeset patch
# User Jinhua Tan <312841925 at qq.com>
# Date 1589378567 -28800
#      Wed May 13 22:02:47 2020 +0800
# Node ID c79fcc4cf3acb68ca0e5c7767820c23308c40f6e
# Parent  028b16e2798f8ec4c6a3d042a6ac8a07f7262690
Upstream: jump out of unnecessary loop after matching the status code.

diff -r 028b16e2798f -r c79fcc4cf3ac src/http/ngx_http_upstream.c
--- a/src/http/ngx_http_upstream.c      Fri May 08 19:19:16 2020 +0300
+++ b/src/http/ngx_http_upstream.c      Wed May 13 22:02:47 2020 +0800
@@ -2502,6 +2502,8 @@
         }

 #endif
+
+        break;
     }

 #if (NGX_HTTP_CACHE)

Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20200513/a4fd32f5/attachment.htm>


More information about the nginx-devel mailing list