Repository: trafficserver Updated Branches: refs/heads/master 0aabfb0bf -> 50703613f
TS-4172: Cleanup debug logs of Http2ConnectionState Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/81cd48f0 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/81cd48f0 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/81cd48f0 Branch: refs/heads/master Commit: 81cd48f072b800e13acc2db821e14f7f6a3ac90c Parents: 0aabfb0 Author: Masaori Koshiba <[email protected]> Authored: Thu Feb 4 16:24:53 2016 +0900 Committer: Masaori Koshiba <[email protected]> Committed: Wed Feb 17 10:46:12 2016 +0900 ---------------------------------------------------------------------- proxy/http2/Http2ConnectionState.cc | 114 +++++++++++++++++-------------- proxy/http2/Http2DebugNames.cc | 47 +++++++++++++ proxy/http2/Http2DebugNames.h | 35 ++++++++++ proxy/http2/Makefile.am | 2 + 4 files changed, 146 insertions(+), 52 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/81cd48f0/proxy/http2/Http2ConnectionState.cc ---------------------------------------------------------------------- diff --git a/proxy/http2/Http2ConnectionState.cc b/proxy/http2/Http2ConnectionState.cc index 75744dc..4a5c0a4 100644 --- a/proxy/http2/Http2ConnectionState.cc +++ b/proxy/http2/Http2ConnectionState.cc @@ -25,8 +25,13 @@ #include "Http2ConnectionState.h" #include "Http2ClientSession.h" #include "Http2Stream.h" +#include "Http2DebugNames.h" -#define DebugHttp2Ssn(fmt, ...) DebugSsn("http2_cs", "[%" PRId64 "] " fmt, this->con_id, __VA_ARGS__) +#define DebugHttp2Con(ua_session, fmt, ...) \ + DebugSsn(ua_session, "http2_con", "[%" PRId64 "] " fmt, ua_session->connection_id(), ##__VA_ARGS__); + +#define DebugHttp2Stream(ua_session, stream_id, fmt, ...) \ + DebugSsn(ua_session, "http2_con", "[%" PRId64 "] [%u] " fmt, ua_session->connection_id(), stream_id, ##__VA_ARGS__); typedef Http2Error (*http2_frame_dispatch)(Http2ClientSession &, Http2ConnectionState &, const Http2Frame &); @@ -59,7 +64,7 @@ read_rcv_buffer(char *buf, size_t bufsize, unsigned &nbytes, const Http2Frame &f } static Http2Error -rcv_data_frame(Http2ClientSession &cs, Http2ConnectionState &cstate, const Http2Frame &frame) +rcv_data_frame(Http2ClientSession & /* cs */, Http2ConnectionState &cstate, const Http2Frame &frame) { char buf[BUFFER_SIZE_FOR_INDEX(buffer_size_index[HTTP2_FRAME_TYPE_DATA])]; unsigned nbytes = 0; @@ -67,7 +72,7 @@ rcv_data_frame(Http2ClientSession &cs, Http2ConnectionState &cstate, const Http2 uint8_t pad_length = 0; const uint32_t payload_length = frame.header().length; - DebugSsn(&cs, "http2_cs", "[%" PRId64 "] Received DATA frame.", cs.connection_id()); + DebugHttp2Stream(cstate.ua_session, id, "Received DATA frame"); // If a DATA frame is received whose stream identifier field is 0x0, the // recipient MUST @@ -173,12 +178,12 @@ rcv_data_frame(Http2ClientSession &cs, Http2ConnectionState &cstate, const Http2 * CONTINUATION frame */ static Http2Error -rcv_headers_frame(Http2ClientSession &cs, Http2ConnectionState &cstate, const Http2Frame &frame) +rcv_headers_frame(Http2ClientSession & /* cs */, Http2ConnectionState &cstate, const Http2Frame &frame) { const Http2StreamId stream_id = frame.header().streamid; const uint32_t payload_length = frame.header().length; - DebugSsn(&cs, "http2_cs", "[%" PRId64 "] Received HEADERS frame.", cs.connection_id()); + DebugHttp2Stream(cstate.ua_session, stream_id, "Received HEADERS frame"); if (!http2_is_client_streamid(stream_id)) { return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_PROTOCOL_ERROR); @@ -288,8 +293,7 @@ rcv_headers_frame(Http2ClientSession &cs, Http2ConnectionState &cstate, const Ht } else { // NOTE: Expect CONTINUATION Frame. Do NOT change state of stream or decode // Header Blocks. - DebugSsn(&cs, "http2_cs", "[%" PRId64 "] No END_HEADERS flag, expecting CONTINUATION frame.", cs.connection_id()); - + DebugHttp2Stream(cstate.ua_session, stream_id, "No END_HEADERS flag, expecting CONTINUATION frame"); cstate.set_continued_stream_id(stream_id); } @@ -297,9 +301,9 @@ rcv_headers_frame(Http2ClientSession &cs, Http2ConnectionState &cstate, const Ht } static Http2Error -rcv_priority_frame(Http2ClientSession &cs, Http2ConnectionState & /*cstate*/, const Http2Frame &frame) +rcv_priority_frame(Http2ClientSession & /* cs */, Http2ConnectionState &cstate, const Http2Frame &frame) { - DebugSsn(&cs, "http2_cs", "[%" PRId64 "] received PRIORITY frame", cs.connection_id()); + DebugHttp2Stream(cstate.ua_session, frame.header().streamid, "Received PRIORITY frame"); // If a PRIORITY frame is received with a stream identifier of 0x0, the // recipient MUST respond with a connection error of type PROTOCOL_ERROR. @@ -320,20 +324,19 @@ rcv_priority_frame(Http2ClientSession &cs, Http2ConnectionState & /*cstate*/, co } static Http2Error -rcv_rst_stream_frame(Http2ClientSession &cs, Http2ConnectionState &cstate, const Http2Frame &frame) +rcv_rst_stream_frame(Http2ClientSession & /* cs */, Http2ConnectionState &cstate, const Http2Frame &frame) { Http2RstStream rst_stream; char buf[HTTP2_RST_STREAM_LEN]; char *end; + const Http2StreamId stream_id = frame.header().streamid; - DebugSsn(&cs, "http2_cs", "[%" PRId64 "] Received RST_STREAM frame.", cs.connection_id()); + DebugHttp2Stream(cstate.ua_session, frame.header().streamid, "Received RST_STREAM frame"); // RST_STREAM frames MUST be associated with a stream. If a RST_STREAM // frame is received with a stream identifier of 0x0, the recipient MUST // treat this as a connection error (Section 5.4.1) of type // PROTOCOL_ERROR. - Http2StreamId stream_id = frame.header().streamid; - if (!http2_is_client_streamid(stream_id)) { return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_PROTOCOL_ERROR); } @@ -366,8 +369,8 @@ rcv_rst_stream_frame(Http2ClientSession &cs, Http2ConnectionState &cstate, const } if (stream != NULL) { - DebugSsn(&cs, "http2_cs", "[%" PRId64 "] RST_STREAM: Stream ID: %u, Error Code: %u)", cs.connection_id(), stream->get_id(), - rst_stream.error_code); + DebugHttp2Stream(cstate.ua_session, stream_id, "RST_STREAM: Error Code: %u", rst_stream.error_code); + cstate.delete_stream(stream); } @@ -375,19 +378,20 @@ rcv_rst_stream_frame(Http2ClientSession &cs, Http2ConnectionState &cstate, const } static Http2Error -rcv_settings_frame(Http2ClientSession &cs, Http2ConnectionState &cstate, const Http2Frame &frame) +rcv_settings_frame(Http2ClientSession & /* cs */, Http2ConnectionState &cstate, const Http2Frame &frame) { Http2SettingsParameter param; char buf[HTTP2_SETTINGS_PARAMETER_LEN]; unsigned nbytes = 0; + const Http2StreamId stream_id = frame.header().streamid; - DebugSsn(&cs, "http2_cs", "[%" PRId64 "] Received SETTINGS frame.", cs.connection_id()); + DebugHttp2Stream(cstate.ua_session, stream_id, "Received SETTINGS frame"); // [RFC 7540] 6.5. The stream identifier for a SETTINGS frame MUST be zero. // If an endpoint receives a SETTINGS frame whose stream identifier field is // anything other than 0x0, the endpoint MUST respond with a connection // error (Section 5.4.1) of type PROTOCOL_ERROR. - if (frame.header().streamid != 0) { + if (stream_id != 0) { return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_PROTOCOL_ERROR); } @@ -424,7 +428,7 @@ rcv_settings_frame(Http2ClientSession &cs, Http2ConnectionState &cstate, const H } } - DebugSsn(&cs, "http2_cs", "[%" PRId64 "] setting param=%d value=%u", cs.connection_id(), param.id, param.value); + DebugHttp2Stream(cstate.ua_session, stream_id, " %s : %u", Http2DebugNames::get_settings_param_name(param.id), param.value); // [RFC 7540] 6.9.2. When the value of SETTINGS_INITIAL_WINDOW_SIZE // changes, a receiver MUST adjust the size of all stream flow control @@ -446,9 +450,9 @@ rcv_settings_frame(Http2ClientSession &cs, Http2ConnectionState &cstate, const H } static Http2Error -rcv_push_promise_frame(Http2ClientSession &cs, Http2ConnectionState & /*cstate*/, const Http2Frame & /*frame*/) +rcv_push_promise_frame(Http2ClientSession & /* cs */, Http2ConnectionState &cstate, const Http2Frame &frame) { - DebugSsn(&cs, "http2_cs", "[%" PRId64 "] received PUSH_PROMISE frame", cs.connection_id()); + DebugHttp2Stream(cstate.ua_session, frame.header().streamid, "Received PUSH_PROMISE frame"); // [RFC 7540] 8.2. A client cannot push. Thus, servers MUST treat the receipt of a // PUSH_PROMISE frame as a connection error of type PROTOCOL_ERROR. @@ -456,16 +460,17 @@ rcv_push_promise_frame(Http2ClientSession &cs, Http2ConnectionState & /*cstate*/ } static Http2Error -rcv_ping_frame(Http2ClientSession &cs, Http2ConnectionState &cstate, const Http2Frame &frame) +rcv_ping_frame(Http2ClientSession & /* cs */, Http2ConnectionState &cstate, const Http2Frame &frame) { uint8_t opaque_data[HTTP2_PING_LEN]; + const Http2StreamId stream_id = frame.header().streamid; - DebugSsn(&cs, "http2_cs", "[%" PRId64 "] Received PING frame.", cs.connection_id()); + DebugHttp2Stream(cstate.ua_session, stream_id, "Received PING frame"); // If a PING frame is received with a stream identifier field value other // than 0x0, the recipient MUST respond with a connection error of type // PROTOCOL_ERROR. - if (frame.header().streamid != 0x0) { + if (stream_id != 0x0) { return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_PROTOCOL_ERROR); } @@ -483,23 +488,24 @@ rcv_ping_frame(Http2ClientSession &cs, Http2ConnectionState &cstate, const Http2 frame.reader()->memcpy(opaque_data, HTTP2_PING_LEN, 0); // ACK (0x1): An endpoint MUST set this flag in PING responses. - cstate.send_ping_frame(frame.header().streamid, HTTP2_FLAGS_PING_ACK, opaque_data); + cstate.send_ping_frame(stream_id, HTTP2_FLAGS_PING_ACK, opaque_data); return Http2Error(HTTP2_ERROR_CLASS_NONE); } static Http2Error -rcv_goaway_frame(Http2ClientSession &cs, Http2ConnectionState &cstate, const Http2Frame &frame) +rcv_goaway_frame(Http2ClientSession & /* cs */, Http2ConnectionState &cstate, const Http2Frame &frame) { Http2Goaway goaway; char buf[HTTP2_GOAWAY_LEN]; unsigned nbytes = 0; + const Http2StreamId stream_id = frame.header().streamid; - DebugSsn(&cs, "http2_cs", "[%" PRId64 "] received GOAWAY frame", cs.connection_id()); + DebugHttp2Stream(cstate.ua_session, stream_id, "Received GOAWAY frame"); // An endpoint MUST treat a GOAWAY frame with a stream identifier other // than 0x0 as a connection error of type PROTOCOL_ERROR. - if (frame.header().streamid != 0x0) { + if (stream_id != 0x0) { return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_PROTOCOL_ERROR); } @@ -511,8 +517,8 @@ rcv_goaway_frame(Http2ClientSession &cs, Http2ConnectionState &cstate, const Htt } } - DebugSsn(&cs, "http2_cs", "[%" PRId64 "] GOAWAY: last stream id=%d, error code=%d.", cs.connection_id(), goaway.last_streamid, - goaway.error_code); + DebugHttp2Stream(cstate.ua_session, stream_id, "GOAWAY: last stream id=%d, error code=%d", goaway.last_streamid, + goaway.error_code); cstate.handleEvent(HTTP2_SESSION_EVENT_FINI, NULL); // eventProcessor.schedule_imm(&cs, ET_NET, VC_EVENT_ERROR); @@ -521,13 +527,13 @@ rcv_goaway_frame(Http2ClientSession &cs, Http2ConnectionState &cstate, const Htt } static Http2Error -rcv_window_update_frame(Http2ClientSession &cs, Http2ConnectionState &cstate, const Http2Frame &frame) +rcv_window_update_frame(Http2ClientSession & /* cs */, Http2ConnectionState &cstate, const Http2Frame &frame) { char buf[HTTP2_WINDOW_UPDATE_LEN]; uint32_t size; - Http2StreamId sid = frame.header().streamid; + const Http2StreamId sid = frame.header().streamid; - DebugSsn(&cs, "http2_cs", "[%" PRId64 "] Received WINDOW_UPDATE frame.", cs.connection_id()); + DebugHttp2Stream(cstate.ua_session, sid, "Received WINDOW_UPDATE frame"); // A WINDOW_UPDATE frame with a length other than 4 octets MUST be // treated as a connection error of type FRAME_SIZE_ERROR. @@ -612,12 +618,12 @@ rcv_window_update_frame(Http2ClientSession &cs, Http2ConnectionState &cstate, co * */ static Http2Error -rcv_continuation_frame(Http2ClientSession &cs, Http2ConnectionState &cstate, const Http2Frame &frame) +rcv_continuation_frame(Http2ClientSession & /* cs */, Http2ConnectionState &cstate, const Http2Frame &frame) { const Http2StreamId stream_id = frame.header().streamid; const uint32_t payload_length = frame.header().length; - DebugSsn(&cs, "http2_cs", "[%" PRId64 "] Received CONTINUATION frame.", cs.connection_id()); + DebugHttp2Stream(cstate.ua_session, stream_id, "Received CONTINUATION frame"); if (!http2_is_client_streamid(stream_id)) { return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_PROTOCOL_ERROR); @@ -678,7 +684,7 @@ rcv_continuation_frame(Http2ClientSession &cs, Http2ConnectionState &cstate, con stream->init_fetcher(cstate); } else { // NOTE: Expect another CONTINUATION Frame. Do nothing. - DebugSsn(&cs, "http2_cs", "[%" PRId64 "] No END_HEADERS flag, expecting CONTINUATION frame.", cs.connection_id()); + DebugHttp2Stream(cstate.ua_session, stream_id, "No END_HEADERS flag, expecting CONTINUATION frame"); } return Http2Error(HTTP2_ERROR_CLASS_NONE); @@ -735,15 +741,14 @@ Http2ConnectionState::main_event_handler(int event, void *edata) // Parse received HTTP/2 frames case HTTP2_SESSION_EVENT_RECV: { - Http2Frame *frame = (Http2Frame *)edata; - Http2StreamId last_streamid = frame->header().streamid; + const Http2Frame *frame = (Http2Frame *)edata; + const Http2StreamId stream_id = frame->header().streamid; Http2Error error; // [RFC 7540] 5.5. Extending HTTP/2 // Implementations MUST discard frames that have unknown or unsupported types. if (frame->header().type >= HTTP2_FRAME_TYPE_MAX) { - DebugSsn(this->ua_session, "http2_cs", "[%" PRId64 "] Discard a frame which has unknown type, type=%x", - this->ua_session->connection_id(), frame->header().type); + DebugHttp2Stream(ua_session, stream_id, "Discard a frame which has unknown type, type=%x", frame->header().type); return 0; } @@ -755,7 +760,7 @@ Http2ConnectionState::main_event_handler(int event, void *edata) if (error.cls != HTTP2_ERROR_CLASS_NONE) { if (error.cls == HTTP2_ERROR_CLASS_CONNECTION) { - this->send_goaway_frame(last_streamid, error.code); + this->send_goaway_frame(stream_id, error.code); cleanup_streams(); // XXX We need to think a bit harder about how to coordinate the client // session and the @@ -766,7 +771,7 @@ Http2ConnectionState::main_event_handler(int event, void *edata) // half-closed state ... SET_HANDLER(&Http2ConnectionState::state_closed); } else if (error.cls == HTTP2_ERROR_CLASS_STREAM) { - this->send_rst_stream_frame(last_streamid, error.code); + this->send_rst_stream_frame(stream_id, error.code); } } @@ -797,7 +802,7 @@ Http2ConnectionState::main_event_handler(int event, void *edata) } default: - DebugSsn(this->ua_session, "http2_cs", "unexpected event=%d edata=%p", event, edata); + DebugHttp2Con(ua_session, "unexpected event=%d edata=%p", event, edata); ink_release_assert(0); return 0; } @@ -906,8 +911,6 @@ Http2ConnectionState::update_initial_rwnd(Http2WindowSize new_size) void Http2ConnectionState::send_data_frame(FetchSM *fetch_sm) { - DebugSsn(this->ua_session, "http2_cs", "[%" PRId64 "] Send DATA frame", this->ua_session->connection_id()); - if (fetch_sm == NULL) { return; } @@ -916,6 +919,7 @@ Http2ConnectionState::send_data_frame(FetchSM *fetch_sm) uint8_t payload_buffer[buf_len]; Http2Stream *stream = static_cast<Http2Stream *>(fetch_sm->ext_get_user_data()); + DebugHttp2Stream(ua_session, stream->get_id(), "Send DATA frame"); if (stream->get_state() == HTTP2_STREAM_STATE_CLOSED) { return; @@ -978,8 +982,6 @@ Http2ConnectionState::send_data_frame(FetchSM *fetch_sm) void Http2ConnectionState::send_headers_frame(FetchSM *fetch_sm) { - DebugSsn(this->ua_session, "http2_cs", "[%" PRId64 "] Send HEADERS frame.", this->ua_session->connection_id()); - const size_t buf_len = BUFFER_SIZE_FOR_INDEX(buffer_size_index[HTTP2_FRAME_TYPE_HEADERS]) - HTTP2_FRAME_HEADER_LEN; uint8_t payload_buffer[buf_len]; size_t payload_length = 0; @@ -988,6 +990,8 @@ Http2ConnectionState::send_headers_frame(FetchSM *fetch_sm) Http2Stream *stream = static_cast<Http2Stream *>(fetch_sm->ext_get_user_data()); HTTPHdr *resp_header = reinterpret_cast<HTTPHdr *>(fetch_sm->resp_hdr_bufp()); + DebugHttp2Stream(ua_session, stream->get_id(), "Send HEADERS frame"); + // Write pseudo headers payload_length += http2_write_psuedo_headers(resp_header, payload_buffer, buf_len, *(this->remote_indexing_table)); @@ -1030,7 +1034,7 @@ Http2ConnectionState::send_headers_frame(FetchSM *fetch_sm) void Http2ConnectionState::send_rst_stream_frame(Http2StreamId id, Http2ErrorCode ec) { - DebugSsn(this->ua_session, "http2_cs", "[%" PRId64 "] Send RST_STREAM frame.", this->ua_session->connection_id()); + DebugHttp2Stream(ua_session, id, "Send RST_STREAM frame"); if (ec != HTTP2_ERROR_NO_ERROR) { HTTP2_INCREMENT_THREAD_DYN_STAT(HTTP2_STAT_STREAM_ERRORS_COUNT, this_ethread()); @@ -1059,7 +1063,11 @@ Http2ConnectionState::send_rst_stream_frame(Http2StreamId id, Http2ErrorCode ec) void Http2ConnectionState::send_settings_frame(const Http2ConnectionSettings &new_settings) { - Http2Frame settings(HTTP2_FRAME_TYPE_SETTINGS, 0, 0); + const Http2StreamId stream_id = 0; + + DebugHttp2Stream(ua_session, stream_id, "Send SETTINGS frame"); + + Http2Frame settings(HTTP2_FRAME_TYPE_SETTINGS, stream_id, 0); settings.alloc(buffer_size_index[HTTP2_FRAME_TYPE_SETTINGS]); IOVec iov = settings.write(); @@ -1084,6 +1092,8 @@ Http2ConnectionState::send_settings_frame(const Http2ConnectionSettings &new_set // Update current settings server_settings.set(id, new_settings.get(id)); + + DebugHttp2Stream(ua_session, stream_id, " %s : %u", Http2DebugNames::get_settings_param_name(param.id), param.value); } } @@ -1094,7 +1104,7 @@ Http2ConnectionState::send_settings_frame(const Http2ConnectionSettings &new_set void Http2ConnectionState::send_ping_frame(Http2StreamId id, uint8_t flag, const uint8_t *opaque_data) { - DebugSsn(this->ua_session, "http2_cs", "[%" PRId64 "] Send PING frame.", this->ua_session->connection_id()); + DebugHttp2Stream(ua_session, id, "Send PING frame"); Http2Frame ping(HTTP2_FRAME_TYPE_PING, id, flag); @@ -1110,7 +1120,7 @@ Http2ConnectionState::send_ping_frame(Http2StreamId id, uint8_t flag, const uint void Http2ConnectionState::send_goaway_frame(Http2StreamId id, Http2ErrorCode ec) { - DebugSsn(this->ua_session, "http2_cs", "[%" PRId64 "] Send GOAWAY frame.", this->ua_session->connection_id()); + DebugHttp2Stream(ua_session, id, "Send GOAWAY frame"); if (ec != HTTP2_ERROR_NO_ERROR) { HTTP2_INCREMENT_THREAD_DYN_STAT(HTTP2_STAT_CONNECTION_ERRORS_COUNT, this_ethread()); @@ -1138,7 +1148,7 @@ Http2ConnectionState::send_goaway_frame(Http2StreamId id, Http2ErrorCode ec) void Http2ConnectionState::send_window_update_frame(Http2StreamId id, uint32_t size) { - DebugSsn(this->ua_session, "http2_cs", "[%" PRId64 "] Send WINDOW_UPDATE frame.", this->ua_session->connection_id()); + DebugHttp2Stream(ua_session, id, "Send WINDOW_UPDATE frame"); // Create WINDOW_UPDATE frame Http2Frame window_update(HTTP2_FRAME_TYPE_WINDOW_UPDATE, id, 0x0); http://git-wip-us.apache.org/repos/asf/trafficserver/blob/81cd48f0/proxy/http2/Http2DebugNames.cc ---------------------------------------------------------------------- diff --git a/proxy/http2/Http2DebugNames.cc b/proxy/http2/Http2DebugNames.cc new file mode 100644 index 0000000..1a4f967 --- /dev/null +++ b/proxy/http2/Http2DebugNames.cc @@ -0,0 +1,47 @@ +/** @file + + Http2DebugNames + + @section license License + + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#include "Http2DebugNames.h" + +#include "HTTP2.h" + +const char * +Http2DebugNames::get_settings_param_name(uint16_t id) +{ + switch (id) { + case HTTP2_SETTINGS_HEADER_TABLE_SIZE: + return "HEADER_TABLE_SIZE"; + case HTTP2_SETTINGS_ENABLE_PUSH: + return "ENABLE_PUSH"; + case HTTP2_SETTINGS_MAX_CONCURRENT_STREAMS: + return "MAX_CONCURRENT_STREAMS"; + case HTTP2_SETTINGS_INITIAL_WINDOW_SIZE: + return "INITIAL_WINDOW_SIZE"; + case HTTP2_SETTINGS_MAX_FRAME_SIZE: + return "MAX_FRAME_SIZE"; + case HTTP2_SETTINGS_MAX_HEADER_LIST_SIZE: + return "MAX_HEADER_LIST_SIZE"; + } + + return "UNKNOWN"; +} http://git-wip-us.apache.org/repos/asf/trafficserver/blob/81cd48f0/proxy/http2/Http2DebugNames.h ---------------------------------------------------------------------- diff --git a/proxy/http2/Http2DebugNames.h b/proxy/http2/Http2DebugNames.h new file mode 100644 index 0000000..cf6d077 --- /dev/null +++ b/proxy/http2/Http2DebugNames.h @@ -0,0 +1,35 @@ +/** @file + + Http2DebugNames + + @section license License + + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#ifndef __HTTP2_DEBUG_NAMES_H__ +#define __HTTP2_DEBUG_NAMES_H__ + +#include "ts/ink_defs.h" + +class Http2DebugNames +{ +public: + static const char *get_settings_param_name(uint16_t id); +}; + +#endif // __HTTP2_DEBUG_NAMES_H__ http://git-wip-us.apache.org/repos/asf/trafficserver/blob/81cd48f0/proxy/http2/Makefile.am ---------------------------------------------------------------------- diff --git a/proxy/http2/Makefile.am b/proxy/http2/Makefile.am index 0db813c..5912847 100644 --- a/proxy/http2/Makefile.am +++ b/proxy/http2/Makefile.am @@ -40,6 +40,8 @@ libhttp2_a_SOURCES = \ Http2ClientSession.h \ Http2ConnectionState.cc \ Http2ConnectionState.h \ + Http2DebugNames.cc \ + Http2DebugNames.h \ Http2Stream.cc \ Http2Stream.h \ Http2SessionAccept.cc \
