summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorValentin Bartenev <vbart@nginx.com>2016-04-19 17:38:49 +0300
committerValentin Bartenev <vbart@nginx.com>2016-04-19 17:38:49 +0300
commitf4df08b19d5e2e9f5454b3850a0c01bc4f356125 (patch)
treee36c92a26f740d5f3d1d68febf811ddd8bbe1986 /src
parenteeb72127cf4b86cb57f53e1f4702bbd1edd1a04a (diff)
downloadnginx-f4df08b19d5e2e9f5454b3850a0c01bc4f356125.tar.gz
nginx-f4df08b19d5e2e9f5454b3850a0c01bc4f356125.tar.bz2
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.
Diffstat (limited to 'src')
-rw-r--r--src/http/v2/ngx_http_v2.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/http/v2/ngx_http_v2.c b/src/http/v2/ngx_http_v2.c
index e960aaacb..421cfa03a 100644
--- a/src/http/v2/ngx_http_v2.c
+++ b/src/http/v2/ngx_http_v2.c
@@ -3481,20 +3481,21 @@ ngx_http_v2_read_request_body(ngx_http_request_t *r,
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;
+ 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;
- }
+ } 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 (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);