comparison src/http/v2/ngx_http_v2.c @ 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 ab16126a06a0
children 9ac934dd5dd8
comparison
equal deleted inserted replaced
6517:657e029bac28 6518:7760b54d5458
3479 if (stream->in_closed) { 3479 if (stream->in_closed) {
3480 r->request_body_no_buffering = 0; 3480 r->request_body_no_buffering = 0;
3481 return ngx_http_v2_process_request_body(r, NULL, 0, 1); 3481 return ngx_http_v2_process_request_body(r, NULL, 0, 1);
3482 } 3482 }
3483 3483
3484 if (r->request_body_no_buffering) { 3484 if (len) {
3485 stream->no_flow_control = 0; 3485 if (r->request_body_no_buffering) {
3486 stream->recv_window = (size_t) len; 3486 stream->recv_window = (size_t) len;
3487 3487
3488 } else { 3488 } else {
3489 stream->no_flow_control = 1; 3489 stream->no_flow_control = 1;
3490 stream->recv_window = NGX_HTTP_V2_MAX_WINDOW; 3490 stream->recv_window = NGX_HTTP_V2_MAX_WINDOW;
3491 } 3491 }
3492 3492
3493 if (ngx_http_v2_send_window_update(stream->connection, stream->node->id, 3493 if (ngx_http_v2_send_window_update(stream->connection, stream->node->id,
3494 stream->recv_window) 3494 stream->recv_window)
3495 == NGX_ERROR) 3495 == NGX_ERROR)
3496 { 3496 {
3497 return NGX_HTTP_INTERNAL_SERVER_ERROR; 3497 return NGX_HTTP_INTERNAL_SERVER_ERROR;
3498 }
3498 } 3499 }
3499 3500
3500 ngx_add_timer(r->connection->read, clcf->client_body_timeout); 3501 ngx_add_timer(r->connection->read, clcf->client_body_timeout);
3501 3502
3502 r->read_event_handler = ngx_http_v2_read_client_request_body_handler; 3503 r->read_event_handler = ngx_http_v2_read_client_request_body_handler;