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 @@ -999,7 +999,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 |TS| 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/ProxySession.cc
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,10 @@ ProxySession::connection_id() const
return con_id;
}

void
bool
ProxySession::attach_server_session(Http1ServerSession *ssession, bool transaction_done)
{
return false;
}

Http1ServerSession *
Expand Down
2 changes: 1 addition & 1 deletion proxy/ProxySession.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class ProxySession : public VConnection, public PluginUserArgs<TS_USER_ARGS_SSN>
// Virtual Methods
virtual void new_connection(NetVConnection *new_vc, MIOBuffer *iobuf, IOBufferReader *reader) = 0;
virtual void start() = 0;
virtual void attach_server_session(Http1ServerSession *ssession, bool transaction_done = true);
virtual bool attach_server_session(Http1ServerSession *ssession, bool transaction_done = true);

virtual void release(ProxyTransaction *trans) = 0;

Expand Down
4 changes: 2 additions & 2 deletions proxy/ProxyTransaction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ ProxyTransaction::new_transaction(bool from_early_data)
_sm->attach_client_session(this, _reader);
}

void
bool
ProxyTransaction::attach_server_session(Http1ServerSession *ssession, bool transaction_done)
{
_proxy_ssn->attach_server_session(ssession, transaction_done);
return _proxy_ssn->attach_server_session(ssession, transaction_done);
}

void
Expand Down
2 changes: 1 addition & 1 deletion proxy/ProxyTransaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class ProxyTransaction : public VConnection
/// Virtual Methods
//
virtual void new_transaction(bool from_early_data = false);
virtual void attach_server_session(Http1ServerSession *ssession, bool transaction_done = true);
virtual bool attach_server_session(Http1ServerSession *ssession, bool transaction_done = true);
Action *adjust_thread(Continuation *cont, int event, void *data);
virtual void release(IOBufferReader *r) = 0;
virtual void transaction_done();
Expand Down
3 changes: 2 additions & 1 deletion proxy/http/Http1ClientSession.cc
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ Http1ClientSession::new_transaction()
trans.new_transaction(read_from_early_data > 0 ? true : false);
}

void
bool
Http1ClientSession::attach_server_session(Http1ServerSession *ssession, bool transaction_done)
{
if (ssession) {
Expand Down Expand Up @@ -499,6 +499,7 @@ Http1ClientSession::attach_server_session(Http1ServerSession *ssession, bool tra
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 @@ -60,7 +60,7 @@ class Http1ClientSession : public ProxySession
void destroy() override;
void free() override;

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

// Implement VConnection interface.
void do_io_close(int lerrno = -1) 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 @@ -3143,10 +3143,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