From e2bbc9461618d953e60c51f6ad3c44a65c178db5 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Mon, 2 Feb 2015 00:14:17 +0900 Subject: [PATCH] Use NGHTTP2_PROTOCOL_ERROR when peer exceeds MAX_CONCURRENT_STREAMS limit Kudos to h2spec to find this details --- lib/nghttp2_session.c | 4 ++-- tests/nghttp2_session_test.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/nghttp2_session.c b/lib/nghttp2_session.c index c4dd105c..767cb6f4 100644 --- a/lib/nghttp2_session.c +++ b/lib/nghttp2_session.c @@ -3256,7 +3256,7 @@ int nghttp2_session_on_request_headers_received(nghttp2_session *session, if (session_is_incoming_concurrent_streams_max(session)) { return session_inflate_handle_invalid_connection( - session, frame, NGHTTP2_ENHANCE_YOUR_CALM, + session, frame, NGHTTP2_PROTOCOL_ERROR, "request HEADERS: max concurrent streams exceeded"); } @@ -3333,7 +3333,7 @@ int nghttp2_session_on_push_response_headers_received(nghttp2_session *session, if (session_is_incoming_concurrent_streams_max(session)) { return session_inflate_handle_invalid_connection( - session, frame, NGHTTP2_ENHANCE_YOUR_CALM, + session, frame, NGHTTP2_PROTOCOL_ERROR, "push response HEADERS: max concurrent streams exceeded"); } if (session_is_incoming_concurrent_streams_pending_max(session)) { diff --git a/tests/nghttp2_session_test.c b/tests/nghttp2_session_test.c index 9b2a7291..a6051697 100644 --- a/tests/nghttp2_session_test.c +++ b/tests/nghttp2_session_test.c @@ -1942,7 +1942,7 @@ void test_nghttp2_session_on_push_response_headers_received(void) { stream)); item = nghttp2_session_get_next_ob_item(session); CU_ASSERT(NGHTTP2_GOAWAY == item->frame.hd.type); - CU_ASSERT(NGHTTP2_ENHANCE_YOUR_CALM == item->frame.goaway.error_code); + CU_ASSERT(NGHTTP2_PROTOCOL_ERROR == item->frame.goaway.error_code); CU_ASSERT(1 == session->num_incoming_streams); nghttp2_frame_headers_free(&frame.headers, mem); @@ -4396,7 +4396,7 @@ void test_nghttp2_session_max_concurrent_streams(void) { item = nghttp2_session_get_ob_pq_top(session); CU_ASSERT(NGHTTP2_GOAWAY == item->frame.hd.type); - CU_ASSERT(NGHTTP2_ENHANCE_YOUR_CALM == item->frame.goaway.error_code); + CU_ASSERT(NGHTTP2_PROTOCOL_ERROR == item->frame.goaway.error_code); nghttp2_frame_headers_free(&frame.headers, mem); nghttp2_session_del(session);