[PATCH 1 of 4] HTTP/2: emit new frames only after applying all SETTINGS params

Valentin V. Bartenev vbart at nginx.com
Thu Jun 1 17:54:54 UTC 2017


On Thursday 01 June 2017 17:48:25 Valentin V. Bartenev wrote:
> On Monday 24 April 2017 15:48:23 Piotr Sikora via nginx-devel wrote:
> > # HG changeset patch
> > # User Piotr Sikora <piotrsikora at google.com>
> > # Date 1493073310 25200
> > #      Mon Apr 24 15:35:10 2017 -0700
> > # Node ID 07adf0a7009c3244de4b795c0c06927f4316a87f
> > # Parent  2c4dbcd6f2e4c9c2a1eb8dc1f0d39c99975ae208
> > 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 at google.com>
> > 
> > diff -r 2c4dbcd6f2e4 -r 07adf0a7009c src/http/v2/ngx_http_v2.c
> > --- a/src/http/v2/ngx_http_v2.c
> > +++ b/src/http/v2/ngx_http_v2.c
> > @@ -1982,7 +1982,9 @@ static u_char *
> >  ngx_http_v2_state_settings_params(ngx_http_v2_connection_t *h2c, u_char *pos,
> >      u_char *end)
> >  {
> > -    ngx_uint_t  id, value;
> > +    ngx_uint_t  id, value, adjustment;
> 
> The new initial window size can be lower than the previous one,
> so the difference can be negative (that's why the delta parameter
> of ngx_http_v2_adjust_windows() is ssize_t).
> 
> Please consider the patch below:
> 
> diff -r 00015416ae79 src/http/v2/ngx_http_v2.c
> --- a/src/http/v2/ngx_http_v2.c Mon Apr 24 15:35:10 2017 -0700
> +++ b/src/http/v2/ngx_http_v2.c Thu Jun 01 17:45:37 2017 +0300
> @@ -1969,7 +1969,8 @@ static u_char *
>  ngx_http_v2_state_settings_params(ngx_http_v2_connection_t *h2c, u_char *pos,
>      u_char *end)
>  {
> -    ngx_uint_t  id, value, adjustment;
> +    ssize_t     window_delta;
> +    ngx_uint_t  id, value;
>  
>      adjustment = 0;
>  
[..]

Err.. of course here should be "window_delta = 0;".

  wbr, Valentin V. Bartenev


More information about the nginx-devel mailing list