Mercurial > hg > nginx
changeset 6518:7760b54d5458
HTTP/2: don't send WINDOW_UPDATE for an empty request body.
Particularly this prevents sending WINDOW_UPDATE with zero delta
which can result in PROTOCOL_ERROR.
Also removed surplus setting of no_flow_control to 0.
author | Valentin Bartenev <vbart@nginx.com> |
---|---|
date | Tue, 19 Apr 2016 17:38:49 +0300 |
parents | 657e029bac28 |
children | 9ac934dd5dd8 |
files | src/http/v2/ngx_http_v2.c |
diffstat | 1 files changed, 15 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/src/http/v2/ngx_http_v2.c Tue Apr 19 17:18:28 2016 +0300 +++ b/src/http/v2/ngx_http_v2.c Tue Apr 19 17:38:49 2016 +0300 @@ -3481,20 +3481,21 @@ return ngx_http_v2_process_request_body(r, NULL, 0, 1); } - if (r->request_body_no_buffering) { - stream->no_flow_control = 0; - stream->recv_window = (size_t) len; - - } else { - stream->no_flow_control = 1; - stream->recv_window = NGX_HTTP_V2_MAX_WINDOW; - } - - if (ngx_http_v2_send_window_update(stream->connection, stream->node->id, - stream->recv_window) - == NGX_ERROR) - { - return NGX_HTTP_INTERNAL_SERVER_ERROR; + if (len) { + if (r->request_body_no_buffering) { + stream->recv_window = (size_t) len; + + } else { + stream->no_flow_control = 1; + stream->recv_window = NGX_HTTP_V2_MAX_WINDOW; + } + + if (ngx_http_v2_send_window_update(stream->connection, stream->node->id, + stream->recv_window) + == NGX_ERROR) + { + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } } ngx_add_timer(r->connection->read, clcf->client_body_timeout);