[PATCH] HTTP/2: add fast-path for HTTP/2 requests without request body

Valentin V. Bartenev vbart at nginx.com
Wed Apr 5 15:13:52 UTC 2017


On Wednesday 05 April 2017 05:32:50 Piotr Sikora via nginx-devel wrote:
> Hey Valentin,
> 
> > # HG changeset patch
> > # User Piotr Sikora <piotrsikora at google.com>
> > # Date 1490516712 25200
> > #      Sun Mar 26 01:25:12 2017 -0700
> > # Node ID 630a8209defe25add7094dfc7b9bc9bcabe0933d
> > # Parent  22be63bf21edaa1b8ea916c7d8cd4e5fe4892061
> > HTTP/2: add fast-path for HTTP/2 requests without request body.
> >
> > Signed-off-by: Piotr Sikora <piotrsikora at google.com>
> >
> > diff -r 22be63bf21ed -r 630a8209defe src/http/v2/ngx_http_v2.c
> > --- a/src/http/v2/ngx_http_v2.c
> > +++ b/src/http/v2/ngx_http_v2.c
> > @@ -3520,6 +3520,12 @@ ngx_http_v2_read_request_body(ngx_http_r
> >
> >      r->request_body = rb;
> >
> > +    if (stream->in_closed && stream->preread == NULL) {
> > +        r->request_body_no_buffering = 0;
> > +        post_handler(r);
> > +        return NGX_OK;
> > +    }
> > +
> >      h2scf = ngx_http_get_module_srv_conf(r, ngx_http_v2_module);
> >      clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
> >
> 
> Any thoughts on the updated patch? Thanks!
> 
[..]

With your patch the behavior is different in these cases:

GET / HTTP/1.1
Host: example.com
Transfer-Encoding: chunked

0

and

HEADERS
DATA length:0 END_STREAM

Moreover, it depends on the time when DATA frame is processed:
before ngx_http_read_request_body() call or after.

  wbr, Valentin V. Bartenev



More information about the nginx-devel mailing list