[PATCH 03 of 14] Proxy: use zero Content-Length while discarding request body
Maxim Dounin
mdounin at mdounin.ru
Sat Apr 20 00:59:51 UTC 2024
# HG changeset patch
# User Maxim Dounin <mdounin at mdounin.ru>
# Date 1713574630 -10800
# Sat Apr 20 03:57:10 2024 +0300
# Node ID c485429c713b5d24ba8329e95164b517cf8a1b87
# Parent 0946ec7c4a6a26fda6ed03cb1f1f877984ec5614
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.
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;
}
More information about the nginx-devel
mailing list