changeset 6376:0e0e2e522fa2

HTTP/2: fixed padding handling in HEADERS frame with CONTINUATION.
author Valentin Bartenev <vbart@nginx.com>
date Tue, 02 Feb 2016 16:33:55 +0300
parents e30c72b0dfda
children 11e019750adc
files src/http/v2/ngx_http_v2.c
diffstat 1 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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
     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);
     }