]> git.kaiwu.me - nginx.git/commitdiff
Proxy: fix keepalive for HTTP/2 with explicit or no body
authorRoman Arutyunyan <arut@nginx.com>
Tue, 5 May 2026 11:22:05 +0000 (15:22 +0400)
committerRoman Arutyunyan <arutyunyan.roman@gmail.com>
Thu, 7 May 2026 09:18:39 +0000 (13:18 +0400)
Previously, when an HTTP/2 request had no body or an explicit body
was set by proxy_set_body, the request consisted of only one buffer,
which had no b->last_buf flag set.  This prevented ctx->output_closed
from being set after processing this buffer.  Consequently,
u->keepalive might not be set to store the connection in the
keepalive cache.

src/http/modules/ngx_http_proxy_v2_module.c

index 4c282a8640448d9045643dfbb64ba300e01db4d5..7cff58d3b4ccfaa310cf909816cd5a713c967814 100644 (file)
@@ -910,6 +910,8 @@ ngx_http_proxy_v2_create_request(ngx_http_request_t *r)
             f = (ngx_http_proxy_v2_frame_t *) headers_frame;
             f->flags |= NGX_HTTP_V2_END_STREAM_FLAG;
         }
+
+        b->last_buf = 1;
     }
 
     u->output.output_filter = ngx_http_proxy_v2_body_output_filter;