[PATCH 01 of 12] Proxy: replaced some r->upstream usage with the "u" variable

Maxim Dounin mdounin at mdounin.ru
Fri Aug 8 20:08:56 UTC 2025


# HG changeset patch
# User Maxim Dounin <mdounin at mdounin.ru>
# Date 1754683240 -10800
#      Fri Aug 08 23:00:40 2025 +0300
# Node ID 3b2af53cea942782c3aed07279a88c2d6ceef7c7
# Parent  bdfd605f661eea3d272caf1bd5d85e7c539394ca
Proxy: replaced some r->upstream usage with the "u" variable.

No functional changes.

diff --git a/src/http/modules/ngx_http_proxy_module.c b/src/http/modules/ngx_http_proxy_module.c
--- a/src/http/modules/ngx_http_proxy_module.c
+++ b/src/http/modules/ngx_http_proxy_module.c
@@ -1958,13 +1958,15 @@ ngx_http_proxy_process_header(ngx_http_r
             ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
                            "http proxy header done");
 
+            u = r->upstream;
+
             /*
              * if no "Server" and "Date" in header line,
              * then add the special empty headers
              */
 
-            if (r->upstream->headers_in.server == NULL) {
-                h = ngx_list_push(&r->upstream->headers_in.headers);
+            if (u->headers_in.server == NULL) {
+                h = ngx_list_push(&u->headers_in.headers);
                 if (h == NULL) {
                     return NGX_ERROR;
                 }
@@ -1978,8 +1980,8 @@ ngx_http_proxy_process_header(ngx_http_r
                 h->next = NULL;
             }
 
-            if (r->upstream->headers_in.date == NULL) {
-                h = ngx_list_push(&r->upstream->headers_in.headers);
+            if (u->headers_in.date == NULL) {
+                h = ngx_list_push(&u->headers_in.headers);
                 if (h == NULL) {
                     return NGX_ERROR;
                 }
@@ -1994,8 +1996,6 @@ ngx_http_proxy_process_header(ngx_http_r
 
             /* clear content length if response is chunked */
 
-            u = r->upstream;
-
             if (u->headers_in.chunked) {
                 u->headers_in.content_length_n = -1;
             }



More information about the nginx-devel mailing list