Mercurial > hg > nginx
comparison src/http/v2/ngx_http_v2.c @ 7623:72b792bb3885
HTTP/2: fixed socket leak with an incomplete HEADERS frame.
A connection could get stuck without timers if a client has partially sent
the HEADERS frame such that it was split on the individual header boundary.
In this case, it cannot be processed without the rest of the HEADERS frame.
The fix is to call ngx_http_v2_state_headers_save() in this case. Normally,
it would be called from the ngx_http_v2_state_header_block() handler on the
next iteration, when there is not enough data to continue processing. This
isn't the case if recv_buffer became empty and there's no more data to read.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Wed, 05 Feb 2020 16:29:23 +0300 |
parents | 8a7b59347401 |
children | 7114d21bc2b1 |
comparison
equal
deleted
inserted
replaced
7622:2955192fb210 | 7623:72b792bb3885 |
---|---|
1717 u_char *end) | 1717 u_char *end) |
1718 { | 1718 { |
1719 ngx_http_v2_stream_t *stream; | 1719 ngx_http_v2_stream_t *stream; |
1720 | 1720 |
1721 if (h2c->state.length) { | 1721 if (h2c->state.length) { |
1722 h2c->state.handler = ngx_http_v2_state_header_block; | 1722 if (end - pos > 0) { |
1723 return pos; | 1723 h2c->state.handler = ngx_http_v2_state_header_block; |
1724 return pos; | |
1725 } | |
1726 | |
1727 return ngx_http_v2_state_headers_save(h2c, pos, end, | |
1728 ngx_http_v2_state_header_block); | |
1724 } | 1729 } |
1725 | 1730 |
1726 if (!(h2c->state.flags & NGX_HTTP_V2_END_HEADERS_FLAG)) { | 1731 if (!(h2c->state.flags & NGX_HTTP_V2_END_HEADERS_FLAG)) { |
1727 return ngx_http_v2_handle_continuation(h2c, pos, end, | 1732 return ngx_http_v2_handle_continuation(h2c, pos, end, |
1728 ngx_http_v2_state_header_complete); | 1733 ngx_http_v2_state_header_complete); |