details:   http://freenginx.org/hg/nginx/rev/51e0dc713784
branches:  
changeset: 9252:51e0dc713784
user:      Maxim Dounin <mdou...@mdounin.ru>
date:      Sat Apr 27 18:18:13 2024 +0300
description:
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.

diffstat:

 src/http/modules/ngx_http_proxy_module.c |  3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diffs (13 lines):

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
@@ -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;
     }
-- 
nginx-devel mailing list
nginx-devel@freenginx.org
https://freenginx.org/mailman/listinfo/nginx-devel

Reply via email to