From 545f24bc1b18362e0895172812de27cff1be0c59 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sun, 26 Jan 2014 23:16:13 +0900 Subject: [PATCH] Remove nghttp2_on_frame_recv_parse_error_callback --- lib/includes/nghttp2/nghttp2.h | 38 +--------------------------------- src/HttpServer.cc | 2 -- src/app_helper.cc | 21 ------------------- src/app_helper.h | 9 -------- src/nghttp.cc | 2 -- src/shrpx_http2_session.cc | 22 -------------------- src/shrpx_http2_upstream.cc | 21 ------------------- 7 files changed, 1 insertion(+), 114 deletions(-) diff --git a/lib/includes/nghttp2/nghttp2.h b/lib/includes/nghttp2/nghttp2.h index 038e2b3b..43cbf96d 100644 --- a/lib/includes/nghttp2/nghttp2.h +++ b/lib/includes/nghttp2/nghttp2.h @@ -1072,33 +1072,6 @@ typedef int (*nghttp2_on_stream_close_callback) typedef int (*nghttp2_on_request_recv_callback) (nghttp2_session *session, int32_t stream_id, void *user_data); -/** - * @functypedef - * - * Callback function invoked when the received control frame octets - * could not be parsed correctly. The |type| indicates the type of - * received non-DATA frame. The |head| is the pointer to the header of - * the received frame. The |headlen| is the length of the - * |head|. According to the spec, the |headlen| is always 8. In other - * words, the |head| is the first 8 bytes of the received frame. The - * |payload| is the pointer to the data portion of the received frame. - * The |payloadlen| is the length of the |payload|. This is the data - * after the length field. The |lib_error_code| is one of the error - * code defined in :enum:`nghttp2_error` and indicates the error. The - * |user_data| pointer is the third argument passed in to the call to - * `nghttp2_session_client_new()` or `nghttp2_session_server_new()`. - * - * The implementation of this function must return 0 if it - * succeeds. If nonzero is returned, it is treated as fatal error and - * `nghttp2_session_recv()` and `nghttp2_session_send()` functions - * immediately return :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`. - */ -typedef int (*nghttp2_on_frame_recv_parse_error_callback) -(nghttp2_session *session, nghttp2_frame_type type, - const uint8_t *head, size_t headlen, - const uint8_t *payload, size_t payloadlen, - int lib_error_code, void *user_data); - /** * @functypedef * @@ -1247,12 +1220,6 @@ typedef struct { * received. */ nghttp2_on_request_recv_callback on_request_recv_callback; - /** - * Callback function invoked when the received non-DATA frame octets - * could not be parsed correctly. - */ - nghttp2_on_frame_recv_parse_error_callback - on_frame_recv_parse_error_callback; /** * Callback function invoked when the received frame type is * unknown. @@ -1536,10 +1503,7 @@ int nghttp2_session_send(nghttp2_session *session); * invalid, * :member:`nghttp2_session_callbacks.on_invalid_frame_recv_callback` * is invoked. - * 4. If the received frame could not be unpacked correctly, - * :member:`nghttp2_session_callbacks.on_frame_recv_parse_error_callback` - * is invoked. - * 5. If the received frame type is unknown, + * 4. If the received frame type is unknown, * :member:`nghttp2_session_callbacks.on_unknown_frame_recv_callback` * is invoked. * diff --git a/src/HttpServer.cc b/src/HttpServer.cc index f5683096..b1001163 100644 --- a/src/HttpServer.cc +++ b/src/HttpServer.cc @@ -1002,8 +1002,6 @@ void fill_callback(nghttp2_session_callbacks& callbacks, const Config *config) if(config->verbose) { callbacks.on_invalid_frame_recv_callback = verbose_on_invalid_frame_recv_callback; - callbacks.on_frame_recv_parse_error_callback = - verbose_on_frame_recv_parse_error_callback; callbacks.on_unknown_frame_recv_callback = verbose_on_unknown_frame_recv_callback; } diff --git a/src/app_helper.cc b/src/app_helper.cc index 254e52ae..4c14502e 100644 --- a/src/app_helper.cc +++ b/src/app_helper.cc @@ -387,27 +387,6 @@ void dump_header(const uint8_t *head, size_t headlen) } } // namespace -int verbose_on_frame_recv_parse_error_callback(nghttp2_session *session, - nghttp2_frame_type type, - const uint8_t *head, - size_t headlen, - const uint8_t *payload, - size_t payloadlen, - int error_code, - void *user_data) -{ - print_timer(); - printf(" [PARSE_ERROR] recv %s%s%s frame\n", - frame_name_ansi_esc(PRINT_RECV), - strframetype(type), - ansi_escend()); - print_frame_attr_indent(); - printf("Error: %s\n", nghttp2_strerror(error_code)); - dump_header(head, headlen); - fflush(stdout); - return 0; -} - int verbose_on_unknown_frame_recv_callback(nghttp2_session *session, const uint8_t *head, size_t headlen, diff --git a/src/app_helper.h b/src/app_helper.h index 6ecee4f5..60034750 100644 --- a/src/app_helper.h +++ b/src/app_helper.h @@ -52,15 +52,6 @@ int verbose_on_invalid_frame_recv_callback (nghttp2_session *session, const nghttp2_frame *frame, nghttp2_error_code error_code, void *user_data); -int verbose_on_frame_recv_parse_error_callback(nghttp2_session *session, - nghttp2_frame_type type, - const uint8_t *head, - size_t headlen, - const uint8_t *payload, - size_t payloadlen, - int error_code, - void *user_data); - int verbose_on_unknown_frame_recv_callback(nghttp2_session *session, const uint8_t *head, size_t headlen, diff --git a/src/nghttp.cc b/src/nghttp.cc index 18fc2796..8b37ab02 100644 --- a/src/nghttp.cc +++ b/src/nghttp.cc @@ -1589,8 +1589,6 @@ int run(char **uris, int n) callbacks.on_data_send_callback = verbose_on_data_send_callback; callbacks.on_invalid_frame_recv_callback = verbose_on_invalid_frame_recv_callback; - callbacks.on_frame_recv_parse_error_callback = - verbose_on_frame_recv_parse_error_callback; callbacks.on_unknown_frame_recv_callback = verbose_on_unknown_frame_recv_callback; } diff --git a/src/shrpx_http2_session.cc b/src/shrpx_http2_session.cc index deea214e..f8f3a7ca 100644 --- a/src/shrpx_http2_session.cc +++ b/src/shrpx_http2_session.cc @@ -1130,26 +1130,6 @@ int on_frame_not_send_callback(nghttp2_session *session, } } // namespace -namespace { -int on_frame_recv_parse_error_callback(nghttp2_session *session, - nghttp2_frame_type type, - const uint8_t *head, size_t headlen, - const uint8_t *payload, - size_t payloadlen, int lib_error_code, - void *user_data) -{ - auto http2session = static_cast(user_data); - if(LOG_ENABLED(INFO)) { - SSLOG(INFO, http2session) - << "Failed to parse received control frame. type=" - << type - << ", lib_error_code=" << lib_error_code << ":" - << nghttp2_strerror(lib_error_code); - } - return 0; -} -} // namespace - namespace { int on_unknown_frame_recv_callback(nghttp2_session *session, const uint8_t *head, size_t headlen, @@ -1203,8 +1183,6 @@ int Http2Session::on_connect() callbacks.before_frame_send_callback = before_frame_send_callback; callbacks.on_frame_send_callback = on_frame_send_callback; callbacks.on_frame_not_send_callback = on_frame_not_send_callback; - callbacks.on_frame_recv_parse_error_callback = - on_frame_recv_parse_error_callback; callbacks.on_unknown_frame_recv_callback = on_unknown_frame_recv_callback; callbacks.on_header_callback = on_header_callback; callbacks.on_end_headers_callback = on_end_headers_callback; diff --git a/src/shrpx_http2_upstream.cc b/src/shrpx_http2_upstream.cc index fd464ba8..717ec62c 100644 --- a/src/shrpx_http2_upstream.cc +++ b/src/shrpx_http2_upstream.cc @@ -456,25 +456,6 @@ int on_frame_not_send_callback(nghttp2_session *session, } } // namespace -namespace { -int on_frame_recv_parse_error_callback(nghttp2_session *session, - nghttp2_frame_type type, - const uint8_t *head, size_t headlen, - const uint8_t *payload, - size_t payloadlen, int lib_error_code, - void *user_data) -{ - auto upstream = static_cast(user_data); - if(LOG_ENABLED(INFO)) { - ULOG(INFO, upstream) << "Failed to parse received control frame. type=" - << type - << ", error_code=" << lib_error_code << ":" - << nghttp2_strerror(lib_error_code); - } - return 0; -} -} // namespace - namespace { int on_unknown_frame_recv_callback(nghttp2_session *session, const uint8_t *head, size_t headlen, @@ -520,8 +501,6 @@ Http2Upstream::Http2Upstream(ClientHandler *handler) callbacks.on_data_recv_callback = on_data_recv_callback; callbacks.on_frame_send_callback = on_frame_send_callback; callbacks.on_frame_not_send_callback = on_frame_not_send_callback; - callbacks.on_frame_recv_parse_error_callback = - on_frame_recv_parse_error_callback; callbacks.on_unknown_frame_recv_callback = on_unknown_frame_recv_callback; callbacks.on_header_callback = on_header_callback; callbacks.on_end_headers_callback = on_end_headers_callback;