This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/9.0.x by this push:
     new 60e73e9  Sticky server does not work with H2 client (#7261)
60e73e9 is described below

commit 60e73e9dfd4c01fba046458e534645fae01f7a4d
Author: Susan Hinrichs <shinr...@yahoo-inc.com>
AuthorDate: Fri Oct 16 08:20:01 2020 -0500

    Sticky server does not work with H2 client (#7261)
    
    (cherry picked from commit d285211b72c3db636623575ce5a69b2f3d74d4a0)
---
 doc/admin-guide/files/records.config.en.rst | 4 +++-
 proxy/ProxySession.cc                       | 3 ++-
 proxy/ProxySession.h                        | 2 +-
 proxy/ProxyTransaction.cc                   | 4 ++--
 proxy/ProxyTransaction.h                    | 2 +-
 proxy/http/Http1ClientSession.cc            | 3 ++-
 proxy/http/Http1ClientSession.h             | 2 +-
 proxy/http/HttpSM.cc                        | 8 ++++++--
 8 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/doc/admin-guide/files/records.config.en.rst 
b/doc/admin-guide/files/records.config.en.rst
index 610927f..09c0b21 100644
--- a/doc/admin-guide/files/records.config.en.rst
+++ b/doc/admin-guide/files/records.config.en.rst
@@ -977,7 +977,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
diff --git a/proxy/ProxySession.cc b/proxy/ProxySession.cc
index 3d9c203..07af66a 100644
--- a/proxy/ProxySession.cc
+++ b/proxy/ProxySession.cc
@@ -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 *
diff --git a/proxy/ProxySession.h b/proxy/ProxySession.h
index ca24bc4..81995e2 100644
--- a/proxy/ProxySession.h
+++ b/proxy/ProxySession.h
@@ -89,7 +89,7 @@ public:
   // 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;
 
diff --git a/proxy/ProxyTransaction.cc b/proxy/ProxyTransaction.cc
index 214c710..56c40b2 100644
--- a/proxy/ProxyTransaction.cc
+++ b/proxy/ProxyTransaction.cc
@@ -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
diff --git a/proxy/ProxyTransaction.h b/proxy/ProxyTransaction.h
index 5ae71c8..9cd4af8 100644
--- a/proxy/ProxyTransaction.h
+++ b/proxy/ProxyTransaction.h
@@ -38,7 +38,7 @@ public:
   /// 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();
diff --git a/proxy/http/Http1ClientSession.cc b/proxy/http/Http1ClientSession.cc
index 7d68b24..4ffc6b1 100644
--- a/proxy/http/Http1ClientSession.cc
+++ b/proxy/http/Http1ClientSession.cc
@@ -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) {
@@ -499,6 +499,7 @@ 
Http1ClientSession::attach_server_session(Http1ServerSession *ssession, bool tra
     bound_ss     = nullptr;
     slave_ka_vio = nullptr;
   }
+  return true;
 }
 
 void
diff --git a/proxy/http/Http1ClientSession.h b/proxy/http/Http1ClientSession.h
index aef989d..686f5f4 100644
--- a/proxy/http/Http1ClientSession.h
+++ b/proxy/http/Http1ClientSession.h
@@ -60,7 +60,7 @@ public:
   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;
diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index 068678d..18f71e5 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -3113,10 +3113,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();

Reply via email to