You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by sh...@apache.org on 2019/05/30 14:03:43 UTC
[trafficserver] 02/02: Rename class: ProxyTransaction Rename class:
ProxySession Rename class: Http1ServerSession Renamed class:
Http1Transaction renamed ProxyTransaction::parent to proxy_ssn removed
ProxyTransaction::get_transaction_count() ProxySession Cleanup
This is an automated email from the ASF dual-hosted git repository.
shinrich pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
commit 92338aed4d2ec8fc0ba9132e88ac12d97b08c7aa
Author: Aaron Canary <ac...@oath.com>
AuthorDate: Wed May 29 10:29:42 2019 -0500
Rename class: ProxyTransaction
Rename class: ProxySession
Rename class: Http1ServerSession
Renamed class: Http1Transaction
renamed ProxyTransaction::parent to proxy_ssn
removed ProxyTransaction::get_transaction_count()
ProxySession Cleanup
moved code to .cc, member initialization.
ProxyTransaction Cleanup
moved code to .cc, and organized methods
---
.../client-session-architecture.en.rst | 36 +--
include/tscore/IntrusiveHashMap.h | 8 +-
proxy/ProxySession.cc | 202 ++++++++++++++-
proxy/ProxySession.h | 256 +++++--------------
proxy/ProxyTransaction.cc | 231 ++++++++++++++++--
proxy/ProxyTransaction.h | 271 +++++----------------
proxy/http/Http1ClientSession.cc | 8 +-
proxy/http/Http1ClientSession.h | 18 +-
proxy/http/Http1ServerSession.cc | 22 +-
proxy/http/Http1ServerSession.h | 48 ++--
proxy/http/Http1Transaction.cc | 24 +-
proxy/http/Http1Transaction.h | 34 +--
proxy/http/HttpSM.cc | 19 +-
proxy/http/HttpSM.h | 18 +-
proxy/http/HttpSessionManager.cc | 16 +-
proxy/http/HttpSessionManager.h | 17 +-
proxy/http/HttpTunnel.cc | 2 +-
proxy/http2/Http2ClientSession.cc | 2 +-
proxy/http2/Http2ClientSession.h | 8 +-
proxy/http2/Http2Stream.cc | 54 ++--
proxy/http2/Http2Stream.h | 4 +-
src/traffic_server/InkAPI.cc | 52 ++--
22 files changed, 715 insertions(+), 635 deletions(-)
diff --git a/doc/developer-guide/client-session-architecture.en.rst b/doc/developer-guide/client-session-architecture.en.rst
index 6d238f2..fb32a81 100644
--- a/doc/developer-guide/client-session-architecture.en.rst
+++ b/doc/developer-guide/client-session-architecture.en.rst
@@ -27,36 +27,36 @@ The User Agent interacts with ATS by creating a session with the ATS server and
submitting sequences of requests over the session. ATS supports several session protocols including
HTTP/1.x and HTTP/2. A HTTP State Machine is created for each request to process the request.
-ATS uses the generic classes ProxyClientSession and ProxyClientTransaction to hide the details of
+ATS uses the generic classes ProxySession and ProxyTransaction to hide the details of
the underlying protocols from the HTTP State Machine.
Classes
=======
-ProxyClientSession
+ProxySession
------------------
.. figure:: /static/images/sessions/session_hierarchy.png
:align: center
- :alt: ProxyClientSession hierarchy
+ :alt: ProxySession hierarchy
-The ProxyClientSession class abstracts the key features of a client session. It contains zero or more ProxyClientTransaction objects. It also has a reference to the associated NetVC (either UnixNetVConnection or SSLNetVConnection). The session class is responsible for interfacing with the user agent protocol.
+The ProxySession class abstracts the key features of a client session. It contains zero or more ProxyTransaction objects. It also has a reference to the associated NetVC (either UnixNetVConnection or SSLNetVConnection). The session class is responsible for interfacing with the user agent protocol.
At this point there are two concrete subclasses: Http1ClientSession and Http2ClientSession. The Http1ClientSession
only has at most one transaction active at a time. The HTTP/2 protocol allows for multiple simultaneous active
transactions
-ProxyClientTransaction
+ProxyTransaction
----------------------
.. figure:: /static/images/sessions/transaction_hierarchy.png
:align: center
- :alt: ProxyClientTransaction hierarchy
+ :alt: ProxyTransaction hierarchy
-The ProxyClientTransaction class abstracts the key features of a client transaction. It has a reference to its
-parent ProxyClientSession. One HttpSM is created for each ProxyClientTransaction.
+The ProxyTransaction class abstracts the key features of a client transaction. It has a reference to its
+parent ProxySession. One HttpSM is created for each ProxyTransaction.
-There are two concrete subclasses: Http1ClientTransaction and Http2Stream.
+There are two concrete subclasses: Http1Transaction and Http2Stream.
Session Object Relationships
============================
@@ -70,18 +70,18 @@ HTTP/1.x Objects
This diagram shows the relationships between objects created as part of a HTTP/1.x session. A NetVC
object performs the basic network level protocols. The Http1ClientSession object has a reference to the
-associated NetVC object. The NetVC object is available via the :code:`ProxyClientSession::get_netvc()` method.
+associated NetVC object. The NetVC object is available via the :code:`ProxySession::get_netvc()` method.
-The Http1ClientSession object contains a Http1ClientTransaction object. For each HTTP request, it calls
-the :code:`ProxyClientSession::new_transaction()` method to instantiate the Http1ClientTransaction object. With the HTTP/1.x
+The Http1ClientSession object contains a Http1Transaction object. For each HTTP request, it calls
+the :code:`ProxySession::new_transaction()` method to instantiate the Http1Transaction object. With the HTTP/1.x
protocol at most one transaction can be active at a time.
-When the Http1ClientTransaction object is instantiated via :code:`ProxyClientTransaction::new_transaction()` it allocates a
+When the Http1Transaction object is instantiated via :code:`ProxyTransaction::new_transaction()` it allocates a
new HttpSM object, initializes it, and calls :code:`HttpSM::attach_client_session()` to associate the
-Http1ClientTransaction object with the new HttpSM.
+Http1Transaction object with the new HttpSM.
-The ProxyClientTransaction object refers to the HttpSM via the current_reader member variable. The HttpSM object
-refers to ProxyClientTransaction via the ua_session member variable (session in the member name is
+The ProxyTransaction object refers to the HttpSM via the current_reader member variable. The HttpSM object
+refers to ProxyTransaction via the ua_session member variable (session in the member name is
historical because the HttpSM used to refer directly to the ClientSession object).
HTTP/2 Objects
@@ -97,7 +97,7 @@ a HttpSM object object when :code:`ProxyClient::new_transaction()` is called.
One difference is that the Http/2 protocol allows for multiple simultaneous transactions, so the Http2ClientSession
object must be able to manage multiple streams. From the HttpSM perspective it is interacting with a
-ProxyClientTransaction object, and there is no difference between working with a Http2Stream and a Http1ClientTransaction.
+ProxyTransaction object, and there is no difference between working with a Http2Stream and a Http1Transaction.
Transaction and Session Shutdown
================================
@@ -114,5 +114,5 @@ cause use-after-free and other related memory corruption errors.
To ensure that sessions and transactions are correctly shutdown the following assertions are maintained.
* The Session object will not call :code:`::destroy()` on itself until all child transaction objects are fully shutdown (i.e. TXN_CLOSE hooks are called and the transaction objects have been freed).
-* The Transaction object will not call :code:`::destroy()` on itself until the associated HttpSM has been shutdown. In :code:`HttpSM::kill_this()`, the HttpSM will call :code:`ProxyClientTransaction::transaction_done()` on the ua_session object. If the user agent initiates the termination, the ProxyClientTransaction object will send a WRITE_COMPLETE, EOS, or ERROR event on the open VIO object. This should signal to the HttpSM object to shut itself down.
+* The Transaction object will not call :code:`::destroy()` on itself until the associated HttpSM has been shutdown. In :code:`HttpSM::kill_this()`, the HttpSM will call :code:`ProxyTransaction::transaction_done()` on the ua_session object. If the user agent initiates the termination, the ProxyTransaction object will send a WRITE_COMPLETE, EOS, or ERROR event on the open VIO object. This should signal to the HttpSM object to shut itself down.
diff --git a/include/tscore/IntrusiveHashMap.h b/include/tscore/IntrusiveHashMap.h
index 704b964..8a64a7b 100644
--- a/include/tscore/IntrusiveHashMap.h
+++ b/include/tscore/IntrusiveHashMap.h
@@ -67,15 +67,15 @@
@a ID The numeric type that is the hash value for an instance of @a Key.
- Example for @c HttpServerSession keyed by the origin server IP address.
+ Example for @c Http1ServerSession keyed by the origin server IP address.
@code
struct Descriptor {
- static sockaddr const* key_of(HttpServerSession const* value) { return &value->ip.sa }
+ static sockaddr const* key_of(Http1ServerSession const* value) { return &value->ip.sa }
static bool equal(sockaddr const* lhs, sockaddr const* rhs) { return ats_ip_eq(lhs, rhs); }
static uint32_t hash_of(sockaddr const* key) { return ats_ip_hash(key); }
- static HttpServerSession *& next_ptr(HttpServerSession * ssn) { return ssn->_next; }
- static HttpServerSession *& prev_ptr(HttpServerSession * ssn) { return ssn->_prev; }
+ static Http1ServerSession *& next_ptr(Http1ServerSession * ssn) { return ssn->_next; }
+ static Http1ServerSession *& prev_ptr(Http1ServerSession * ssn) { return ssn->_prev; }
};
using Table = IntrusiveHashMap<Descriptor>;
@endcode
diff --git a/proxy/ProxySession.cc b/proxy/ProxySession.cc
index a4c27c0..8ca3cfc 100644
--- a/proxy/ProxySession.cc
+++ b/proxy/ProxySession.cc
@@ -1,6 +1,6 @@
/** @file
- ProxyClientSession - Base class for protocol client sessions.
+ ProxySession - Base class for protocol client sessions.
@section license License
@@ -27,13 +27,13 @@
static int64_t next_cs_id = 0;
-ProxyClientSession::ProxyClientSession() : VConnection(nullptr)
+ProxySession::ProxySession() : VConnection(nullptr)
{
ink_zero(this->user_args);
}
void
-ProxyClientSession::set_session_active()
+ProxySession::set_session_active()
{
if (!m_active) {
m_active = true;
@@ -42,7 +42,7 @@ ProxyClientSession::set_session_active()
}
void
-ProxyClientSession::clear_session_active()
+ProxySession::clear_session_active()
{
if (m_active) {
m_active = false;
@@ -51,7 +51,7 @@ ProxyClientSession::clear_session_active()
}
int64_t
-ProxyClientSession::next_connection_id()
+ProxySession::next_connection_id()
{
return ink_atomic_increment(&next_cs_id, 1);
}
@@ -84,7 +84,7 @@ is_valid_hook(TSHttpHookID hookid)
}
void
-ProxyClientSession::free()
+ProxySession::free()
{
if (schedule_event) {
schedule_event->cancel();
@@ -96,7 +96,7 @@ ProxyClientSession::free()
}
int
-ProxyClientSession::state_api_callout(int event, void *data)
+ProxySession::state_api_callout(int event, void *data)
{
Event *e = static_cast<Event *>(data);
if (e == schedule_event) {
@@ -124,7 +124,7 @@ ProxyClientSession::state_api_callout(int event, void *data)
MUTEX_TRY_LOCK(lock, hook->m_cont->mutex, mutex->thread_holding);
// Have a mutex but did't get the lock, reschedule
if (!lock.is_locked()) {
- SET_HANDLER(&ProxyClientSession::state_api_callout);
+ SET_HANDLER(&ProxySession::state_api_callout);
if (!schedule_event) { // Don't bother to schedule is there is already one out.
schedule_event = mutex->thread_holding->schedule_in(this, HRTIME_MSECONDS(10));
}
@@ -153,7 +153,7 @@ ProxyClientSession::state_api_callout(int event, void *data)
}
void
-ProxyClientSession::do_api_callout(TSHttpHookID id)
+ProxySession::do_api_callout(TSHttpHookID id)
{
ink_assert(id == TS_HTTP_SSN_START_HOOK || id == TS_HTTP_SSN_CLOSE_HOOK);
@@ -162,7 +162,7 @@ ProxyClientSession::do_api_callout(TSHttpHookID id)
this->api_current = nullptr;
if (this->has_hooks()) {
- SET_HANDLER(&ProxyClientSession::state_api_callout);
+ SET_HANDLER(&ProxySession::state_api_callout);
this->state_api_callout(EVENT_NONE, nullptr);
} else {
this->handle_api_return(TS_EVENT_HTTP_CONTINUE);
@@ -170,11 +170,11 @@ ProxyClientSession::do_api_callout(TSHttpHookID id)
}
void
-ProxyClientSession::handle_api_return(int event)
+ProxySession::handle_api_return(int event)
{
TSHttpHookID hookid = this->api_hookid;
- SET_HANDLER(&ProxyClientSession::state_api_callout);
+ SET_HANDLER(&ProxySession::state_api_callout);
this->api_hookid = TS_HTTP_LAST_HOOK;
this->api_scope = API_HOOK_SCOPE_NONE;
@@ -197,3 +197,181 @@ ProxyClientSession::handle_api_return(int event)
break;
}
}
+
+void *
+
+ProxySession::get_user_arg(unsigned ix) const
+{
+ ink_assert(ix < countof(user_args));
+ return this->user_args[ix];
+}
+
+void
+ProxySession::set_user_arg(unsigned ix, void *arg)
+{
+ ink_assert(ix < countof(user_args));
+ user_args[ix] = arg;
+}
+
+void
+ProxySession::set_debug(bool flag)
+{
+ debug_on = flag;
+}
+
+// Return whether debugging is enabled for this session.
+bool
+ProxySession::debug() const
+{
+ return this->debug_on;
+}
+
+bool
+ProxySession::is_active() const
+{
+ return m_active;
+}
+
+bool
+ProxySession::is_draining() const
+{
+ return TSSystemState::is_draining();
+}
+
+// Override if your session protocol allows this.
+bool
+ProxySession::is_transparent_passthrough_allowed() const
+{
+ return false;
+}
+
+bool
+ProxySession::is_chunked_encoding_supported() const
+{
+ return false;
+}
+
+// Override if your session protocol cares.
+void
+ProxySession::set_half_close_flag(bool flag)
+{
+}
+
+bool
+ProxySession::get_half_close_flag() const
+{
+ return false;
+}
+
+in_port_t
+ProxySession::get_outbound_port() const
+{
+ return outbound_port;
+}
+
+IpAddr
+ProxySession::get_outbound_ip4() const
+{
+ return outbound_ip4;
+}
+
+IpAddr
+ProxySession::get_outbound_ip6() const
+{
+ return outbound_ip6;
+}
+
+int64_t
+ProxySession::connection_id() const
+{
+ return con_id;
+}
+
+void
+ProxySession::attach_server_session(Http1ServerSession *ssession, bool transaction_done)
+{
+}
+
+Http1ServerSession *
+ProxySession::get_server_session() const
+{
+ return nullptr;
+}
+
+TSHttpHookID
+ProxySession::get_hookid() const
+{
+ return api_hookid;
+}
+
+void
+ProxySession::set_active_timeout(ink_hrtime timeout_in)
+{
+}
+
+void
+ProxySession::set_inactivity_timeout(ink_hrtime timeout_in)
+{
+}
+
+void
+ProxySession::cancel_inactivity_timeout()
+{
+}
+
+bool
+ProxySession::is_client_closed() const
+{
+ return get_netvc() == nullptr;
+}
+
+int
+ProxySession::populate_protocol(std::string_view *result, int size) const
+{
+ auto vc = this->get_netvc();
+ return vc ? vc->populate_protocol(result, size) : 0;
+}
+
+const char *
+ProxySession::protocol_contains(std::string_view tag_prefix) const
+{
+ auto vc = this->get_netvc();
+ return vc ? vc->protocol_contains(tag_prefix) : nullptr;
+}
+
+sockaddr const *
+ProxySession::get_client_addr()
+{
+ NetVConnection *netvc = get_netvc();
+ return netvc ? netvc->get_remote_addr() : nullptr;
+}
+sockaddr const *
+ProxySession::get_local_addr()
+{
+ NetVConnection *netvc = get_netvc();
+ return netvc ? netvc->get_local_addr() : nullptr;
+}
+
+void
+ProxySession::ssn_hook_append(TSHttpHookID id, INKContInternal *cont)
+{
+ this->api_hooks.append(id, cont);
+}
+
+void
+ProxySession::ssn_hook_prepend(TSHttpHookID id, INKContInternal *cont)
+{
+ this->api_hooks.prepend(id, cont);
+}
+
+APIHook *
+ProxySession::ssn_hook_get(TSHttpHookID id) const
+{
+ return this->api_hooks.get(id);
+}
+
+bool
+ProxySession::has_hooks() const
+{
+ return this->api_hooks.has_hooks() || http_global_hooks->has_hooks();
+}
diff --git a/proxy/ProxySession.h b/proxy/ProxySession.h
index 9fa3aa1..b0b3b56 100644
--- a/proxy/ProxySession.h
+++ b/proxy/ProxySession.h
@@ -1,6 +1,6 @@
/** @file
- ProxyClientSession - Base class for protocol client sessions.
+ ProxySession - Base class for protocol client sessions.
@section license License
@@ -37,7 +37,7 @@
// member function.
#define SsnDebug(ssn, tag, ...) SpecificDebug((ssn)->debug(), tag, __VA_ARGS__)
-class ProxyClientTransaction;
+class ProxyTransaction;
enum class ProxyErrorClass {
NONE,
@@ -71,233 +71,97 @@ struct ProxyError {
};
/// Abstract class for HttpSM to interface with any session
-class ProxyClientSession : public VConnection
+class ProxySession : public VConnection
{
public:
- ProxyClientSession();
+ ProxySession();
- virtual void destroy() = 0;
- virtual void free();
- virtual void start() = 0;
+ // noncopyable
+ ProxySession(ProxySession &) = delete;
+ ProxySession &operator=(const ProxySession &) = delete;
- virtual void new_connection(NetVConnection *new_vc, MIOBuffer *iobuf, IOBufferReader *reader) = 0;
+ static int64_t next_connection_id();
- virtual NetVConnection *get_netvc() const = 0;
+ // 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 int get_transact_count() const = 0;
+ virtual void release(ProxyTransaction *trans) = 0;
- virtual const char *get_protocol_string() const = 0;
+ virtual void destroy() = 0;
+ virtual void free();
- virtual void
- ssn_hook_append(TSHttpHookID id, INKContInternal *cont)
- {
- this->api_hooks.append(id, cont);
- }
+ virtual void increment_current_active_client_connections_stat() = 0;
+ virtual void decrement_current_active_client_connections_stat() = 0;
- virtual void
- ssn_hook_prepend(TSHttpHookID id, INKContInternal *cont)
- {
- this->api_hooks.prepend(id, cont);
- }
+ // Virtual Accessors
+ virtual NetVConnection *get_netvc() const = 0;
+ virtual int get_transact_count() const = 0;
+ virtual const char *get_protocol_string() const = 0;
+ virtual bool is_transparent_passthrough_allowed() const;
- APIHook *
- ssn_hook_get(TSHttpHookID id) const
- {
- return this->api_hooks.get(id);
- }
+ virtual void ssn_hook_append(TSHttpHookID id, INKContInternal *cont);
- void *
- get_user_arg(unsigned ix) const
- {
- ink_assert(ix < countof(user_args));
- return this->user_args[ix];
- }
+ virtual void ssn_hook_prepend(TSHttpHookID id, INKContInternal *cont);
- void
- set_user_arg(unsigned ix, void *arg)
- {
- ink_assert(ix < countof(user_args));
- user_args[ix] = arg;
- }
+ virtual bool is_chunked_encoding_supported() const;
- void
- set_debug(bool flag)
- {
- debug_on = flag;
- }
+ virtual void set_half_close_flag(bool flag);
+ virtual bool get_half_close_flag() const;
- // Return whether debugging is enabled for this session.
- bool
- debug() const
- {
- return this->debug_on;
- }
+ virtual in_port_t get_outbound_port() const;
+ virtual IpAddr get_outbound_ip4() const;
+ virtual IpAddr get_outbound_ip6() const;
+ virtual Http1ServerSession *get_server_session() const;
- bool
- has_hooks() const
- {
- return this->api_hooks.has_hooks() || http_global_hooks->has_hooks();
- }
+ // Replicate NetVConnection API
+ virtual sockaddr const *get_client_addr();
+ virtual sockaddr const *get_local_addr();
- bool
- is_active() const
- {
- return m_active;
- }
+ virtual void set_active_timeout(ink_hrtime timeout_in);
+ virtual void set_inactivity_timeout(ink_hrtime timeout_in);
+ virtual void cancel_inactivity_timeout();
- bool
- is_draining() const
- {
- return TSSystemState::is_draining();
- }
+ virtual int populate_protocol(std::string_view *result, int size) const;
+ virtual const char *protocol_contains(std::string_view tag_prefix) const;
- // Initiate an API hook invocation.
+ // Non-Virtual Methods
void do_api_callout(TSHttpHookID id);
- // Override if your session protocol allows this.
- virtual bool
- is_transparent_passthrough_allowed() const
- {
- return false;
- }
-
- virtual bool
- is_chunked_encoding_supported() const
- {
- return false;
- }
-
- // Override if your session protocol cares.
- virtual void
- set_half_close_flag(bool flag)
- {
- }
-
- virtual bool
- get_half_close_flag() const
- {
- return false;
- }
-
- // Indicate we are done with a transaction.
- virtual void release(ProxyClientTransaction *trans) = 0;
-
- virtual in_port_t
- get_outbound_port() const
- {
- return outbound_port;
- }
-
- virtual IpAddr
- get_outbound_ip4() const
- {
- return outbound_ip4;
- }
-
- virtual IpAddr
- get_outbound_ip6() const
- {
- return outbound_ip6;
- }
-
- int64_t
- connection_id() const
- {
- return con_id;
- }
-
- virtual void
- attach_server_session(HttpServerSession *ssession, bool transaction_done = true)
- {
- }
-
- virtual HttpServerSession *
- get_server_session() const
- {
- return nullptr;
- }
-
- TSHttpHookID
- get_hookid() const
- {
- return api_hookid;
- }
-
- virtual void
- set_active_timeout(ink_hrtime timeout_in)
- {
- }
-
- virtual void
- set_inactivity_timeout(ink_hrtime timeout_in)
- {
- }
-
- virtual void
- cancel_inactivity_timeout()
- {
- }
-
- bool
- is_client_closed() const
- {
- return get_netvc() == nullptr;
- }
+ // Non-Virtual Accessors
+ void *get_user_arg(unsigned ix) const;
+ void set_user_arg(unsigned ix, void *arg);
- virtual int
- populate_protocol(std::string_view *result, int size) const
- {
- auto vc = this->get_netvc();
- return vc ? vc->populate_protocol(result, size) : 0;
- }
-
- virtual const char *
- protocol_contains(std::string_view tag_prefix) const
- {
- auto vc = this->get_netvc();
- return vc ? vc->protocol_contains(tag_prefix) : nullptr;
- }
+ void set_debug(bool flag);
+ bool debug() const;
void set_session_active();
void clear_session_active();
- virtual void increment_current_active_client_connections_stat() = 0;
- virtual void decrement_current_active_client_connections_stat() = 0;
+ bool is_active() const;
+ bool is_draining() const;
+ bool is_client_closed() const;
- static int64_t next_connection_id();
+ int64_t connection_id() const;
+ TSHttpHookID get_hookid() const;
+ bool has_hooks() const;
- virtual sockaddr const *
- get_client_addr()
- {
- NetVConnection *netvc = get_netvc();
- return netvc ? netvc->get_remote_addr() : nullptr;
- }
- virtual sockaddr const *
- get_local_addr()
- {
- NetVConnection *netvc = get_netvc();
- return netvc ? netvc->get_local_addr() : nullptr;
- }
+ APIHook *ssn_hook_get(TSHttpHookID id) const;
+
+ ////////////////////
+ // Members
- /// IpAllow based method ACL.
- IpAllow::ACL acl;
+ IpAllow::ACL acl; ///< IpAllow based method ACL.
- /// Local address for outbound connection.
- IpAddr outbound_ip4;
- /// Local address for outbound connection.
- IpAddr outbound_ip6;
- /// Local port for outbound connection.
- in_port_t outbound_port{0};
+ IpAddr outbound_ip4; ///< Local address for outbound connection.
+ IpAddr outbound_ip6; ///< Local address for outbound connection.
+ in_port_t outbound_port{0}; ///< Local port for outbound connection.
- /// DNS resolution preferences.
- HostResStyle host_res_style = HOST_RES_IPV4;
+ HostResStyle host_res_style = HOST_RES_NONE; ///< DNS resolution preferences.
ink_hrtime ssn_start_time = 0;
ink_hrtime ssn_last_txn_time = 0;
- // noncopyable
- ProxyClientSession(ProxyClientSession &) = delete;
- ProxyClientSession &operator=(const ProxyClientSession &) = delete;
-
protected:
// XXX Consider using a bitwise flags variable for the following flags, so
// that we can make the best use of internal alignment padding.
diff --git a/proxy/ProxyTransaction.cc b/proxy/ProxyTransaction.cc
index e2b00bb..8529b4c 100644
--- a/proxy/ProxyTransaction.cc
+++ b/proxy/ProxyTransaction.cc
@@ -1,6 +1,6 @@
/** @file
- ProxyClientTransaction - Base class for protocol client transactions.
+ ProxyTransaction - Base class for protocol client transactions.
@section license License
@@ -27,21 +27,21 @@
#define HttpTxnDebug(fmt, ...) SsnDebug(this, "http_txn", fmt, __VA_ARGS__)
-ProxyClientTransaction::ProxyClientTransaction() : VConnection(nullptr) {}
+ProxyTransaction::ProxyTransaction() : VConnection(nullptr) {}
void
-ProxyClientTransaction::new_transaction()
+ProxyTransaction::new_transaction()
{
ink_assert(current_reader == nullptr);
// Defensive programming, make sure nothing persists across
// connection re-use
- ink_release_assert(parent != nullptr);
+ ink_release_assert(proxy_ssn != nullptr);
current_reader = HttpSM::allocate();
current_reader->init();
- HttpTxnDebug("[%" PRId64 "] Starting transaction %d using sm [%" PRId64 "]", parent->connection_id(),
- parent->get_transact_count(), current_reader->sm_id);
+ HttpTxnDebug("[%" PRId64 "] Starting transaction %d using sm [%" PRId64 "]", proxy_ssn->connection_id(),
+ proxy_ssn->get_transact_count(), current_reader->sm_id);
PluginIdentity *pi = dynamic_cast<PluginIdentity *>(this->get_netvc());
if (pi) {
@@ -49,39 +49,38 @@ ProxyClientTransaction::new_transaction()
current_reader->plugin_id = pi->getPluginId();
}
- this->increment_client_transactions_stat();
current_reader->attach_client_session(this, sm_reader);
}
void
-ProxyClientTransaction::release(IOBufferReader *r)
+ProxyTransaction::release(IOBufferReader *r)
{
- HttpTxnDebug("[%" PRId64 "] session released by sm [%" PRId64 "]", parent ? parent->connection_id() : 0,
+ HttpTxnDebug("[%" PRId64 "] session released by sm [%" PRId64 "]", proxy_ssn ? proxy_ssn->connection_id() : 0,
current_reader ? current_reader->sm_id : 0);
- this->decrement_client_transactions_stat();
-
// Pass along the release to the session
- if (parent) {
- parent->release(this);
+ if (proxy_ssn) {
+ proxy_ssn->release(this);
}
}
void
-ProxyClientTransaction::attach_server_session(HttpServerSession *ssession, bool transaction_done)
+ProxyTransaction::attach_server_session(Http1ServerSession *ssession, bool transaction_done)
{
- parent->attach_server_session(ssession, transaction_done);
+ proxy_ssn->attach_server_session(ssession, transaction_done);
}
void
-ProxyClientTransaction::destroy()
+ProxyTransaction::destroy()
{
current_reader = nullptr;
this->mutex.clear();
}
+// 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
Action *
-ProxyClientTransaction::adjust_thread(Continuation *cont, int event, void *data)
+ProxyTransaction::adjust_thread(Continuation *cont, int event, void *data)
{
NetVConnection *vc = this->get_netvc();
EThread *this_thread = this_ethread();
@@ -96,7 +95,7 @@ ProxyClientTransaction::adjust_thread(Continuation *cont, int event, void *data)
}
void
-ProxyClientTransaction::set_rx_error_code(ProxyError e)
+ProxyTransaction::set_rx_error_code(ProxyError e)
{
if (this->current_reader) {
this->current_reader->t_state.client_info.rx_error_code = e;
@@ -104,9 +103,203 @@ ProxyClientTransaction::set_rx_error_code(ProxyError e)
}
void
-ProxyClientTransaction::set_tx_error_code(ProxyError e)
+ProxyTransaction::set_tx_error_code(ProxyError e)
{
if (this->current_reader) {
this->current_reader->t_state.client_info.tx_error_code = e;
}
}
+
+NetVConnection *
+ProxyTransaction::get_netvc() const
+{
+ return (proxy_ssn) ? proxy_ssn->get_netvc() : nullptr;
+}
+
+bool
+ProxyTransaction::is_first_transaction() const
+{
+ return proxy_ssn->get_transact_count() == 1;
+}
+// Ask your session if this is allowed
+bool
+ProxyTransaction::is_transparent_passthrough_allowed()
+{
+ return proxy_ssn ? proxy_ssn->is_transparent_passthrough_allowed() : false;
+}
+
+bool
+ProxyTransaction::is_chunked_encoding_supported() const
+{
+ return proxy_ssn ? proxy_ssn->is_chunked_encoding_supported() : false;
+}
+
+void
+ProxyTransaction::set_half_close_flag(bool flag)
+{
+ if (proxy_ssn) {
+ proxy_ssn->set_half_close_flag(flag);
+ }
+}
+
+bool
+ProxyTransaction::get_half_close_flag() const
+{
+ return proxy_ssn ? proxy_ssn->get_half_close_flag() : false;
+}
+
+// What are the debug and hooks_enabled used for? How are they set?
+// Just calling through to proxy session for now
+bool
+ProxyTransaction::debug() const
+{
+ return proxy_ssn ? proxy_ssn->debug() : false;
+}
+
+APIHook *
+ProxyTransaction::ssn_hook_get(TSHttpHookID id) const
+{
+ return proxy_ssn ? proxy_ssn->ssn_hook_get(id) : nullptr;
+}
+
+bool
+ProxyTransaction::has_hooks() const
+{
+ return proxy_ssn->has_hooks();
+}
+
+void
+ProxyTransaction::set_session_active()
+{
+ if (proxy_ssn) {
+ proxy_ssn->set_session_active();
+ }
+}
+
+void
+ProxyTransaction::clear_session_active()
+{
+ if (proxy_ssn) {
+ proxy_ssn->clear_session_active();
+ }
+}
+
+/// DNS resolution preferences.
+HostResStyle
+ProxyTransaction::get_host_res_style() const
+{
+ return host_res_style;
+}
+void
+ProxyTransaction::set_host_res_style(HostResStyle style)
+{
+ host_res_style = style;
+}
+
+const IpAllow::ACL &
+ProxyTransaction::get_acl() const
+{
+ return proxy_ssn ? proxy_ssn->acl : IpAllow::DENY_ALL_ACL;
+}
+
+// outbound values Set via the server port definition. Really only used for Http1 at the moment
+in_port_t
+ProxyTransaction::get_outbound_port() const
+{
+ return outbound_port;
+}
+IpAddr
+ProxyTransaction::get_outbound_ip4() const
+{
+ return outbound_ip4;
+}
+IpAddr
+ProxyTransaction::get_outbound_ip6() const
+{
+ return outbound_ip6;
+}
+void
+ProxyTransaction::set_outbound_port(in_port_t port)
+{
+ outbound_port = port;
+}
+void
+ProxyTransaction::set_outbound_ip(const IpAddr &new_addr)
+{
+ if (new_addr.isIp4()) {
+ outbound_ip4 = new_addr;
+ } else if (new_addr.isIp6()) {
+ outbound_ip6 = new_addr;
+ } else {
+ outbound_ip4.invalidate();
+ outbound_ip6.invalidate();
+ }
+}
+bool
+ProxyTransaction::is_outbound_transparent() const
+{
+ return false;
+}
+void
+ProxyTransaction::set_outbound_transparent(bool flag)
+{
+}
+
+ProxySession *
+ProxyTransaction::get_parent()
+{
+ return proxy_ssn;
+}
+
+void
+ProxyTransaction::set_parent(ProxySession *new_parent)
+{
+ proxy_ssn = new_parent;
+ host_res_style = proxy_ssn->host_res_style;
+}
+
+void
+ProxyTransaction::set_h2c_upgrade_flag()
+{
+}
+
+Http1ServerSession *
+ProxyTransaction::get_server_session() const
+{
+ return proxy_ssn ? proxy_ssn->get_server_session() : nullptr;
+}
+
+HttpSM *
+ProxyTransaction::get_sm() const
+{
+ return current_reader;
+}
+
+const char *
+ProxyTransaction::get_protocol_string()
+{
+ return proxy_ssn ? proxy_ssn->get_protocol_string() : nullptr;
+}
+
+void
+ProxyTransaction::set_restart_immediate(bool val)
+{
+ restart_immediate = true;
+}
+bool
+ProxyTransaction::get_restart_immediate() const
+{
+ return restart_immediate;
+}
+
+int
+ProxyTransaction::populate_protocol(std::string_view *result, int size) const
+{
+ return proxy_ssn ? proxy_ssn->populate_protocol(result, size) : 0;
+}
+
+const char *
+ProxyTransaction::protocol_contains(std::string_view tag_prefix) const
+{
+ return proxy_ssn ? proxy_ssn->protocol_contains(tag_prefix) : nullptr;
+}
diff --git a/proxy/ProxyTransaction.h b/proxy/ProxyTransaction.h
index 675a61c..f95bcb8 100644
--- a/proxy/ProxyTransaction.h
+++ b/proxy/ProxyTransaction.h
@@ -1,6 +1,6 @@
/** @file
- ProxyClientTransaction - Base class for protocol client transactions.
+ ProxyTransaction - Base class for protocol client/server transactions.
@section license License
@@ -27,248 +27,93 @@
#include <string_view>
class HttpSM;
-class HttpServerSession;
-class ProxyClientTransaction : public VConnection
+class Http1ServerSession;
+
+// Abstract Class for any transaction with-in the HttpSM
+class ProxyTransaction : public VConnection
{
public:
- ProxyClientTransaction();
-
- // do_io methods implemented by subclasses
+ ProxyTransaction();
+ /// Virtual Methods
+ //
virtual void new_transaction();
+ virtual void attach_server_session(Http1ServerSession *ssession, bool transaction_done = true);
+ Action *adjust_thread(Continuation *cont, int event, void *data);
+ virtual void release(IOBufferReader *r);
+ virtual void transaction_done() = 0;
+ virtual void destroy();
- virtual NetVConnection *
- get_netvc() const
- {
- return (parent) ? parent->get_netvc() : nullptr;
- }
-
+ /// Virtual Accessors
+ //
virtual void set_active_timeout(ink_hrtime timeout_in) = 0;
virtual void set_inactivity_timeout(ink_hrtime timeout_in) = 0;
virtual void cancel_inactivity_timeout() = 0;
+ virtual int get_transaction_id() const = 0;
+ virtual bool allow_half_open() const = 0;
+ virtual void increment_client_transactions_stat() = 0;
+ virtual void decrement_client_transactions_stat() = 0;
- virtual void 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
- Action *adjust_thread(Continuation *cont, int event, void *data);
-
- int
- get_transact_count() const
- {
- return parent ? parent->get_transact_count() : 0;
- }
-
- virtual bool
- is_first_transaction() const
- {
- return get_transact_count() == 1;
- }
-
- // Ask your session if this is allowed
- bool
- is_transparent_passthrough_allowed()
- {
- return parent ? parent->is_transparent_passthrough_allowed() : false;
- }
-
- virtual bool
- is_chunked_encoding_supported() const
- {
- return parent ? parent->is_chunked_encoding_supported() : false;
- }
+ virtual NetVConnection *get_netvc() const;
+ virtual bool is_first_transaction() const;
+ virtual in_port_t get_outbound_port() const;
+ virtual IpAddr get_outbound_ip4() const;
+ virtual IpAddr get_outbound_ip6() const;
+ virtual void set_outbound_port(in_port_t port);
+ virtual void set_outbound_ip(const IpAddr &new_addr);
+ virtual bool is_outbound_transparent() const;
+ virtual void set_outbound_transparent(bool flag);
- void
- set_half_close_flag(bool flag)
- {
- if (parent) {
- parent->set_half_close_flag(flag);
- }
- }
- virtual bool
- get_half_close_flag() const
- {
- return parent ? parent->get_half_close_flag() : false;
- }
+ virtual void set_session_active();
+ virtual void clear_session_active();
- // What are the debug and hooks_enabled used for? How are they set?
- // Just calling through to parent session for now
- bool
- debug() const
- {
- return parent ? parent->debug() : false;
- }
+ virtual bool get_half_close_flag() const;
+ virtual bool is_chunked_encoding_supported() const;
- APIHook *
- ssn_hook_get(TSHttpHookID id) const
- {
- return parent ? parent->ssn_hook_get(id) : nullptr;
- }
+ virtual void set_parent(ProxySession *new_parent);
+ virtual void set_h2c_upgrade_flag();
- bool
- has_hooks() const
- {
- return parent->has_hooks();
- }
+ virtual const char *get_protocol_string();
- virtual void
- set_session_active()
- {
- if (parent) {
- parent->set_session_active();
- }
- }
+ virtual int populate_protocol(std::string_view *result, int size) const;
- virtual void
- clear_session_active()
- {
- if (parent) {
- parent->clear_session_active();
- }
- }
+ virtual const char *protocol_contains(std::string_view tag_prefix) const;
- /// DNS resolution preferences.
- HostResStyle
- get_host_res_style() const
- {
- return host_res_style;
- }
- void
- set_host_res_style(HostResStyle style)
- {
- host_res_style = style;
- }
-
- const IpAllow::ACL &
- get_acl() const
- {
- return parent ? parent->acl : IpAllow::DENY_ALL_ACL;
- }
-
- // Indicate we are done with this transaction
- virtual void release(IOBufferReader *r);
-
- // outbound values Set via the server port definition. Really only used for Http1 at the moment
- virtual in_port_t
- get_outbound_port() const
- {
- return outbound_port;
- }
- virtual IpAddr
- get_outbound_ip4() const
- {
- return outbound_ip4;
- }
- virtual IpAddr
- get_outbound_ip6() const
- {
- return outbound_ip6;
- }
- virtual void
- set_outbound_port(in_port_t port)
- {
- outbound_port = port;
- }
- virtual void
- set_outbound_ip(const IpAddr &new_addr)
- {
- if (new_addr.isIp4()) {
- outbound_ip4 = new_addr;
- } else if (new_addr.isIp6()) {
- outbound_ip6 = new_addr;
- } else {
- outbound_ip4.invalidate();
- outbound_ip6.invalidate();
- }
- }
- virtual bool
- is_outbound_transparent() const
- {
- return false;
- }
- virtual void
- set_outbound_transparent(bool flag)
- {
- }
-
- virtual void destroy();
-
- virtual void transaction_done() = 0;
-
- ProxyClientSession *
- get_parent()
- {
- return parent;
- }
-
- virtual void
- set_parent(ProxyClientSession *new_parent)
- {
- parent = new_parent;
- host_res_style = parent->host_res_style;
- }
- virtual void
- set_h2c_upgrade_flag()
- {
- }
+ /// Non-Virtual Methods
+ //
- HttpServerSession *
- get_server_session() const
- {
- return parent ? parent->get_server_session() : nullptr;
- }
+ /// Non-Virtual Accessors
+ //
+ bool is_transparent_passthrough_allowed();
+ void set_half_close_flag(bool flag);
- HttpSM *
- get_sm() const
- {
- return current_reader;
- }
+ bool debug() const;
- virtual bool allow_half_open() const = 0;
+ APIHook *ssn_hook_get(TSHttpHookID id) const;
+ bool has_hooks() const;
- virtual const char *
- get_protocol_string()
- {
- return parent ? parent->get_protocol_string() : nullptr;
- }
+ HostResStyle get_host_res_style() const;
+ void set_host_res_style(HostResStyle style);
- void
- set_restart_immediate(bool val)
- {
- restart_immediate = true;
- }
- bool
- get_restart_immediate() const
- {
- return restart_immediate;
- }
+ const IpAllow::ACL &get_acl() const;
- virtual int
- populate_protocol(std::string_view *result, int size) const
- {
- return parent ? parent->populate_protocol(result, size) : 0;
- }
+ ProxySession *get_parent();
+ Http1ServerSession *get_server_session() const;
+ HttpSM *get_sm() const;
- virtual const char *
- protocol_contains(std::string_view tag_prefix) const
- {
- return parent ? parent->protocol_contains(tag_prefix) : nullptr;
- }
+ void set_restart_immediate(bool val);
+ bool get_restart_immediate() const;
- // This function must return a non-negative number that is different for two in-progress transactions with the same parent
+ // This function must return a non-negative number that is different for two in-progress transactions with the same proxy_ssn
// session.
//
- virtual int get_transaction_id() const = 0;
void set_rx_error_code(ProxyError e);
void set_tx_error_code(ProxyError e);
- virtual void increment_client_transactions_stat() = 0;
- virtual void decrement_client_transactions_stat() = 0;
-
protected:
- ProxyClientSession *parent = nullptr;
- HttpSM *current_reader = nullptr;
- IOBufferReader *sm_reader = nullptr;
+ ProxySession *proxy_ssn = nullptr;
+ HttpSM *current_reader = nullptr;
+ IOBufferReader *sm_reader = nullptr;
/// DNS resolution preferences.
HostResStyle host_res_style = HOST_RES_NONE;
diff --git a/proxy/http/Http1ClientSession.cc b/proxy/http/Http1ClientSession.cc
index 34e10a2..11f5ce4 100644
--- a/proxy/http/Http1ClientSession.cc
+++ b/proxy/http/Http1ClientSession.cc
@@ -143,7 +143,7 @@ Http1ClientSession::new_connection(NetVConnection *new_vc, MIOBuffer *iobuf, IOB
ink_assert(lock.is_locked());
// Unique client session identifier.
- con_id = ProxyClientSession::next_connection_id();
+ con_id = ProxySession::next_connection_id();
schedule_event = nullptr;
@@ -408,9 +408,9 @@ Http1ClientSession::reenable(VIO *vio)
client_vc->reenable(vio);
}
-// Called from the Http1ClientTransaction::release
+// Called from the Http1Transaction::release
void
-Http1ClientSession::release(ProxyClientTransaction *trans)
+Http1ClientSession::release(ProxyTransaction *trans)
{
ink_assert(read_state == HCS_ACTIVE_READER || read_state == HCS_INIT);
@@ -466,7 +466,7 @@ Http1ClientSession::new_transaction()
}
void
-Http1ClientSession::attach_server_session(HttpServerSession *ssession, bool transaction_done)
+Http1ClientSession::attach_server_session(Http1ServerSession *ssession, bool transaction_done)
{
if (ssession) {
ink_assert(bound_ss == nullptr);
diff --git a/proxy/http/Http1ClientSession.h b/proxy/http/Http1ClientSession.h
index 054638b..f6a1de0 100644
--- a/proxy/http/Http1ClientSession.h
+++ b/proxy/http/Http1ClientSession.h
@@ -44,15 +44,15 @@ extern ink_mutex debug_cs_list_mutex;
#endif
class HttpSM;
-class HttpServerSession;
+class Http1ServerSession;
-class Http1ClientSession : public ProxyClientSession
+class Http1ClientSession : public ProxySession
{
public:
- typedef ProxyClientSession super; ///< Parent type.
+ typedef ProxySession super; ///< Parent type.
Http1ClientSession();
- // Implement ProxyClientSession interface.
+ // Implement ProxySession interface.
void destroy() override;
void free() override;
void release_transaction();
@@ -119,11 +119,11 @@ public:
}
// Indicate we are done with a transaction
- void release(ProxyClientTransaction *trans) override;
+ void release(ProxyTransaction *trans) override;
- void attach_server_session(HttpServerSession *ssession, bool transaction_done = true) override;
+ void attach_server_session(Http1ServerSession *ssession, bool transaction_done = true) override;
- HttpServerSession *
+ Http1ServerSession *
get_server_session() const override
{
return bound_ss;
@@ -196,7 +196,7 @@ private:
VIO *ka_vio = nullptr;
VIO *slave_ka_vio = nullptr;
- HttpServerSession *bound_ss = nullptr;
+ Http1ServerSession *bound_ss = nullptr;
int released_transactions = 0;
@@ -209,7 +209,7 @@ public:
/// Transparently pass-through non-HTTP traffic.
bool f_transparent_passthrough = false;
- Http1ClientTransaction trans;
+ Http1Transaction trans;
};
extern ClassAllocator<Http1ClientSession> http1ClientSessionAllocator;
diff --git a/proxy/http/Http1ServerSession.cc b/proxy/http/Http1ServerSession.cc
index bf8c495..67fa0c3 100644
--- a/proxy/http/Http1ServerSession.cc
+++ b/proxy/http/Http1ServerSession.cc
@@ -37,10 +37,10 @@
#include "HttpSM.h"
static int64_t next_ss_id = static_cast<int64_t>(0);
-ClassAllocator<HttpServerSession> httpServerSessionAllocator("httpServerSessionAllocator");
+ClassAllocator<Http1ServerSession> httpServerSessionAllocator("httpServerSessionAllocator");
void
-HttpServerSession::destroy()
+Http1ServerSession::destroy()
{
ink_release_assert(server_vc == nullptr);
ink_assert(read_buffer);
@@ -60,7 +60,7 @@ HttpServerSession::destroy()
}
void
-HttpServerSession::new_connection(NetVConnection *new_vc)
+Http1ServerSession::new_connection(NetVConnection *new_vc)
{
ink_assert(new_vc != nullptr);
server_vc = new_vc;
@@ -85,7 +85,7 @@ HttpServerSession::new_connection(NetVConnection *new_vc)
}
void
-HttpServerSession::enable_outbound_connection_tracking(OutboundConnTrack::Group *group)
+Http1ServerSession::enable_outbound_connection_tracking(OutboundConnTrack::Group *group)
{
ink_assert(nullptr == conn_track_group);
conn_track_group = group;
@@ -97,25 +97,25 @@ HttpServerSession::enable_outbound_connection_tracking(OutboundConnTrack::Group
}
VIO *
-HttpServerSession::do_io_read(Continuation *c, int64_t nbytes, MIOBuffer *buf)
+Http1ServerSession::do_io_read(Continuation *c, int64_t nbytes, MIOBuffer *buf)
{
return server_vc ? server_vc->do_io_read(c, nbytes, buf) : nullptr;
}
VIO *
-HttpServerSession::do_io_write(Continuation *c, int64_t nbytes, IOBufferReader *buf, bool owner)
+Http1ServerSession::do_io_write(Continuation *c, int64_t nbytes, IOBufferReader *buf, bool owner)
{
return server_vc ? server_vc->do_io_write(c, nbytes, buf, owner) : nullptr;
}
void
-HttpServerSession::do_io_shutdown(ShutdownHowTo_t howto)
+Http1ServerSession::do_io_shutdown(ShutdownHowTo_t howto)
{
server_vc->do_io_shutdown(howto);
}
void
-HttpServerSession::do_io_close(int alerrno)
+Http1ServerSession::do_io_close(int alerrno)
{
ts::LocalBufferWriter<256> w;
bool debug_p = is_debug_tag_set("http_ss");
@@ -160,17 +160,17 @@ HttpServerSession::do_io_close(int alerrno)
}
void
-HttpServerSession::reenable(VIO *vio)
+Http1ServerSession::reenable(VIO *vio)
{
server_vc->reenable(vio);
}
-// void HttpServerSession::release()
+// void Http1ServerSession::release()
//
// Releases the session for K-A reuse
//
void
-HttpServerSession::release()
+Http1ServerSession::release()
{
Debug("http_ss", "Releasing session, private_session=%d, sharing_match=%d", private_session, sharing_match);
// Set our state to KA for stat issues
diff --git a/proxy/http/Http1ServerSession.h b/proxy/http/Http1ServerSession.h
index 068c536..e1851ef 100644
--- a/proxy/http/Http1ServerSession.h
+++ b/proxy/http/Http1ServerSession.h
@@ -53,14 +53,14 @@ enum {
HTTP_SS_MAGIC_DEAD = 0xDEADFEED,
};
-class HttpServerSession : public VConnection
+class Http1ServerSession : public VConnection
{
- using self_type = HttpServerSession;
+ using self_type = Http1ServerSession;
using super_type = VConnection;
public:
- HttpServerSession() : super_type(nullptr) {}
- HttpServerSession(self_type const &) = delete;
+ Http1ServerSession() : super_type(nullptr) {}
+ Http1ServerSession(self_type const &) = delete;
self_type &operator=(self_type const &) = delete;
void destroy();
@@ -149,8 +149,8 @@ public:
static sockaddr const *key_of(self_type const *ssn);
static bool equal(sockaddr const *lhs, sockaddr const *rhs);
// Add a couple overloads for internal convenience.
- static bool equal(sockaddr const *lhs, HttpServerSession const *rhs);
- static bool equal(HttpServerSession const *lhs, sockaddr const *rhs);
+ static bool equal(sockaddr const *lhs, Http1ServerSession const *rhs);
+ static bool equal(Http1ServerSession const *lhs, sockaddr const *rhs);
} _ip_link;
/// Hash map descriptor class for FQDN map.
@@ -199,86 +199,86 @@ private:
IOBufferReader *buf_reader = nullptr;
};
-extern ClassAllocator<HttpServerSession> httpServerSessionAllocator;
+extern ClassAllocator<Http1ServerSession> httpServerSessionAllocator;
// --- Implementation ---
inline void
-HttpServerSession::attach_hostname(const char *hostname)
+Http1ServerSession::attach_hostname(const char *hostname)
{
if (CRYPTO_HASH_ZERO == hostname_hash) {
CryptoContext().hash_immediate(hostname_hash, (unsigned char *)hostname, strlen(hostname));
}
}
-inline HttpServerSession *&
-HttpServerSession::IPLinkage::next_ptr(self_type *ssn)
+inline Http1ServerSession *&
+Http1ServerSession::IPLinkage::next_ptr(self_type *ssn)
{
return ssn->_ip_link._next;
}
-inline HttpServerSession *&
-HttpServerSession::IPLinkage::prev_ptr(self_type *ssn)
+inline Http1ServerSession *&
+Http1ServerSession::IPLinkage::prev_ptr(self_type *ssn)
{
return ssn->_ip_link._prev;
}
inline uint32_t
-HttpServerSession::IPLinkage::hash_of(sockaddr const *key)
+Http1ServerSession::IPLinkage::hash_of(sockaddr const *key)
{
return ats_ip_hash(key);
}
inline sockaddr const *
-HttpServerSession::IPLinkage::key_of(self_type const *ssn)
+Http1ServerSession::IPLinkage::key_of(self_type const *ssn)
{
return &ssn->get_server_ip().sa;
}
inline bool
-HttpServerSession::IPLinkage::equal(sockaddr const *lhs, sockaddr const *rhs)
+Http1ServerSession::IPLinkage::equal(sockaddr const *lhs, sockaddr const *rhs)
{
return ats_ip_addr_port_eq(lhs, rhs);
}
inline bool
-HttpServerSession::IPLinkage::equal(sockaddr const *lhs, HttpServerSession const *rhs)
+Http1ServerSession::IPLinkage::equal(sockaddr const *lhs, Http1ServerSession const *rhs)
{
return ats_ip_addr_port_eq(lhs, key_of(rhs));
}
inline bool
-HttpServerSession::IPLinkage::equal(HttpServerSession const *lhs, sockaddr const *rhs)
+Http1ServerSession::IPLinkage::equal(Http1ServerSession const *lhs, sockaddr const *rhs)
{
return ats_ip_addr_port_eq(key_of(lhs), rhs);
}
-inline HttpServerSession *&
-HttpServerSession::FQDNLinkage::next_ptr(self_type *ssn)
+inline Http1ServerSession *&
+Http1ServerSession::FQDNLinkage::next_ptr(self_type *ssn)
{
return ssn->_fqdn_link._next;
}
-inline HttpServerSession *&
-HttpServerSession::FQDNLinkage::prev_ptr(self_type *ssn)
+inline Http1ServerSession *&
+Http1ServerSession::FQDNLinkage::prev_ptr(self_type *ssn)
{
return ssn->_fqdn_link._prev;
}
inline uint64_t
-HttpServerSession::FQDNLinkage::hash_of(CryptoHash const &key)
+Http1ServerSession::FQDNLinkage::hash_of(CryptoHash const &key)
{
return key.fold();
}
inline CryptoHash const &
-HttpServerSession::FQDNLinkage::key_of(self_type *ssn)
+Http1ServerSession::FQDNLinkage::key_of(self_type *ssn)
{
return ssn->hostname_hash;
}
inline bool
-HttpServerSession::FQDNLinkage::equal(CryptoHash const &lhs, CryptoHash const &rhs)
+Http1ServerSession::FQDNLinkage::equal(CryptoHash const &lhs, CryptoHash const &rhs)
{
return lhs == rhs;
}
diff --git a/proxy/http/Http1Transaction.cc b/proxy/http/Http1Transaction.cc
index 8e5e7b2..6a83036 100644
--- a/proxy/http/Http1Transaction.cc
+++ b/proxy/http/Http1Transaction.cc
@@ -26,15 +26,15 @@
#include "HttpSM.h"
void
-Http1ClientTransaction::release(IOBufferReader *r)
+Http1Transaction::release(IOBufferReader *r)
{
// Must set this inactivity count here rather than in the session because the state machine
// is not available then
MgmtInt ka_in = current_reader->t_state.txn_conf->keep_alive_no_activity_timeout_in;
set_inactivity_timeout(HRTIME_SECONDS(ka_in));
- parent->clear_session_active();
- parent->ssn_last_txn_time = Thread::get_hrtime();
+ proxy_ssn->clear_session_active();
+ proxy_ssn->ssn_last_txn_time = Thread::get_hrtime();
// Make sure that the state machine is returning
// correct buffer reader
@@ -47,7 +47,7 @@ Http1ClientTransaction::release(IOBufferReader *r)
}
void
-Http1ClientTransaction::set_parent(ProxyClientSession *new_parent)
+Http1Transaction::set_parent(ProxySession *new_parent)
{
Http1ClientSession *http1_parent = dynamic_cast<Http1ClientSession *>(new_parent);
@@ -58,37 +58,37 @@ Http1ClientTransaction::set_parent(ProxyClientSession *new_parent)
outbound_transparent = http1_parent->f_outbound_transparent;
super_type::set_parent(new_parent);
} else {
- parent = nullptr;
+ proxy_ssn = nullptr;
}
}
void
-Http1ClientTransaction::transaction_done()
+Http1Transaction::transaction_done()
{
- if (parent) {
- static_cast<Http1ClientSession *>(parent)->release_transaction();
+ if (proxy_ssn) {
+ static_cast<Http1ClientSession *>(proxy_ssn)->release_transaction();
}
}
bool
-Http1ClientTransaction::allow_half_open() const
+Http1Transaction::allow_half_open() const
{
bool config_allows_it = (current_reader) ? current_reader->t_state.txn_conf->allow_half_open > 0 : true;
if (config_allows_it) {
// Check with the session to make sure the underlying transport allows the half open scenario
- return static_cast<Http1ClientSession *>(parent)->allow_half_open();
+ return static_cast<Http1ClientSession *>(proxy_ssn)->allow_half_open();
}
return false;
}
void
-Http1ClientTransaction::increment_client_transactions_stat()
+Http1Transaction::increment_client_transactions_stat()
{
HTTP_INCREMENT_DYN_STAT(http_current_client_transactions_stat);
}
void
-Http1ClientTransaction::decrement_client_transactions_stat()
+Http1Transaction::decrement_client_transactions_stat()
{
HTTP_DECREMENT_DYN_STAT(http_current_client_transactions_stat);
}
diff --git a/proxy/http/Http1Transaction.h b/proxy/http/Http1Transaction.h
index 1ee628d..4664853 100644
--- a/proxy/http/Http1Transaction.h
+++ b/proxy/http/Http1Transaction.h
@@ -27,33 +27,33 @@
class Continuation;
-class Http1ClientTransaction : public ProxyClientTransaction
+class Http1Transaction : public ProxyTransaction
{
public:
- using super_type = ProxyClientTransaction;
+ using super_type = ProxyTransaction;
- Http1ClientTransaction() {}
+ Http1Transaction() {}
// Implement VConnection interface.
VIO *
do_io_read(Continuation *c, int64_t nbytes = INT64_MAX, MIOBuffer *buf = nullptr) override
{
- return parent->do_io_read(c, nbytes, buf);
+ return proxy_ssn->do_io_read(c, nbytes, buf);
}
VIO *
do_io_write(Continuation *c = nullptr, int64_t nbytes = INT64_MAX, IOBufferReader *buf = nullptr, bool owner = false) override
{
- return parent->do_io_write(c, nbytes, buf, owner);
+ return proxy_ssn->do_io_write(c, nbytes, buf, owner);
}
void
do_io_close(int lerrno = -1) override
{
- parent->do_io_close(lerrno);
+ proxy_ssn->do_io_close(lerrno);
// this->destroy(); Parent owns this data structure. No need for separate destroy.
}
// Don't destroy your elements. Rely on the Http1ClientSession to clean up the
- // Http1ClientTransaction class as necessary. The super::destroy() clears the
+ // Http1Transaction class as necessary. The super::destroy() clears the
// mutex, which Http1ClientSession owns.
void
destroy() override
@@ -64,13 +64,13 @@ public:
void
do_io_shutdown(ShutdownHowTo_t howto) override
{
- parent->do_io_shutdown(howto);
+ proxy_ssn->do_io_shutdown(howto);
}
void
reenable(VIO *vio) override
{
- parent->reenable(vio);
+ proxy_ssn->reenable(vio);
}
void
@@ -83,7 +83,7 @@ public:
bool allow_half_open() const override;
- void set_parent(ProxyClientSession *new_parent) override;
+ void set_parent(ProxySession *new_parent) override;
bool
is_outbound_transparent() const override
@@ -100,20 +100,20 @@ public:
void
set_active_timeout(ink_hrtime timeout_in) override
{
- if (parent)
- parent->set_active_timeout(timeout_in);
+ if (proxy_ssn)
+ proxy_ssn->set_active_timeout(timeout_in);
}
void
set_inactivity_timeout(ink_hrtime timeout_in) override
{
- if (parent)
- parent->set_inactivity_timeout(timeout_in);
+ if (proxy_ssn)
+ proxy_ssn->set_inactivity_timeout(timeout_in);
}
void
cancel_inactivity_timeout() override
{
- if (parent)
- parent->cancel_inactivity_timeout();
+ if (proxy_ssn)
+ proxy_ssn->cancel_inactivity_timeout();
}
void transaction_done() override;
@@ -124,7 +124,7 @@ public:
// presumed not to increase during the lifetime of a transaction, thus this function will return a consistent unique transaction
// identifier.
//
- return get_transact_count();
+ return proxy_ssn->get_transact_count();
}
void increment_client_transactions_stat() override;
diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index 24fd71e..8ef4391 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -443,7 +443,7 @@ HttpSM::start_sub_sm()
}
void
-HttpSM::attach_client_session(ProxyClientTransaction *client_vc, IOBufferReader *buffer_reader)
+HttpSM::attach_client_session(ProxyTransaction *client_vc, IOBufferReader *buffer_reader)
{
milestones[TS_MILESTONE_UA_BEGIN] = Thread::get_hrtime();
ink_assert(client_vc != nullptr);
@@ -644,7 +644,7 @@ HttpSM::state_read_client_request_header(int event, void *data)
// Reset the inactivity timeout if this is the first
// time we've been called. The timeout had been set to
- // the accept timeout by the ProxyClientTransaction
+ // the accept timeout by the ProxyTransaction
//
if ((ua_buffer_reader->read_avail() > 0) && (client_request_hdr_bytes == 0)) {
milestones[TS_MILESTONE_UA_FIRST_READ] = Thread::get_hrtime();
@@ -1719,9 +1719,10 @@ HttpSM::state_http_server_open(int event, void *data)
switch (event) {
case NET_EVENT_OPEN: {
- HttpServerSession *session = (TS_SERVER_SESSION_SHARING_POOL_THREAD == t_state.http_config_param->server_session_sharing_pool) ?
- THREAD_ALLOC_INIT(httpServerSessionAllocator, mutex->thread_holding) :
- httpServerSessionAllocator.alloc();
+ Http1ServerSession *session =
+ (TS_SERVER_SESSION_SHARING_POOL_THREAD == t_state.http_config_param->server_session_sharing_pool) ?
+ THREAD_ALLOC_INIT(httpServerSessionAllocator, mutex->thread_holding) :
+ httpServerSessionAllocator.alloc();
session->sharing_pool = static_cast<TSServerSessionSharingPoolType>(t_state.http_config_param->server_session_sharing_pool);
session->sharing_match = static_cast<TSServerSessionSharingMatchType>(t_state.txn_conf->server_session_sharing_match);
@@ -4880,7 +4881,7 @@ HttpSM::do_http_server_open(bool raw)
// session when we already have an attached server session.
else if ((TS_SERVER_SESSION_SHARING_MATCH_NONE == t_state.txn_conf->server_session_sharing_match || is_private()) &&
(ua_txn != nullptr)) {
- HttpServerSession *existing_ss = ua_txn->get_server_session();
+ Http1ServerSession *existing_ss = ua_txn->get_server_session();
if (existing_ss) {
// [amc] Not sure if this is the best option, but we don't get here unless session sharing is disabled
@@ -4907,7 +4908,7 @@ HttpSM::do_http_server_open(bool raw)
// to get a new one.
// ua_txn is null when t_state.req_flavor == REQ_FLAVOR_SCHEDULED_UPDATE
else if (ua_txn != nullptr) {
- HttpServerSession *existing_ss = ua_txn->get_server_session();
+ Http1ServerSession *existing_ss = ua_txn->get_server_session();
if (existing_ss) {
existing_ss->get_netvc()->set_inactivity_timeout(HRTIME_SECONDS(t_state.txn_conf->keep_alive_no_activity_timeout_out));
existing_ss->release();
@@ -5876,7 +5877,7 @@ HttpSM::write_header_into_buffer(HTTPHdr *h, MIOBuffer *b)
}
void
-HttpSM::attach_server_session(HttpServerSession *s)
+HttpSM::attach_server_session(Http1ServerSession *s)
{
hsm_release_assert(server_session == nullptr);
hsm_release_assert(server_entry == nullptr);
@@ -7948,7 +7949,7 @@ HttpSM::is_private()
if (server_session) {
res = server_session->private_session;
} else if (ua_txn) {
- HttpServerSession *ss = ua_txn->get_server_session();
+ Http1ServerSession *ss = ua_txn->get_server_session();
if (ss) {
res = ss->private_session;
} else if (will_be_private_ss) {
diff --git a/proxy/http/HttpSM.h b/proxy/http/HttpSM.h
index 10d5e4b..95ca9d8 100644
--- a/proxy/http/HttpSM.h
+++ b/proxy/http/HttpSM.h
@@ -59,7 +59,7 @@ static size_t const HTTP_HEADER_BUFFER_SIZE_INDEX = CLIENT_CONNECTION_FIRST_READ
// the larger buffer size
static size_t const HTTP_SERVER_RESP_HDR_BUFFER_INDEX = BUFFER_SIZE_INDEX_8K;
-class HttpServerSession;
+class Http1ServerSession;
class AuthHttpAdapter;
class HttpSM;
@@ -215,22 +215,22 @@ public:
void init();
- void attach_client_session(ProxyClientTransaction *client_vc_arg, IOBufferReader *buffer_reader);
+ void attach_client_session(ProxyTransaction *client_vc_arg, IOBufferReader *buffer_reader);
// Called by httpSessionManager so that we can reset
// the session timeouts and initiate a read while
// holding the lock for the server session
- void attach_server_session(HttpServerSession *s);
+ void attach_server_session(Http1ServerSession *s);
// Used to read attributes of
// the current active server session
- HttpServerSession *
+ Http1ServerSession *
get_server_session()
{
return server_session;
}
- ProxyClientTransaction *
+ ProxyTransaction *
get_ua_txn()
{
return ua_txn;
@@ -350,7 +350,7 @@ protected:
void remove_ua_entry();
public:
- ProxyClientTransaction *ua_txn = nullptr;
+ ProxyTransaction *ua_txn = nullptr;
BackgroundFill_t background_fill = BACKGROUND_FILL_NONE;
// AuthHttpAdapter authAdapter;
void set_http_schedule(Continuation *);
@@ -362,8 +362,8 @@ protected:
IOBufferReader *ua_buffer_reader = nullptr;
IOBufferReader *ua_raw_buffer_reader = nullptr;
- HttpVCTableEntry *server_entry = nullptr;
- HttpServerSession *server_session = nullptr;
+ HttpVCTableEntry *server_entry = nullptr;
+ Http1ServerSession *server_session = nullptr;
/* Because we don't want to take a session from a shared pool if we know that it will be private,
* but we cannot set it to private until we have an attached server session.
@@ -700,7 +700,7 @@ HttpSM::txn_hook_get(TSHttpHookID id)
inline bool
HttpSM::is_transparent_passthrough_allowed()
{
- return (t_state.client_info.is_transparent && ua_txn->is_transparent_passthrough_allowed() && ua_txn->get_transact_count() == 1);
+ return (t_state.client_info.is_transparent && ua_txn->is_transparent_passthrough_allowed() && ua_txn->is_first_transaction());
}
inline int64_t
diff --git a/proxy/http/HttpSessionManager.cc b/proxy/http/HttpSessionManager.cc
index b95a8ea..33033b2 100644
--- a/proxy/http/HttpSessionManager.cc
+++ b/proxy/http/HttpSessionManager.cc
@@ -57,13 +57,13 @@ ServerSessionPool::purge()
{
// @c do_io_close can free the instance which clears the intrusive links and breaks the iterator.
// Therefore @c do_io_close is called on a post-incremented iterator.
- m_ip_pool.apply([](HttpServerSession *ssn) -> void { ssn->do_io_close(); });
+ m_ip_pool.apply([](Http1ServerSession *ssn) -> void { ssn->do_io_close(); });
m_ip_pool.clear();
m_fqdn_pool.clear();
}
bool
-ServerSessionPool::match(HttpServerSession *ss, sockaddr const *addr, CryptoHash const &hostname_hash,
+ServerSessionPool::match(Http1ServerSession *ss, sockaddr const *addr, CryptoHash const &hostname_hash,
TSServerSessionSharingMatchType match_style)
{
return TS_SERVER_SESSION_SHARING_MATCH_NONE !=
@@ -93,7 +93,7 @@ ServerSessionPool::validate_sni(HttpSM *sm, NetVConnection *netvc)
HSMresult_t
ServerSessionPool::acquireSession(sockaddr const *addr, CryptoHash const &hostname_hash,
- TSServerSessionSharingMatchType match_style, HttpSM *sm, HttpServerSession *&to_return)
+ TSServerSessionSharingMatchType match_style, HttpSM *sm, Http1ServerSession *&to_return)
{
HSMresult_t zret = HSM_NOT_FOUND;
to_return = nullptr;
@@ -144,7 +144,7 @@ ServerSessionPool::acquireSession(sockaddr const *addr, CryptoHash const &hostna
}
void
-ServerSessionPool::releaseSession(HttpServerSession *ss)
+ServerSessionPool::releaseSession(Http1ServerSession *ss)
{
ss->state = HSS_KA_SHARED;
// Now we need to issue a read on the connection to detect
@@ -176,7 +176,7 @@ int
ServerSessionPool::eventHandler(int event, void *data)
{
NetVConnection *net_vc = nullptr;
- HttpServerSession *s = nullptr;
+ Http1ServerSession *s = nullptr;
switch (event) {
case VC_EVENT_READ_READY:
@@ -275,9 +275,9 @@ HttpSessionManager::purge_keepalives()
HSMresult_t
HttpSessionManager::acquire_session(Continuation * /* cont ATS_UNUSED */, sockaddr const *ip, const char *hostname,
- ProxyClientTransaction *ua_txn, HttpSM *sm)
+ ProxyTransaction *ua_txn, HttpSM *sm)
{
- HttpServerSession *to_return = nullptr;
+ Http1ServerSession *to_return = nullptr;
TSServerSessionSharingMatchType match_style =
static_cast<TSServerSessionSharingMatchType>(sm->t_state.txn_conf->server_session_sharing_match);
CryptoHash hostname_hash;
@@ -371,7 +371,7 @@ HttpSessionManager::acquire_session(Continuation * /* cont ATS_UNUSED */, sockad
}
HSMresult_t
-HttpSessionManager::release_session(HttpServerSession *to_release)
+HttpSessionManager::release_session(Http1ServerSession *to_release)
{
EThread *ethread = this_ethread();
ServerSessionPool *pool =
diff --git a/proxy/http/HttpSessionManager.h b/proxy/http/HttpSessionManager.h
index 2378494..3a6ff02 100644
--- a/proxy/http/HttpSessionManager.h
+++ b/proxy/http/HttpSessionManager.h
@@ -36,7 +36,7 @@
#include "Http1ServerSession.h"
#include "tscore/IntrusiveHashMap.h"
-class ProxyClientTransaction;
+class ProxyTransaction;
class HttpSM;
void initialize_thread_for_http_sessions(EThread *thread, int thread_index);
@@ -67,13 +67,13 @@ public:
static bool validate_sni(HttpSM *sm, NetVConnection *netvc);
protected:
- using IPTable = IntrusiveHashMap<HttpServerSession::IPLinkage>;
- using FQDNTable = IntrusiveHashMap<HttpServerSession::FQDNLinkage>;
+ using IPTable = IntrusiveHashMap<Http1ServerSession::IPLinkage>;
+ using FQDNTable = IntrusiveHashMap<Http1ServerSession::FQDNLinkage>;
public:
/** Check if a session matches address and host name.
*/
- static bool match(HttpServerSession *ss, sockaddr const *addr, CryptoHash const &host_hash,
+ static bool match(Http1ServerSession *ss, sockaddr const *addr, CryptoHash const &host_hash,
TSServerSessionSharingMatchType match_style);
/** Get a session from the pool.
@@ -84,10 +84,10 @@ public:
@return A pointer to the session or @c NULL if not matching session was found.
*/
HSMresult_t acquireSession(sockaddr const *addr, CryptoHash const &host_hash, TSServerSessionSharingMatchType match_style,
- HttpSM *sm, HttpServerSession *&server_session);
+ HttpSM *sm, Http1ServerSession *&server_session);
/** Release a session to to pool.
*/
- void releaseSession(HttpServerSession *ss);
+ void releaseSession(Http1ServerSession *ss);
/// Close all sessions and then clear the table.
void purge();
@@ -103,9 +103,8 @@ class HttpSessionManager
public:
HttpSessionManager() {}
~HttpSessionManager() {}
- HSMresult_t acquire_session(Continuation *cont, sockaddr const *addr, const char *hostname, ProxyClientTransaction *ua_txn,
- HttpSM *sm);
- HSMresult_t release_session(HttpServerSession *to_release);
+ HSMresult_t acquire_session(Continuation *cont, sockaddr const *addr, const char *hostname, ProxyTransaction *ua_txn, HttpSM *sm);
+ HSMresult_t release_session(Http1ServerSession *to_release);
void purge_keepalives();
void init();
int main_handler(int event, void *data);
diff --git a/proxy/http/HttpTunnel.cc b/proxy/http/HttpTunnel.cc
index 309cc2a..27eaab5 100644
--- a/proxy/http/HttpTunnel.cc
+++ b/proxy/http/HttpTunnel.cc
@@ -872,7 +872,7 @@ HttpTunnel::producer_run(HttpTunnelProducer *p)
// the amount to read since we know it. We will forward the FIN
// to the server on VC_EVENT_WRITE_COMPLETE.
if (p->vc_type == HT_HTTP_CLIENT) {
- ProxyClientTransaction *ua_vc = static_cast<ProxyClientTransaction *>(p->vc);
+ ProxyTransaction *ua_vc = static_cast<ProxyTransaction *>(p->vc);
if (ua_vc->get_half_close_flag()) {
c_write = c->buffer_reader->read_avail();
p->alive = false;
diff --git a/proxy/http2/Http2ClientSession.cc b/proxy/http2/Http2ClientSession.cc
index a666af6..31be2e8 100644
--- a/proxy/http2/Http2ClientSession.cc
+++ b/proxy/http2/Http2ClientSession.cc
@@ -179,7 +179,7 @@ Http2ClientSession::new_connection(NetVConnection *new_vc, MIOBuffer *iobuf, IOB
HTTP2_INCREMENT_THREAD_DYN_STAT(HTTP2_STAT_TOTAL_CLIENT_CONNECTION_COUNT, new_vc->mutex->thread_holding);
// Unique client session identifier.
- this->con_id = ProxyClientSession::next_connection_id();
+ this->con_id = ProxySession::next_connection_id();
this->client_vc = new_vc;
client_vc->set_inactivity_timeout(HRTIME_SECONDS(Http2::accept_no_activity_timeout));
this->schedule_event = nullptr;
diff --git a/proxy/http2/Http2ClientSession.h b/proxy/http2/Http2ClientSession.h
index ed7f017..257f418 100644
--- a/proxy/http2/Http2ClientSession.h
+++ b/proxy/http2/Http2ClientSession.h
@@ -149,15 +149,15 @@ private:
IOBufferReader *ioreader = nullptr;
};
-class Http2ClientSession : public ProxyClientSession
+class Http2ClientSession : public ProxySession
{
public:
- typedef ProxyClientSession super; ///< Parent type.
+ typedef ProxySession super; ///< Parent type.
typedef int (Http2ClientSession::*SessionHandler)(int, void *);
Http2ClientSession();
- // Implement ProxyClientSession interface.
+ // Implement ProxySession interface.
void start() override;
void destroy() override;
void free() override;
@@ -216,7 +216,7 @@ public:
}
void
- release(ProxyClientTransaction *trans) override
+ release(ProxyTransaction *trans) override
{
}
diff --git a/proxy/http2/Http2Stream.cc b/proxy/http2/Http2Stream.cc
index 77011cb..1006362 100644
--- a/proxy/http2/Http2Stream.cc
+++ b/proxy/http2/Http2Stream.cc
@@ -32,7 +32,7 @@
}
#define Http2StreamDebug(fmt, ...) \
- SsnDebug(parent, "http2_stream", "[%" PRId64 "] [%u] " fmt, parent->connection_id(), this->get_id(), ##__VA_ARGS__);
+ SsnDebug(proxy_ssn, "http2_stream", "[%" PRId64 "] [%u] " fmt, proxy_ssn->connection_id(), this->get_id(), ##__VA_ARGS__);
ClassAllocator<Http2Stream> http2StreamAllocator("http2StreamAllocator");
@@ -333,10 +333,10 @@ Http2Stream::do_io_close(int /* flags */)
// by the time this is called from transaction_done.
closed = true;
- if (parent && this->is_client_state_writeable()) {
+ if (proxy_ssn && this->is_client_state_writeable()) {
// Make sure any trailing end of stream frames are sent
// Wee will be removed at send_data_frames or closing connection phase
- static_cast<Http2ClientSession *>(parent)->connection_state.send_data_frames(this);
+ static_cast<Http2ClientSession *>(proxy_ssn)->connection_state.send_data_frames(this);
}
clear_timers();
@@ -359,9 +359,9 @@ Http2Stream::transaction_done()
}
if (!closed) {
- do_io_close(); // Make sure we've been closed. If we didn't close the parent session better still be open
+ do_io_close(); // Make sure we've been closed. If we didn't close the proxy_ssn session better still be open
}
- ink_release_assert(closed || !static_cast<Http2ClientSession *>(parent)->connection_state.is_state_closed());
+ ink_release_assert(closed || !static_cast<Http2ClientSession *>(proxy_ssn)->connection_state.is_state_closed());
current_reader = nullptr;
if (closed) {
@@ -379,7 +379,7 @@ Http2Stream::terminate_if_possible()
if (terminate_stream && reentrancy_count == 0) {
REMEMBER(NO_EVENT, this->reentrancy_count);
- Http2ClientSession *h2_parent = static_cast<Http2ClientSession *>(parent);
+ Http2ClientSession *h2_parent = static_cast<Http2ClientSession *>(proxy_ssn);
SCOPED_MUTEX_LOCK(lock, h2_parent->connection_state.mutex, this_ethread());
h2_parent->connection_state.delete_stream(this);
destroy();
@@ -404,7 +404,7 @@ Http2Stream::initiating_close()
// current_reader = NULL;
// Leaving reference to client session as well, so we can signal once the
// TXN_CLOSE has been sent
- // parent = NULL;
+ // proxy_ssn = NULL;
clear_timers();
clear_io_events();
@@ -471,7 +471,7 @@ Http2Stream::send_tracked_event(Event *event, int send_event, VIO *vio)
void
Http2Stream::update_read_request(int64_t read_len, bool call_update, bool check_eos)
{
- if (closed || parent == nullptr || current_reader == nullptr || read_vio.mutex == nullptr) {
+ if (closed || proxy_ssn == nullptr || current_reader == nullptr || read_vio.mutex == nullptr) {
return;
}
@@ -533,7 +533,7 @@ Http2Stream::restart_sending()
void
Http2Stream::update_write_request(IOBufferReader *buf_reader, int64_t write_len, bool call_update)
{
- if (!this->is_client_state_writeable() || closed || parent == nullptr || write_vio.mutex == nullptr ||
+ if (!this->is_client_state_writeable() || closed || proxy_ssn == nullptr || write_vio.mutex == nullptr ||
(buf_reader == nullptr && write_len == 0)) {
return;
}
@@ -544,7 +544,7 @@ Http2Stream::update_write_request(IOBufferReader *buf_reader, int64_t write_len,
}
ink_release_assert(this->_thread == this_ethread());
- Http2ClientSession *parent = static_cast<Http2ClientSession *>(this->get_parent());
+ Http2ClientSession *proxy_ssn = static_cast<Http2ClientSession *>(this->get_parent());
SCOPED_MUTEX_LOCK(lock, write_vio.mutex, this_ethread());
@@ -600,17 +600,17 @@ Http2Stream::update_write_request(IOBufferReader *buf_reader, int64_t write_len,
int len;
const char *value = field->value_get(&len);
if (memcmp(HTTP_VALUE_CLOSE, value, HTTP_LEN_CLOSE) == 0) {
- SCOPED_MUTEX_LOCK(lock, parent->connection_state.mutex, this_ethread());
- if (parent->connection_state.get_shutdown_state() == HTTP2_SHUTDOWN_NONE) {
- parent->connection_state.set_shutdown_state(HTTP2_SHUTDOWN_NOT_INITIATED, Http2ErrorCode::HTTP2_ERROR_NO_ERROR);
+ SCOPED_MUTEX_LOCK(lock, proxy_ssn->connection_state.mutex, this_ethread());
+ if (proxy_ssn->connection_state.get_shutdown_state() == HTTP2_SHUTDOWN_NONE) {
+ proxy_ssn->connection_state.set_shutdown_state(HTTP2_SHUTDOWN_NOT_INITIATED, Http2ErrorCode::HTTP2_ERROR_NO_ERROR);
}
}
}
{
- SCOPED_MUTEX_LOCK(lock, parent->connection_state.mutex, this_ethread());
+ SCOPED_MUTEX_LOCK(lock, proxy_ssn->connection_state.mutex, this_ethread());
// Send the response header back
- parent->connection_state.send_headers_frame(this);
+ proxy_ssn->connection_state.send_headers_frame(this);
}
// See if the response is chunked. Set up the dechunking logic if it is
@@ -673,25 +673,25 @@ Http2Stream::signal_write_event(bool call_update)
void
Http2Stream::push_promise(URL &url, const MIMEField *accept_encoding)
{
- Http2ClientSession *parent = static_cast<Http2ClientSession *>(this->get_parent());
- SCOPED_MUTEX_LOCK(lock, parent->connection_state.mutex, this_ethread());
- parent->connection_state.send_push_promise_frame(this, url, accept_encoding);
+ Http2ClientSession *proxy_ssn = static_cast<Http2ClientSession *>(this->get_parent());
+ SCOPED_MUTEX_LOCK(lock, proxy_ssn->connection_state.mutex, this_ethread());
+ proxy_ssn->connection_state.send_push_promise_frame(this, url, accept_encoding);
}
void
Http2Stream::send_response_body(bool call_update)
{
- Http2ClientSession *parent = static_cast<Http2ClientSession *>(this->get_parent());
- inactive_timeout_at = Thread::get_hrtime() + inactive_timeout;
+ Http2ClientSession *proxy_ssn = static_cast<Http2ClientSession *>(this->get_parent());
+ inactive_timeout_at = Thread::get_hrtime() + inactive_timeout;
if (Http2::stream_priority_enabled) {
- SCOPED_MUTEX_LOCK(lock, parent->connection_state.mutex, this_ethread());
- parent->connection_state.schedule_stream(this);
+ SCOPED_MUTEX_LOCK(lock, proxy_ssn->connection_state.mutex, this_ethread());
+ proxy_ssn->connection_state.schedule_stream(this);
// signal_write_event() will be called from `Http2ConnectionState::send_data_frames_depends_on_priority()`
// when write_vio is consumed
} else {
- SCOPED_MUTEX_LOCK(lock, parent->connection_state.mutex, this_ethread());
- parent->connection_state.send_data_frames(this);
+ SCOPED_MUTEX_LOCK(lock, proxy_ssn->connection_state.mutex, this_ethread());
+ proxy_ssn->connection_state.send_data_frames(this);
this->signal_write_event(call_update);
// XXX The call to signal_write_event can destroy/free the Http2Stream.
// Don't modify the Http2Stream after calling this method.
@@ -701,7 +701,7 @@ Http2Stream::send_response_body(bool call_update)
void
Http2Stream::reenable(VIO *vio)
{
- if (this->parent) {
+ if (this->proxy_ssn) {
if (vio->op == VIO::WRITE) {
SCOPED_MUTEX_LOCK(lock, this->mutex, this_ethread());
update_write_request(vio->get_reader(), INT64_MAX, true);
@@ -723,8 +723,8 @@ Http2Stream::destroy()
ink_release_assert(reentrancy_count == 0);
// Safe to initiate SSN_CLOSE if this is the last stream
- if (parent) {
- Http2ClientSession *h2_parent = static_cast<Http2ClientSession *>(parent);
+ if (proxy_ssn) {
+ Http2ClientSession *h2_parent = static_cast<Http2ClientSession *>(proxy_ssn);
SCOPED_MUTEX_LOCK(lock, h2_parent->connection_state.mutex, this_ethread());
// Make sure the stream is removed from the stream list and priority tree
// In many cases, this has been called earlier, so this call is a no-op
diff --git a/proxy/http2/Http2Stream.h b/proxy/http2/Http2Stream.h
index f69b9b6..895f8e1 100644
--- a/proxy/http2/Http2Stream.h
+++ b/proxy/http2/Http2Stream.h
@@ -35,10 +35,10 @@ class Http2ConnectionState;
typedef Http2DependencyTree::Tree<Http2Stream *> DependencyTree;
-class Http2Stream : public ProxyClientTransaction
+class Http2Stream : public ProxyTransaction
{
public:
- typedef ProxyClientTransaction super; ///< Parent type.
+ typedef ProxyTransaction super; ///< Parent type.
Http2Stream(Http2StreamId sid = 0, ssize_t initial_rwnd = Http2::initial_window_size) : client_rwnd(initial_rwnd), _id(sid)
{
http_parser_init(&http_parser);
diff --git a/src/traffic_server/InkAPI.cc b/src/traffic_server/InkAPI.cc
index 45c53e0..096c2a8 100644
--- a/src/traffic_server/InkAPI.cc
+++ b/src/traffic_server/InkAPI.cc
@@ -4717,7 +4717,7 @@ TSHttpSsnHookAdd(TSHttpSsn ssnp, TSHttpHookID id, TSCont contp)
sdk_assert(sdk_sanity_check_continuation(contp) == TS_SUCCESS);
sdk_assert(sdk_sanity_check_hook_id(id) == TS_SUCCESS);
- ProxyClientSession *cs = reinterpret_cast<ProxyClientSession *>(ssnp);
+ ProxySession *cs = reinterpret_cast<ProxySession *>(ssnp);
cs->ssn_hook_append(id, (INKContInternal *)contp);
}
@@ -4726,28 +4726,28 @@ TSHttpSsnTransactionCount(TSHttpSsn ssnp)
{
sdk_assert(sdk_sanity_check_http_ssn(ssnp) == TS_SUCCESS);
- ProxyClientSession *cs = reinterpret_cast<ProxyClientSession *>(ssnp);
+ ProxySession *cs = reinterpret_cast<ProxySession *>(ssnp);
return cs->get_transact_count();
}
TSVConn
TSHttpSsnClientVConnGet(TSHttpSsn ssnp)
{
- ProxyClientSession *cs = reinterpret_cast<ProxyClientSession *>(ssnp);
+ ProxySession *cs = reinterpret_cast<ProxySession *>(ssnp);
return reinterpret_cast<TSVConn>(cs->get_netvc());
}
TSVConn
TSHttpSsnServerVConnGet(TSHttpSsn ssnp)
{
- HttpServerSession *ss = reinterpret_cast<HttpServerSession *>(ssnp);
+ Http1ServerSession *ss = reinterpret_cast<Http1ServerSession *>(ssnp);
return reinterpret_cast<TSVConn>(ss->get_netvc());
}
class TSHttpSsnCallback : public Continuation
{
public:
- TSHttpSsnCallback(ProxyClientSession *cs, TSEvent event) : Continuation(cs->mutex), m_cs(cs), m_event(event)
+ TSHttpSsnCallback(ProxySession *cs, TSEvent event) : Continuation(cs->mutex), m_cs(cs), m_event(event)
{
SET_HANDLER(&TSHttpSsnCallback::event_handler);
}
@@ -4761,7 +4761,7 @@ public:
}
private:
- ProxyClientSession *m_cs;
+ ProxySession *m_cs;
TSEvent m_event;
};
@@ -4770,8 +4770,8 @@ TSHttpSsnReenable(TSHttpSsn ssnp, TSEvent event)
{
sdk_assert(sdk_sanity_check_http_ssn(ssnp) == TS_SUCCESS);
- ProxyClientSession *cs = reinterpret_cast<ProxyClientSession *>(ssnp);
- EThread *eth = this_ethread();
+ ProxySession *cs = reinterpret_cast<ProxySession *>(ssnp);
+ EThread *eth = this_ethread();
// If this function is being executed on a thread created by the API
// which is DEDICATED, the continuation needs to be called back on a
@@ -5472,7 +5472,7 @@ TSHttpTxnTransformRespGet(TSHttpTxn txnp, TSMBuffer *bufp, TSMLoc *obj)
sockaddr const *
TSHttpSsnClientAddrGet(TSHttpSsn ssnp)
{
- ProxyClientSession *cs = reinterpret_cast<ProxyClientSession *>(ssnp);
+ ProxySession *cs = reinterpret_cast<ProxySession *>(ssnp);
if (cs == nullptr) {
return nullptr;
@@ -5491,7 +5491,7 @@ TSHttpTxnClientAddrGet(TSHttpTxn txnp)
sockaddr const *
TSHttpSsnIncomingAddrGet(TSHttpSsn ssnp)
{
- ProxyClientSession *cs = reinterpret_cast<ProxyClientSession *>(ssnp);
+ ProxySession *cs = reinterpret_cast<ProxySession *>(ssnp);
if (cs == nullptr) {
return nullptr;
@@ -5514,7 +5514,7 @@ TSHttpTxnOutgoingAddrGet(TSHttpTxn txnp)
HttpSM *sm = reinterpret_cast<HttpSM *>(txnp);
- HttpServerSession *ssn = sm->get_server_session();
+ Http1ServerSession *ssn = sm->get_server_session();
if (ssn == nullptr) {
return nullptr;
}
@@ -5632,7 +5632,7 @@ TSHttpTxnServerPacketMarkSet(TSHttpTxn txnp, int mark)
// change the mark on an active server session
if (nullptr != sm->ua_txn) {
- HttpServerSession *ssn = sm->ua_txn->get_server_session();
+ Http1ServerSession *ssn = sm->ua_txn->get_server_session();
if (nullptr != ssn) {
NetVConnection *vc = ssn->get_netvc();
if (vc != nullptr) {
@@ -5674,7 +5674,7 @@ TSHttpTxnServerPacketTosSet(TSHttpTxn txnp, int tos)
// change the tos on an active server session
if (nullptr != sm->ua_txn) {
- HttpServerSession *ssn = sm->ua_txn->get_server_session();
+ Http1ServerSession *ssn = sm->ua_txn->get_server_session();
if (nullptr != ssn) {
NetVConnection *vc = ssn->get_netvc();
if (vc != nullptr) {
@@ -5716,7 +5716,7 @@ TSHttpTxnServerPacketDscpSet(TSHttpTxn txnp, int dscp)
// change the tos on an active server session
if (nullptr != sm->ua_txn) {
- HttpServerSession *ssn = sm->ua_txn->get_server_session();
+ Http1ServerSession *ssn = sm->ua_txn->get_server_session();
if (nullptr != ssn) {
NetVConnection *vc = ssn->get_netvc();
if (vc != nullptr) {
@@ -6070,7 +6070,7 @@ TSHttpSsnArgSet(TSHttpSsn ssnp, int arg_idx, void *arg)
sdk_assert(sdk_sanity_check_http_ssn(ssnp) == TS_SUCCESS);
sdk_assert(arg_idx >= 0 && arg_idx < TS_HTTP_MAX_USER_ARG);
- ProxyClientSession *cs = reinterpret_cast<ProxyClientSession *>(ssnp);
+ ProxySession *cs = reinterpret_cast<ProxySession *>(ssnp);
cs->set_user_arg(arg_idx, arg);
}
@@ -6081,7 +6081,7 @@ TSHttpSsnArgGet(TSHttpSsn ssnp, int arg_idx)
sdk_assert(sdk_sanity_check_http_ssn(ssnp) == TS_SUCCESS);
sdk_assert(arg_idx >= 0 && arg_idx < TS_HTTP_MAX_USER_ARG);
- ProxyClientSession *cs = reinterpret_cast<ProxyClientSession *>(ssnp);
+ ProxySession *cs = reinterpret_cast<ProxySession *>(ssnp);
return cs->get_user_arg(arg_idx);
}
@@ -6216,14 +6216,14 @@ void
TSHttpSsnDebugSet(TSHttpSsn ssnp, int on)
{
sdk_assert(sdk_sanity_check_http_ssn(ssnp) == TS_SUCCESS);
- (reinterpret_cast<ProxyClientSession *>(ssnp))->set_debug(0 != on);
+ (reinterpret_cast<ProxySession *>(ssnp))->set_debug(0 != on);
}
int
TSHttpSsnDebugGet(TSHttpSsn ssnp)
{
sdk_assert(sdk_sanity_check_http_ssn(ssnp) == TS_SUCCESS);
- return (reinterpret_cast<ProxyClientSession *>(ssnp))->debug();
+ return (reinterpret_cast<ProxySession *>(ssnp))->debug();
}
int
@@ -7376,8 +7376,8 @@ TSHttpSsnClientFdGet(TSHttpSsn ssnp, int *fdp)
{
sdk_assert(sdk_sanity_check_null_ptr((void *)fdp) == TS_SUCCESS);
- VConnection *basecs = reinterpret_cast<VConnection *>(ssnp);
- ProxyClientSession *cs = dynamic_cast<ProxyClientSession *>(basecs);
+ VConnection *basecs = reinterpret_cast<VConnection *>(ssnp);
+ ProxySession *cs = dynamic_cast<ProxySession *>(basecs);
if (cs == nullptr) {
return TS_ERROR;
@@ -7410,7 +7410,7 @@ TSHttpTxnServerFdGet(TSHttpTxn txnp, int *fdp)
HttpSM *sm = reinterpret_cast<HttpSM *>(txnp);
*fdp = -1;
- HttpServerSession *ss = sm->get_server_session();
+ Http1ServerSession *ss = sm->get_server_session();
if (ss == nullptr) {
return TS_ERROR;
}
@@ -7778,7 +7778,7 @@ TSFetchRespHdrMLocGet(TSFetchSM fetch_sm)
int
TSHttpSsnIsInternal(TSHttpSsn ssnp)
{
- ProxyClientSession *cs = reinterpret_cast<ProxyClientSession *>(ssnp);
+ ProxySession *cs = reinterpret_cast<ProxySession *>(ssnp);
if (!cs) {
return 0;
@@ -9377,7 +9377,7 @@ int64_t
TSHttpSsnIdGet(TSHttpSsn ssnp)
{
sdk_assert(sdk_sanity_check_http_ssn(ssnp) == TS_SUCCESS);
- ProxyClientSession *cs = reinterpret_cast<ProxyClientSession *>(ssnp);
+ ProxySession *cs = reinterpret_cast<ProxySession *>(ssnp);
return cs->connection_id();
}
@@ -9407,8 +9407,8 @@ TSHttpSsnClientProtocolStackGet(TSHttpSsn ssnp, int n, const char **result, int
{
sdk_assert(sdk_sanity_check_http_ssn(ssnp) == TS_SUCCESS);
sdk_assert(n == 0 || result != nullptr);
- ProxyClientSession *cs = reinterpret_cast<ProxyClientSession *>(ssnp);
- int count = 0;
+ ProxySession *cs = reinterpret_cast<ProxySession *>(ssnp);
+ int count = 0;
if (cs && n > 0) {
auto mem = static_cast<std::string_view *>(alloca(sizeof(std::string_view) * n));
count = cs->populate_protocol(mem, n);
@@ -9440,7 +9440,7 @@ const char *
TSHttpSsnClientProtocolStackContains(TSHttpSsn ssnp, const char *tag)
{
sdk_assert(sdk_sanity_check_http_ssn(ssnp) == TS_SUCCESS);
- ProxyClientSession *cs = reinterpret_cast<ProxyClientSession *>(ssnp);
+ ProxySession *cs = reinterpret_cast<ProxySession *>(ssnp);
return cs->protocol_contains(std::string_view{tag});
}