This is an automated email from the ASF dual-hosted git repository. scw00 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push: new 28d80e5 TS-5088: Fix missing initial buffer from server, when combined with 101 response 28d80e5 is described below commit 28d80e52eca27b55cf7d5c89612afa5a3d25952f Author: Mervyn McMurray <mmcmu...@cisco.com> AuthorDate: Tue Jul 25 13:30:19 2017 +0100 TS-5088: Fix missing initial buffer from server, when combined with 101 response --- proxy/http/HttpSM.cc | 13 +++++++++++-- proxy/http/HttpSM.h | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc index 9c784e8..195d794 100644 --- a/proxy/http/HttpSM.cc +++ b/proxy/http/HttpSM.cc @@ -1587,8 +1587,12 @@ HttpSM::handle_api_return() if (unlikely(t_state.did_upgrade_succeed)) { // We've successfully handled the upgrade, let's now setup // a blind tunnel. + IOBufferReader *initial_data = nullptr; if (t_state.is_websocket) { HTTP_INCREMENT_DYN_STAT(http_websocket_current_active_client_connections_stat); + if (server_session) { + initial_data = server_session->get_reader(); + } if (ua_session) { DebugSM("http_websocket", @@ -1607,7 +1611,7 @@ HttpSM::handle_api_return() } } - setup_blind_tunnel(true); + setup_blind_tunnel(true, initial_data); } else { HttpTunnelProducer *p = setup_server_transfer(); perform_cache_write_action(); @@ -6569,7 +6573,7 @@ HttpSM::setup_push_transfer_to_cache() } void -HttpSM::setup_blind_tunnel(bool send_response_hdr) +HttpSM::setup_blind_tunnel(bool send_response_hdr, IOBufferReader *initial) { HttpTunnelConsumer *c_ua; HttpTunnelConsumer *c_os; @@ -6583,6 +6587,11 @@ HttpSM::setup_blind_tunnel(bool send_response_hdr) milestones[TS_MILESTONE_SERVER_BEGIN_WRITE] = Thread::get_hrtime(); if (send_response_hdr) { client_response_hdr_bytes = write_response_header_into_buffer(&t_state.hdr_info.client_response, to_ua_buf); + if (initial && initial->read_avail()) { + int64_t avail = initial->read_avail(); + to_ua_buf->write(initial, avail); + initial->consume(avail); + } } else { client_response_hdr_bytes = 0; } diff --git a/proxy/http/HttpSM.h b/proxy/http/HttpSM.h index d4c6839..6c4e332 100644 --- a/proxy/http/HttpSM.h +++ b/proxy/http/HttpSM.h @@ -466,7 +466,7 @@ protected: void perform_cache_write_action(); void perform_transform_cache_write_action(); void perform_nca_cache_action(); - void setup_blind_tunnel(bool send_response_hdr); + void setup_blind_tunnel(bool send_response_hdr, IOBufferReader *initial = nullptr); HttpTunnelProducer *setup_server_transfer_to_transform(); HttpTunnelProducer *setup_transfer_from_transform(); HttpTunnelProducer *setup_cache_transfer_to_transform(); -- To stop receiving notification emails like this one, please contact ['"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>'].