diff options
| author | Valentin Bartenev <vbart@nginx.com> | 2016-02-02 16:33:55 +0300 |
|---|---|---|
| committer | Valentin Bartenev <vbart@nginx.com> | 2016-02-02 16:33:55 +0300 |
| commit | 8050277acf9d87ac72fe4c5547838a7ba425999a (patch) | |
| tree | f2282927c51bfa7b8bd9d166acc1d649d9e5ad8d | |
| parent | 405f4f99b4471a3073304f9ce689000dcb592ee4 (diff) | |
| download | nginx-8050277acf9d87ac72fe4c5547838a7ba425999a.tar.gz nginx-8050277acf9d87ac72fe4c5547838a7ba425999a.tar.bz2 | |
HTTP/2: fixed request length accounting.
Now it includes not only the received body size,
but the size of headers block as well.
| -rw-r--r-- | src/http/v2/ngx_http_v2.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/http/v2/ngx_http_v2.c b/src/http/v2/ngx_http_v2.c index 9df2168ca..b7106fec8 100644 --- a/src/http/v2/ngx_http_v2.c +++ b/src/http/v2/ngx_http_v2.c @@ -1185,6 +1185,8 @@ ngx_http_v2_state_headers(ngx_http_v2_connection_t *h2c, u_char *pos, 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 @@ ngx_http_v2_handle_continuation(ngx_http_v2_connection_t *h2c, u_char *pos, 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_http_v2_handle_continuation(ngx_http_v2_connection_t *h2c, u_char *pos, 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; } |
