aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorValentin Bartenev <vbart@nginx.com>2016-06-16 20:55:11 +0300
committerValentin Bartenev <vbart@nginx.com>2016-06-16 20:55:11 +0300
commitbf5f915a019018f914c3f7c59d4a8baf27b93d67 (patch)
treee9c6e1e1dc347fd612b3c0fbc9275d4440c9f7b2 /src
parentcd2085be0c497153f9311f0a1986c6be6a18cff4 (diff)
downloadnginx-bf5f915a019018f914c3f7c59d4a8baf27b93d67.tar.gz
nginx-bf5f915a019018f914c3f7c59d4a8baf27b93d67.zip
HTTP/2: avoid adding Content-Length for requests without body.
There is no reason to add the "Content-Length: 0" header to a proxied request without body if the header isn't presented in the original request. Thanks to Amazon.
Diffstat (limited to 'src')
-rw-r--r--src/http/v2/ngx_http_v2.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/http/v2/ngx_http_v2.c b/src/http/v2/ngx_http_v2.c
index 99cb3fc70..342c307ef 100644
--- a/src/http/v2/ngx_http_v2.c
+++ b/src/http/v2/ngx_http_v2.c
@@ -3424,7 +3424,9 @@ ngx_http_v2_run_request(ngx_http_request_t *r)
return;
}
- r->headers_in.chunked = (r->headers_in.content_length_n == -1);
+ if (r->headers_in.content_length_n == -1 && !r->stream->in_closed) {
+ r->headers_in.chunked = 1;
+ }
ngx_http_process_request(r);
}
@@ -3638,7 +3640,7 @@ ngx_http_v2_process_request_body(ngx_http_request_t *r, u_char *pos,
rb->buf = NULL;
}
- if (r->headers_in.content_length_n == -1) {
+ if (r->headers_in.chunked) {
r->headers_in.content_length_n = rb->received;
}