Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion doc/admin-guide/files/records.config.en.rst
Original file line number Diff line number Diff line change
Expand Up @@ -996,7 +996,9 @@ mptcp
.. ts:cv:: CONFIG proxy.config.http.attach_server_session_to_client INT 0
:overridable:

Control the re-use of an server session by a user agent (client) session.
Control the re-use of an server session by a user agent (client) session. Currently only applies to user
agents using HTTP/1.0 or HTTP/1.1. For other HTTP versions, the origin connection is always returned to the
session sharing pool or closed.

If a user agent performs more than one HTTP transaction on its connection to Traffic Server a server session must be
obtained for the second (and subsequent) transaction as for the first. This settings affects how that server session
Expand Down
3 changes: 2 additions & 1 deletion proxy/ProxyClientSession.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,10 @@ class ProxyClientSession : public VConnection
return con_id;
}

virtual void
virtual bool
attach_server_session(HttpServerSession *ssession, bool transaction_done = true)
{
return false;
}

virtual HttpServerSession *
Expand Down
4 changes: 2 additions & 2 deletions proxy/ProxyClientTransaction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ ProxyClientTransaction::release(IOBufferReader *r)
}
}

void
bool
ProxyClientTransaction::attach_server_session(HttpServerSession *ssession, bool transaction_done)
{
parent->attach_server_session(ssession, transaction_done);
return parent->attach_server_session(ssession, transaction_done);
}

void
Expand Down
2 changes: 1 addition & 1 deletion proxy/ProxyClientTransaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class ProxyClientTransaction : public VConnection
virtual void set_inactivity_timeout(ink_hrtime timeout_in) = 0;
virtual void cancel_inactivity_timeout() = 0;

virtual void attach_server_session(HttpServerSession *ssession, bool transaction_done = true);
virtual bool attach_server_session(HttpServerSession *ssession, bool transaction_done = true);

// See if we need to schedule on the primary thread for the transaction or change the thread that is associated with the VC.
// If we reschedule, the scheduled action is returned. Otherwise, NULL is returned
Expand Down
3 changes: 2 additions & 1 deletion proxy/http/Http1ClientSession.cc
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ Http1ClientSession::new_transaction()
trans.new_transaction();
}

void
bool
Http1ClientSession::attach_server_session(HttpServerSession *ssession, bool transaction_done)
{
if (ssession) {
Expand Down Expand Up @@ -546,6 +546,7 @@ Http1ClientSession::attach_server_session(HttpServerSession *ssession, bool tran
bound_ss = nullptr;
slave_ka_vio = nullptr;
}
return true;
}

void
Expand Down
2 changes: 1 addition & 1 deletion proxy/http/Http1ClientSession.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class Http1ClientSession : public ProxyClientSession
// Indicate we are done with a transaction
void release(ProxyClientTransaction *trans) override;

void attach_server_session(HttpServerSession *ssession, bool transaction_done = true) override;
bool attach_server_session(HttpServerSession *ssession, bool transaction_done = true) override;

HttpServerSession *
get_server_session() const override
Expand Down
8 changes: 6 additions & 2 deletions proxy/http/HttpSM.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3032,10 +3032,14 @@ HttpSM::tunnel_handler_server(int event, HttpTunnelProducer *p)
// server session to so the next ka request can use it. Server sessions will
// be placed into the shared pool if the next incoming request is for a different
// origin server
bool release_origin_connection = true;
if (t_state.txn_conf->attach_server_session_to_client == 1 && ua_txn && t_state.client_info.keep_alive == HTTP_KEEPALIVE) {
Debug("http", "attaching server session to the client");
ua_txn->attach_server_session(server_session);
} else {
if (ua_txn->attach_server_session(server_session)) {
release_origin_connection = false;
}
}
if (release_origin_connection) {
// Release the session back into the shared session pool
server_session->get_netvc()->set_inactivity_timeout(HRTIME_SECONDS(t_state.txn_conf->keep_alive_no_activity_timeout_out));
server_session->release();
Expand Down