changeset 9252:51e0dc713784

Proxy: use zero Content-Length while discarding request body. Previously, r->headers_in.content_length_n was used, which is not 0 till the request body is fully discarded, and the request might hang.
author Maxim Dounin <mdounin@mdounin.ru>
date Sat, 27 Apr 2024 18:18:13 +0300
parents 3728a0ed243a
children a6649497a762
files src/http/modules/ngx_http_proxy_module.c
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/http/modules/ngx_http_proxy_module.c
+++ b/src/http/modules/ngx_http_proxy_module.c
@@ -1341,6 +1341,9 @@ ngx_http_proxy_create_request(ngx_http_r
         ctx->internal_body_length = -1;
         ctx->internal_chunked = 1;
 
+    } else if (r->discard_body) {
+        ctx->internal_body_length = 0;
+
     } else {
         ctx->internal_body_length = r->headers_in.content_length_n;
     }