# HG changeset patch # User Valentin Bartenev # Date 1454420035 -10800 # Node ID e30c72b0dfda749036de51cce856bf8e289ee627 # Parent f598de1bfcd42ff209695a6d9b49569a602bb851 HTTP/2: fixed request length accounting. Now it includes not only the received body size, but the size of headers block as well. diff -r f598de1bfcd4 -r e30c72b0dfda src/http/v2/ngx_http_v2.c --- a/src/http/v2/ngx_http_v2.c Tue Feb 02 16:33:55 2016 +0300 +++ b/src/http/v2/ngx_http_v2.c Tue Feb 02 16:33:55 2016 +0300 @@ -1185,6 +1185,8 @@ return ngx_http_v2_connection_error(h2c, NGX_HTTP_V2_INTERNAL_ERROR); } + stream->request->request_length = h2c->state.length; + stream->in_closed = h2c->state.flags & NGX_HTTP_V2_END_STREAM_FLAG; stream->node = node; @@ -1751,7 +1753,6 @@ return ngx_http_v2_connection_error(h2c, NGX_HTTP_V2_PROTOCOL_ERROR); } - h2c->state.length += ngx_http_v2_parse_length(head); h2c->state.flags |= p[4]; if (h2c->state.sid != ngx_http_v2_parse_sid(&p[5])) { @@ -1766,6 +1767,14 @@ ngx_memcpy(pos, p, len); + len = ngx_http_v2_parse_length(head); + + h2c->state.length += len; + + if (h2c->state.stream) { + h2c->state.stream->request->request_length += len; + } + h2c->state.handler = handler; return pos; }