From f2313eb41e36163e3736f1b1b23e477da5392601 Mon Sep 17 00:00:00 2001 From: Masakazu Kitajo Date: Thu, 27 Jun 2019 12:09:52 +0900 Subject: [PATCH] Log H2 errors with the codes --- proxy/http2/HTTP2.h | 2 +- proxy/http2/Http2ConnectionState.cc | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/proxy/http2/HTTP2.h b/proxy/http2/HTTP2.h index d6a82468b21..63fe9aa3ed6 100644 --- a/proxy/http2/HTTP2.h +++ b/proxy/http2/HTTP2.h @@ -239,7 +239,7 @@ struct Http2FrameHeader { // [RFC 7540] 5.4. Error Handling struct Http2Error { Http2Error(const Http2ErrorClass error_class = Http2ErrorClass::HTTP2_ERROR_CLASS_NONE, - const Http2ErrorCode error_code = Http2ErrorCode::HTTP2_ERROR_NO_ERROR, const char *err_msg = nullptr) + const Http2ErrorCode error_code = Http2ErrorCode::HTTP2_ERROR_NO_ERROR, const char *err_msg = "") { cls = error_class; code = error_code; diff --git a/proxy/http2/Http2ConnectionState.cc b/proxy/http2/Http2ConnectionState.cc index c2e98024f28..9d73d8c551b 100644 --- a/proxy/http2/Http2ConnectionState.cc +++ b/proxy/http2/Http2ConnectionState.cc @@ -970,8 +970,8 @@ Http2ConnectionState::main_event_handler(int event, void *edata) const char *client_ip = ats_ip_ntop(ua_session->get_client_addr(), ipb, sizeof(ipb)); if (error.cls == Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION) { if (error.msg) { - Error("HTTP/2 connection error client_ip=%s session_id=%" PRId64 " stream_id=%u %s", client_ip, - ua_session->connection_id(), stream_id, error.msg); + Error("HTTP/2 connection error code=0x%02x client_ip=%s session_id=%" PRId64 " stream_id=%u %s", + static_cast(error.code), client_ip, ua_session->connection_id(), stream_id, error.msg); } this->send_goaway_frame(this->latest_streamid_in, error.code); this->ua_session->set_half_close_local_flag(true); @@ -983,8 +983,8 @@ Http2ConnectionState::main_event_handler(int event, void *edata) // The Http2ClientSession will shutdown because connection_state.is_state_closed() will be true } else if (error.cls == Http2ErrorClass::HTTP2_ERROR_CLASS_STREAM) { if (error.msg) { - Error("HTTP/2 stream error client_ip=%s session_id=%" PRId64 " stream_id=%u %s", client_ip, ua_session->connection_id(), - stream_id, error.msg); + Error("HTTP/2 stream error code=0x%02x client_ip=%s session_id=%" PRId64 " stream_id=%u %s", static_cast(error.code), + client_ip, ua_session->connection_id(), stream_id, error.msg); } this->send_rst_stream_frame(stream_id, error.code); }