diff options
author | Piotr Sikora <piotrsikora@google.com> | 2017-06-02 15:05:20 +0300 |
---|---|---|
committer | Piotr Sikora <piotrsikora@google.com> | 2017-06-02 15:05:20 +0300 |
commit | 6cfc65c993ca7612083ffb247dc46aa69caf14f5 (patch) | |
tree | 9a5403b310d246109ea9717357a1f55a440f6b30 /src | |
parent | f0b0003f381943cb3730038b115bd7f2c9b21cac (diff) | |
download | nginx-6cfc65c993ca7612083ffb247dc46aa69caf14f5.tar.gz nginx-6cfc65c993ca7612083ffb247dc46aa69caf14f5.zip |
HTTP/2: emit new frames only after applying all SETTINGS params.
Previously, new frames could be emitted in the middle of applying
new (and already acknowledged) SETTINGS params, which is illegal.
Signed-off-by: Piotr Sikora <piotrsikora@google.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/http/v2/ngx_http_v2.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/http/v2/ngx_http_v2.c b/src/http/v2/ngx_http_v2.c index a90234af9..0a0dcd72b 100644 --- a/src/http/v2/ngx_http_v2.c +++ b/src/http/v2/ngx_http_v2.c @@ -1969,8 +1969,11 @@ static u_char * ngx_http_v2_state_settings_params(ngx_http_v2_connection_t *h2c, u_char *pos, u_char *end) { + ssize_t window_delta; ngx_uint_t id, value; + window_delta = 0; + while (h2c->state.length) { if (end - pos < NGX_HTTP_V2_SETTINGS_PARAM_SIZE) { return ngx_http_v2_state_save(h2c, pos, end, @@ -1995,12 +1998,7 @@ ngx_http_v2_state_settings_params(ngx_http_v2_connection_t *h2c, u_char *pos, NGX_HTTP_V2_FLOW_CTRL_ERROR); } - if (ngx_http_v2_adjust_windows(h2c, value - h2c->init_window) - != NGX_OK) - { - return ngx_http_v2_connection_error(h2c, - NGX_HTTP_V2_INTERNAL_ERROR); - } + window_delta = value - h2c->init_window; h2c->init_window = value; break; @@ -2028,6 +2026,13 @@ ngx_http_v2_state_settings_params(ngx_http_v2_connection_t *h2c, u_char *pos, pos += NGX_HTTP_V2_SETTINGS_PARAM_SIZE; } + if (window_delta) { + if (ngx_http_v2_adjust_windows(h2c, window_delta) != NGX_OK) { + return ngx_http_v2_connection_error(h2c, + NGX_HTTP_V2_INTERNAL_ERROR); + } + } + return ngx_http_v2_state_complete(h2c, pos, end); } |