Update error code

This commit is contained in:
Tatsuhiro Tsujikawa 2013-10-27 19:31:24 +09:00
parent a46ccdb144
commit 5ace898392
4 changed files with 26 additions and 8 deletions

View File

@ -454,14 +454,18 @@ typedef enum {
* FLOW_CONTROL_ERROR
*/
NGHTTP2_FLOW_CONTROL_ERROR = 3,
/**
* SETTINGS_TIMEOUT
*/
NGHTTP2_SETTINGS_TIMEOUT = 4,
/**
* STREAM_CLOSED
*/
NGHTTP2_STREAM_CLOSED = 5,
/**
* FRAME_TOO_LARGE
* FRAME_SIZE_ERROR
*/
NGHTTP2_FRAME_TOO_LARGE = 6,
NGHTTP2_FRAME_SIZE_ERROR = 6,
/**
* REFUSED_STREAM
*/
@ -473,7 +477,15 @@ typedef enum {
/**
* COMPRESSION_ERROR
*/
NGHTTP2_COMPRESSION_ERROR = 9
NGHTTP2_COMPRESSION_ERROR = 9,
/**
* CONNECT_ERROR
*/
NGHTTP2_CONNECT_ERROR = 10,
/**
* ENHANCE_YOUR_CALM
*/
NGHTTP2_ENHANCE_YOUR_CALM = 420
} nghttp2_error_code;
/**

View File

@ -2363,7 +2363,7 @@ int nghttp2_session_on_settings_received(nghttp2_session *session,
if(frame->hd.flags & NGHTTP2_FLAG_ACK) {
if(frame->settings.niv != 0) {
return nghttp2_session_handle_invalid_connection
(session, frame, NGHTTP2_FRAME_TOO_LARGE);
(session, frame, NGHTTP2_FRAME_SIZE_ERROR);
}
if(session->inflight_niv == -1) {
return nghttp2_session_handle_invalid_connection(session, frame,
@ -3210,7 +3210,7 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session,
further HEADERS or PUSH_PROMISE */
session->hd_inflater.bad = 1;
/* Just tear down session for now */
r = nghttp2_session_fail_session(session, NGHTTP2_FRAME_TOO_LARGE);
r = nghttp2_session_fail_session(session, NGHTTP2_FRAME_SIZE_ERROR);
if(r != 0) {
/* FATAL */
assert(r < NGHTTP2_ERR_FATAL);

View File

@ -60,16 +60,22 @@ const char* strstatus(nghttp2_error_code error_code)
return "INTERNAL_ERROR";
case NGHTTP2_FLOW_CONTROL_ERROR:
return "FLOW_CONTROL_ERROR";
case NGHTTP2_SETTINGS_TIMEOUT:
return "SETTINGS_TIMEOUT";
case NGHTTP2_STREAM_CLOSED:
return "STREAM_CLOSED";
case NGHTTP2_FRAME_TOO_LARGE:
return "FRAME_TOO_LARGE";
case NGHTTP2_FRAME_SIZE_ERROR:
return "FRAME_SIZE_ERROR";
case NGHTTP2_REFUSED_STREAM:
return "REFUSED_STREAM";
case NGHTTP2_CANCEL:
return "CANCEL";
case NGHTTP2_COMPRESSION_ERROR:
return "COMPRESSION_ERROR";
case NGHTTP2_CONNECT_ERROR:
return "CONNECT_ERROR";
case NGHTTP2_ENHANCE_YOUR_CALM:
return "ENHANCE_YOUR_CALM";
default:
return "UNKNOWN";
}

View File

@ -358,7 +358,7 @@ void test_nghttp2_session_recv_frame_too_large(void)
item = nghttp2_session_get_next_ob_item(session);
CU_ASSERT(item != NULL);
CU_ASSERT(NGHTTP2_GOAWAY == OB_CTRL_TYPE(item));
CU_ASSERT(NGHTTP2_FRAME_TOO_LARGE == OB_CTRL(item)->goaway.error_code);
CU_ASSERT(NGHTTP2_FRAME_SIZE_ERROR == OB_CTRL(item)->goaway.error_code);
/* Check next frame can be received */
nghttp2_frame_ping_init(&frame.ping, NGHTTP2_FLAG_NONE, NULL);