comparison src/http/v2/ngx_http_v2.c @ 6754:12b1df4c9944 stable-1.10

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.
author Valentin Bartenev <vbart@nginx.com>
date Thu, 16 Jun 2016 20:55:11 +0300
parents 20485a482bc0
children d375f4210e41
comparison
equal deleted inserted replaced
6753:20485a482bc0 6754:12b1df4c9944
3422 3422
3423 ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST); 3423 ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST);
3424 return; 3424 return;
3425 } 3425 }
3426 3426
3427 r->headers_in.chunked = (r->headers_in.content_length_n == -1); 3427 if (r->headers_in.content_length_n == -1 && !r->stream->in_closed) {
3428 r->headers_in.chunked = 1;
3429 }
3428 3430
3429 ngx_http_process_request(r); 3431 ngx_http_process_request(r);
3430 } 3432 }
3431 3433
3432 3434
3636 if (buf->sync) { 3638 if (buf->sync) {
3637 /* prevent reusing this buffer in the upstream module */ 3639 /* prevent reusing this buffer in the upstream module */
3638 rb->buf = NULL; 3640 rb->buf = NULL;
3639 } 3641 }
3640 3642
3641 if (r->headers_in.content_length_n == -1) { 3643 if (r->headers_in.chunked) {
3642 r->headers_in.content_length_n = rb->received; 3644 r->headers_in.content_length_n = rb->received;
3643 } 3645 }
3644 3646
3645 r->read_event_handler = ngx_http_block_reading; 3647 r->read_event_handler = ngx_http_block_reading;
3646 rb->post_handler(r); 3648 rb->post_handler(r);