[nginx] HTTP/2: avoid adding Content-Length for requests without body.

2016-10-18 Thread Maxim Dounin
details:   http://hg.nginx.org/nginx/rev/12b1df4c9944
branches:  stable-1.10
changeset: 6754:12b1df4c9944
user:  Valentin Bartenev 
date:  Thu Jun 16 20:55:11 2016 +0300
description:
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:

 src/http/v2/ngx_http_v2.c |  6 --
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (23 lines):

diff --git a/src/http/v2/ngx_http_v2.c b/src/http/v2/ngx_http_v2.c
--- 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
 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_htt
 rb->buf = NULL;
 }
 
-if (r->headers_in.content_length_n == -1) {
+if (r->headers_in.chunked) {
 r->headers_in.content_length_n = rb->received;
 }
 

___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


[nginx] HTTP/2: avoid adding Content-Length for requests without body.

2016-06-16 Thread Valentin Bartenev
details:   http://hg.nginx.org/nginx/rev/78533a74af11
branches:  
changeset: 6589:78533a74af11
user:  Valentin Bartenev 
date:  Thu Jun 16 20:55:11 2016 +0300
description:
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:

 src/http/v2/ngx_http_v2.c |  6 --
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (23 lines):

diff -r dc5eaf998b96 -r 78533a74af11 src/http/v2/ngx_http_v2.c
--- a/src/http/v2/ngx_http_v2.c Thu Jun 16 20:55:11 2016 +0300
+++ b/src/http/v2/ngx_http_v2.c Thu Jun 16 20:55:11 2016 +0300
@@ -3424,7 +3424,9 @@ ngx_http_v2_run_request(ngx_http_request
 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_htt
 rb->buf = NULL;
 }
 
-if (r->headers_in.content_length_n == -1) {
+if (r->headers_in.chunked) {
 r->headers_in.content_length_n = rb->received;
 }
 

___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel