summaryrefslogtreecommitdiffstats
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
commit22285687c9abac86b91a76b22ef03380f647b29a (patch)
tree44dd93927911a27548b73dc7191abf68e1f1e206
parent7458f6667530aef24272e5b5dc8815c27b35b05f (diff)
HTTP/2: send the output queue after emitting WINDOW_UPDATE.
The WINDOW_UPDATE frame could be left in the output queue for an indefinite period of time resulting in the request timeout. This might happen if reading of the body was triggered by an event unrelated to client connection, e.g. by the limit_req timer.
-rw-r--r--src/http/v2/ngx_http_v2.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/http/v2/ngx_http_v2.c b/src/http/v2/ngx_http_v2.c
index dd712c121..278c9abf6 100644
--- a/src/http/v2/ngx_http_v2.c
+++ b/src/http/v2/ngx_http_v2.c
@@ -3414,6 +3414,7 @@ ngx_http_v2_read_request_body(ngx_http_request_t *r,
ngx_http_v2_stream_t *stream;
ngx_http_request_body_t *rb;
ngx_http_core_loc_conf_t *clcf;
+ ngx_http_v2_connection_t *h2c;
stream = r->stream;
@@ -3498,6 +3499,15 @@ ngx_http_v2_read_request_body(ngx_http_request_t *r,
stream->skip_data = 1;
return NGX_HTTP_INTERNAL_SERVER_ERROR;
}
+
+ h2c = stream->connection;
+
+ if (!h2c->blocked) {
+ if (ngx_http_v2_send_output_queue(h2c) == NGX_ERROR) {
+ stream->skip_data = 1;
+ return NGX_HTTP_INTERNAL_SERVER_ERROR;
+ }
+ }
}
ngx_add_timer(r->connection->read, clcf->client_body_timeout);