mirror of
https://github.com/nginx/nginx.git
synced 2026-10-24 14:47:45 -05:00
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. Adapted for nginx: the same change is applied to the HTTP/2 proxy module (proxy_http_version 2), which is not present in freenginx and used r->headers_in.content_length_n in the same way. With an HTTP/2 upstream, the stale length resulted in the request being rejected by the upstream, since the stream was closed without the body. Co-authored-by: Elijah Zupancic <e.zupancic@f5.com> Signed-off-by: Elijah Zupancic <e.zupancic@f5.com> Origin: <https://freenginx.org/hg/nginx/rev/51e0dc7137843feda75b497773f598d3836c60a1>
This commit is contained in:
1 parent
807e53d990
commit
148c75678c
2 files changed
+6
No files matched your search
@@ -1307,6 +1307,9 @@ ngx_http_proxy_create_request(ngx_http_request_t *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;
|
||||
}
|
||||
|
||||
@@ -496,6 +496,9 @@ ngx_http_proxy_v2_create_request(ngx_http_request_t *r)
|
||||
} else if (r->headers_in.chunked && r->reading_body) {
|
||||
ctx->ctx.internal_body_length = -1;
|
||||
|
||||
} else if (r->discard_body) {
|
||||
ctx->ctx.internal_body_length = 0;
|
||||
|
||||
} else {
|
||||
ctx->ctx.internal_body_length = r->headers_in.content_length_n;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user