This is an automated email from the ASF dual-hosted git repository. cmcfarlen pushed a commit to branch 10.0.x in repository https://gitbox.apache.org/repos/asf/trafficserver.git
commit e5fb0a8ff3cb5e3af6f5a071ab7279c6a26b63a2 Author: Masakazu Kitajo <[email protected]> AuthorDate: Mon Dec 9 19:15:39 2024 -0700 Record the amount of early data correctly (#11883) * Use ALPN on autest tls_0rtt_server * Record the amount of early data correctly The amount was incremented only after TLS handshake is completed (cherry picked from commit 599212a86e4d5c7adc766cd0d39403249e5acdef) --- src/iocore/net/SSLNetVConnection.cc | 1 + src/proxy/http2/Http2CommonSession.cc | 5 +++-- tests/gold_tests/tls/test-0rtt-s_client.py | 9 +++++++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/iocore/net/SSLNetVConnection.cc b/src/iocore/net/SSLNetVConnection.cc index 5ebb705f0e..918a052faa 100644 --- a/src/iocore/net/SSLNetVConnection.cc +++ b/src/iocore/net/SSLNetVConnection.cc @@ -2390,6 +2390,7 @@ SSLNetVConnection::_ssl_accept() } block->fill(nread); this->_early_data_buf->append_block(block); + this->_increment_early_data_len(nread); Metrics::Counter::increment(ssl_rsb.early_data_received_count); if (dbg_ctl_ssl_early_data_show_received.on()) { diff --git a/src/proxy/http2/Http2CommonSession.cc b/src/proxy/http2/Http2CommonSession.cc index 37480bfb99..b05fcfb35c 100644 --- a/src/proxy/http2/Http2CommonSession.cc +++ b/src/proxy/http2/Http2CommonSession.cc @@ -274,8 +274,9 @@ Http2CommonSession::do_start_frame_read(Http2ErrorCode &ret_error) this->cur_frame_from_early_data = true; } - Http2SsnDebug("frame header length=%u, type=%u, flags=0x%x, streamid=%u", (unsigned)this->current_hdr.length, - (unsigned)this->current_hdr.type, (unsigned)this->current_hdr.flags, this->current_hdr.streamid); + Http2SsnDebug("frame header length=%u, type=%u, flags=0x%x, streamid=%u, early_data=%d", (unsigned)this->current_hdr.length, + (unsigned)this->current_hdr.type, (unsigned)this->current_hdr.flags, this->current_hdr.streamid, + this->cur_frame_from_early_data); this->_read_buffer_reader->consume(nbytes); diff --git a/tests/gold_tests/tls/test-0rtt-s_client.py b/tests/gold_tests/tls/test-0rtt-s_client.py index 4cbe4a61ec..a3a8b1ce0b 100644 --- a/tests/gold_tests/tls/test-0rtt-s_client.py +++ b/tests/gold_tests/tls/test-0rtt-s_client.py @@ -42,10 +42,15 @@ def main(): else: sni_str = '' + if args.http_ver == 'h2': + alpn_str = '-alpn h2' + else: + alpn_str = '' + s_client_cmd_1 = shlex.split( - f'openssl s_client -connect 127.0.0.1:{args.ats_port} -tls1_3 -quiet -sess_out {sess_file_path} {sni_str}') + f'openssl s_client -connect 127.0.0.1:{args.ats_port} -tls1_3 -quiet -sess_out {sess_file_path} {sni_str} {alpn_str}') s_client_cmd_2 = shlex.split( - f'openssl s_client -connect 127.0.0.1:{args.ats_port} -tls1_3 -quiet -sess_in {sess_file_path} -early_data {early_data_file_path} {sni_str}' + f'openssl s_client -connect 127.0.0.1:{args.ats_port} -tls1_3 -quiet -sess_in {sess_file_path} -early_data {early_data_file_path} {sni_str} {alpn_str}' ) create_sess_proc = subprocess.Popen(
