comparison src/http/v2/ngx_http_v2.c @ 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 c6ccc1ea9450
comparison
equal deleted inserted replaced
6375:e30c72b0dfda 6376:0e0e2e522fa2
1731 static u_char * 1731 static u_char *
1732 ngx_http_v2_handle_continuation(ngx_http_v2_connection_t *h2c, u_char *pos, 1732 ngx_http_v2_handle_continuation(ngx_http_v2_connection_t *h2c, u_char *pos,
1733 u_char *end, ngx_http_v2_handler_pt handler) 1733 u_char *end, ngx_http_v2_handler_pt handler)
1734 { 1734 {
1735 u_char *p; 1735 u_char *p;
1736 size_t len; 1736 size_t len, skip;
1737 uint32_t head; 1737 uint32_t head;
1738 1738
1739 len = h2c->state.length; 1739 len = h2c->state.length;
1740
1741 if (h2c->state.padding && (size_t) (end - pos) > len) {
1742 skip = ngx_min(h2c->state.padding, (end - pos) - len);
1743
1744 h2c->state.padding -= skip;
1745
1746 p = pos;
1747 pos += skip;
1748 ngx_memmove(pos, p, len);
1749 }
1740 1750
1741 if ((size_t) (end - pos) < len + NGX_HTTP_V2_FRAME_HEADER_SIZE) { 1751 if ((size_t) (end - pos) < len + NGX_HTTP_V2_FRAME_HEADER_SIZE) {
1742 return ngx_http_v2_state_save(h2c, pos, end, handler); 1752 return ngx_http_v2_state_save(h2c, pos, end, handler);
1743 } 1753 }
1744 1754