Mercurial > hg > nginx
changeset 6514:0aa07850922f
HTTP/2: refuse streams with data until SETTINGS is acknowledged.
A client is allowed to send requests before receiving and acknowledging
the SETTINGS frame. Such a client having a wrong idea about the stream's
could send the request body that nginx isn't ready to process.
The previous behavior was to send RST_STREAM with FLOW_CONTROL_ERROR in
such case, but it didn't allow retrying requests that have been rejected.
author | Valentin Bartenev <vbart@nginx.com> |
---|---|
date | Thu, 14 Apr 2016 15:14:15 +0300 |
parents | 80ba811112ed |
children | 8df664ebe037 |
files | src/http/v2/ngx_http_v2.c src/http/v2/ngx_http_v2.h |
diffstat | 2 files changed, 8 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/http/v2/ngx_http_v2.c Thu Apr 14 15:14:15 2016 +0300 +++ b/src/http/v2/ngx_http_v2.c Thu Apr 14 15:14:15 2016 +0300 @@ -1058,6 +1058,12 @@ goto rst_stream; } + if (!h2c->settings_ack && !(h2c->state.flags & NGX_HTTP_V2_END_STREAM_FLAG)) + { + status = NGX_HTTP_V2_REFUSED_STREAM; + goto rst_stream; + } + node = ngx_http_v2_get_node_by_id(h2c, h2c->state.sid, 1); if (node == NULL) { @@ -1878,7 +1884,7 @@ return ngx_http_v2_connection_error(h2c, NGX_HTTP_V2_SIZE_ERROR); } - /* TODO settings acknowledged */ + h2c->settings_ack = 1; return ngx_http_v2_state_complete(h2c, pos, end); }