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 | cb173ff6722635188546ce7dd8f2a737050d82d5 (patch) | |
| tree | 47ab31bb056c02ad036d1b1cdc3a85cda318fa9f | |
| parent | 8050277acf9d87ac72fe4c5547838a7ba425999a (diff) | |
| download | nginx-cb173ff6722635188546ce7dd8f2a737050d82d5.tar.gz nginx-cb173ff6722635188546ce7dd8f2a737050d82d5.tar.bz2 | |
HTTP/2: fixed padding handling in HEADERS frame with CONTINUATION.
| -rw-r--r-- | src/http/v2/ngx_http_v2.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/http/v2/ngx_http_v2.c b/src/http/v2/ngx_http_v2.c index b7106fec8..4e378c9dc 100644 --- a/src/http/v2/ngx_http_v2.c +++ b/src/http/v2/ngx_http_v2.c @@ -1733,11 +1733,21 @@ ngx_http_v2_handle_continuation(ngx_http_v2_connection_t *h2c, u_char *pos, u_char *end, ngx_http_v2_handler_pt handler) { u_char *p; - size_t len; + size_t len, skip; uint32_t head; len = h2c->state.length; + if (h2c->state.padding && (size_t) (end - pos) > len) { + skip = ngx_min(h2c->state.padding, (end - pos) - len); + + h2c->state.padding -= skip; + + p = pos; + pos += skip; + ngx_memmove(pos, p, len); + } + if ((size_t) (end - pos) < len + NGX_HTTP_V2_FRAME_HEADER_SIZE) { return ngx_http_v2_state_save(h2c, pos, end, handler); } |
