Skip to content

Commit

Permalink
Record the amount of early data correctly (apache#11883)
Browse files Browse the repository at this point in the history
* Use ALPN on autest tls_0rtt_server

* Record the amount of early data correctly

The amount was incremented only after TLS handshake is completed
  • Loading branch information
maskit authored Dec 10, 2024
1 parent 8f07c04 commit 599212a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/iocore/net/SSLNetVConnection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2062,6 +2062,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()) {
Expand Down
5 changes: 3 additions & 2 deletions src/proxy/http2/Http2CommonSession.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
9 changes: 7 additions & 2 deletions tests/gold_tests/tls/test-0rtt-s_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 599212a

Please sign in to comment.