Commit e960c56a authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

Don't call on_request_recv_callback if header decompression failed

parent 3882bbeb
...@@ -1891,6 +1891,8 @@ static int nghttp2_session_validate_request_headers(nghttp2_session *session, ...@@ -1891,6 +1891,8 @@ static int nghttp2_session_validate_request_headers(nghttp2_session *session,
* Out of memory. * Out of memory.
* NGHTTP2_ERR_PAUSE * NGHTTP2_ERR_PAUSE
* The callback function returned NGHTTP2_ERR_PAUSE * The callback function returned NGHTTP2_ERR_PAUSE
* NGHTTP2_ERR_HEADER_COMP
* Header decompression failed
*/ */
static int inflate_header_block(nghttp2_session *session, nghttp2_frame *frame, static int inflate_header_block(nghttp2_session *session, nghttp2_frame *frame,
int call_header_cb) int call_header_cb)
...@@ -1915,8 +1917,12 @@ static int inflate_header_block(nghttp2_session *session, nghttp2_frame *frame, ...@@ -1915,8 +1917,12 @@ static int inflate_header_block(nghttp2_session *session, nghttp2_frame *frame,
return rv; return rv;
} }
} }
return nghttp2_session_terminate_session(session, rv = nghttp2_session_terminate_session(session,
NGHTTP2_COMPRESSION_ERROR); NGHTTP2_COMPRESSION_ERROR);
if(rv != 0) {
return rv;
}
return NGHTTP2_ERR_HEADER_COMP;
} }
session->iframe.inflate_offset += rv; session->iframe.inflate_offset += rv;
if(final) { if(final) {
...@@ -2010,7 +2016,7 @@ static int nghttp2_session_inflate_handle_invalid_stream ...@@ -2010,7 +2016,7 @@ static int nghttp2_session_inflate_handle_invalid_stream
{ {
int rv; int rv;
rv = session_skip_inflate_header_block(session, frame); rv = session_skip_inflate_header_block(session, frame);
if(rv != 0) { if(nghttp2_is_fatal(rv)) {
return rv; return rv;
} }
return nghttp2_session_handle_invalid_stream(session, frame, error_code); return nghttp2_session_handle_invalid_stream(session, frame, error_code);
...@@ -2040,7 +2046,7 @@ static int nghttp2_session_inflate_handle_invalid_connection ...@@ -2040,7 +2046,7 @@ static int nghttp2_session_inflate_handle_invalid_connection
{ {
int rv; int rv;
rv = session_skip_inflate_header_block(session, frame); rv = session_skip_inflate_header_block(session, frame);
if(rv != 0) { if(nghttp2_is_fatal(rv)) {
return rv; return rv;
} }
return nghttp2_session_handle_invalid_connection(session, frame, error_code); return nghttp2_session_handle_invalid_connection(session, frame, error_code);
...@@ -2060,6 +2066,8 @@ static int nghttp2_session_inflate_handle_invalid_connection ...@@ -2060,6 +2066,8 @@ static int nghttp2_session_inflate_handle_invalid_connection
* Out of memory. * Out of memory.
* NGHTTP2_ERR_PAUSE * NGHTTP2_ERR_PAUSE
* The callback function returned NGHTTP2_ERR_PAUSE * The callback function returned NGHTTP2_ERR_PAUSE
* NGHTTP2_ERR_HEADER_COMP
* Header decompression failed
*/ */
static int session_end_request_headers_received(nghttp2_session *session, static int session_end_request_headers_received(nghttp2_session *session,
nghttp2_frame *frame) nghttp2_frame *frame)
...@@ -2096,6 +2104,8 @@ static int session_end_request_headers_received(nghttp2_session *session, ...@@ -2096,6 +2104,8 @@ static int session_end_request_headers_received(nghttp2_session *session,
* Out of memory. * Out of memory.
* NGHTTP2_ERR_PAUSE * NGHTTP2_ERR_PAUSE
* The callback function returned NGHTTP2_ERR_PAUSE * The callback function returned NGHTTP2_ERR_PAUSE
* NGHTTP2_ERR_HEADER_COMP
* Header decompression failed
*/ */
static int session_end_response_headers_received(nghttp2_session *session, static int session_end_response_headers_received(nghttp2_session *session,
nghttp2_frame *frame) nghttp2_frame *frame)
...@@ -2133,6 +2143,8 @@ static int session_end_response_headers_received(nghttp2_session *session, ...@@ -2133,6 +2143,8 @@ static int session_end_response_headers_received(nghttp2_session *session,
* Out of memory. * Out of memory.
* NGHTTP2_ERR_PAUSE * NGHTTP2_ERR_PAUSE
* The callback function returned NGHTTP2_ERR_PAUSE * The callback function returned NGHTTP2_ERR_PAUSE
* NGHTTP2_ERR_HEADER_COMP
* Header decompression failed
*/ */
static int session_end_headers_received(nghttp2_session *session, static int session_end_headers_received(nghttp2_session *session,
nghttp2_frame *frame) nghttp2_frame *frame)
...@@ -3475,7 +3487,10 @@ static int session_continue(nghttp2_session *session) ...@@ -3475,7 +3487,10 @@ static int session_continue(nghttp2_session *session)
default: default:
break; break;
} }
return rv; if(rv == NGHTTP2_ERR_PAUSE || nghttp2_is_fatal(rv)) {
return rv;
}
return 0;
} }
ssize_t nghttp2_session_mem_recv(nghttp2_session *session, ssize_t nghttp2_session_mem_recv(nghttp2_session *session,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment