#include <HttpClientSession.h>
Inherits ProxyClientSession.
Public Member Functions | |
HttpClientSession () | |
virtual void | destroy () |
virtual void | start () |
void | new_connection (NetVConnection *new_vc, MIOBuffer *iobuf, IOBufferReader *reader, bool backdoor) |
virtual VIO * | do_io_read (Continuation *c, int64_t nbytes=INT64_MAX, MIOBuffer *buf=0) |
Read data from the VConnection. | |
virtual VIO * | do_io_write (Continuation *c=NULL, int64_t nbytes=INT64_MAX, IOBufferReader *buf=0, bool owner=false) |
Write data to the VConnection. | |
virtual void | do_io_close (int lerrno=-1) |
Indicate that the VConnection is no longer needed. | |
virtual void | do_io_shutdown (ShutdownHowTo_t howto) |
Terminate one or both directions of the VConnection. | |
virtual void | reenable (VIO *vio) |
void | new_transaction () |
void | set_half_close_flag () |
virtual void | release (IOBufferReader *r) |
NetVConnection * | get_netvc () const |
virtual void | attach_server_session (HttpServerSession *ssession, bool transaction_done=true) |
HttpServerSession * | get_server_session () const |
HttpServerSession * | get_bound_ss () |
void | ssn_hook_append (TSHttpHookID id, INKContInternal *cont) |
void | ssn_hook_prepend (TSHttpHookID id, INKContInternal *cont) |
int | get_transact_count () const |
Data Fields | |
IpAddr | outbound_ip4 |
Local address for outbound connection. | |
IpAddr | outbound_ip6 |
Local address for outbound connection. | |
uint16_t | outbound_port |
Local port for outbound connection. | |
bool | f_outbound_transparent |
Set outbound connection to transparent. | |
bool | f_transparent_passthrough |
Transparently pass-through non-HTTP traffic. | |
HostResStyle | host_res_style |
DNS resolution preferences. | |
const AclRecord * | acl_record |
acl record - cache IpAllow::match() call | |
bool | m_active |
Definition at line 50 of file HttpClientSession.h.
HttpClientSession::HttpClientSession | ( | ) |
Definition at line 61 of file HttpClientSession.cc.
void HttpClientSession::attach_server_session | ( | HttpServerSession * | ssession, | |
bool | transaction_done = true | |||
) | [virtual] |
Definition at line 423 of file HttpClientSession.cc.
References NetVConnection::cancel_active_timeout(), NetVConnection::cancel_inactivity_timeout(), HttpServerSession::con_id, DebugHttpSsn, HttpServerSession::do_io_read(), HttpServerSession::do_io_write(), HttpServerSession::get_netvc(), HttpServerSession::get_reader(), HRTIME_SECONDS, http_current_active_client_connections_stat, HTTP_DECREMENT_DYN_STAT, ink_assert, INT64_MAX, OverridableHttpConfigParams::keep_alive_no_activity_timeout_out, m_active, IOBufferReader::read_avail(), HttpServerSession::read_buffer, SET_HANDLER, HttpServerSession::state, HttpSM::t_state, and HttpTransact::State::txn_conf.
Referenced by HttpSessionManager::acquire_session(), HttpSM::do_http_server_open(), HttpSM::release_server_session(), and HttpSM::tunnel_handler_server().
void HttpClientSession::destroy | ( | ) | [virtual] |
Implements ProxyClientSession.
Definition at line 74 of file HttpClientSession.cc.
References ProxyClientSession::cleanup(), debug_cs_list_mutex, DebugHttpSsn, free_MIOBuffer(), http_current_client_connections_stat, HTTP_DECREMENT_DYN_STAT, httpClientSessionAllocator, ink_assert, ink_mutex_acquire(), ink_mutex_release(), ink_release_assert, DLL< C, L >::remove(), this_thread(), and THREAD_FREE.
void HttpClientSession::do_io_close | ( | int | lerrno = -1 |
) | [virtual] |
Indicate that the VConnection is no longer needed.
Once the state machine has finished using this VConnection, it must call this function to indicate that the VConnection can be deallocated. After a close has been called, the VConnection and underlying processor must not send any more events related to this VConnection to the state machine. Likeswise, the state machine must not access the VConnection or any VIOs obtained from it after calling this method.
lerrno | indicates where a close is a normal close or an abort. The difference between a normal close and an abort depends on the underlying type of the VConnection. |
Implements VConnection.
Definition at line 245 of file HttpClientSession.cc.
References IOBufferReader::consume(), DebugHttpSsn, ProxyClientSession::do_api_callout(), NetVConnection::do_io_close(), NetVConnection::do_io_read(), NetVConnection::do_io_shutdown(), HRTIME_SECONDS, http_current_active_client_connections_stat, http_current_client_connections_stat, http_current_client_transactions_stat, HTTP_DECREMENT_DYN_STAT, HTTP_SUM_DYN_STAT, http_transactions_per_client_con, ink_assert, ink_release_assert, INT64_MAX, IO_SHUTDOWN_WRITE, OverridableHttpConfigParams::keep_alive_no_activity_timeout_out, m_active, IOBufferReader::read_avail(), HttpServerSession::release(), NetVConnection::set_active_timeout(), SET_HANDLER, HttpSM::t_state, TS_HTTP_SSN_CLOSE_HOOK, and HttpTransact::State::txn_conf.
Referenced by release(), and HttpSM::tunnel_handler_ua().
VIO * HttpClientSession::do_io_read | ( | Continuation * | c, | |
int64_t | nbytes = INT64_MAX , |
|||
MIOBuffer * | buf = 0 | |||
) | [virtual] |
Read data from the VConnection.
Called by a state machine to read data from the VConnection. Processors implementing read functionality take out lock, put new bytes on the buffer and call the continuation back before releasing the lock in order to enable the state machine to handle transfer schemes where the end of a given transaction is marked by a special character (ie: NNTP).
Possible Event Codes
On the callback to the continuation, the VConnection may use on of the following values for the event code:
Event code | Meaning |
VC_EVENT_READ_READY | Data has been added to the buffer or the buffer is full |
VC_EVENT_READ_COMPLETE | The amount of data indicated by 'nbytes' has been read into the buffer |
VC_EVENT_EOS | The stream being read from has been shutdown |
VC_EVENT_ERROR | An error occurred during the read |
c | Continuation to be called back with events. | |
nbytes | Number of bytes to read. If unknown, nbytes must be set to INT64_MAX. | |
buf | buffer to read into. |
Implements VConnection.
Definition at line 210 of file HttpClientSession.cc.
References NetVConnection::do_io_read().
Referenced by HttpSM::attach_client_session(), HttpSM::handle_post_failure(), release(), HttpSM::setup_client_read_request_header(), and HttpSM::setup_push_read_response_header().
void HttpClientSession::do_io_shutdown | ( | ShutdownHowTo_t | howto | ) | [virtual] |
Terminate one or both directions of the VConnection.
Indicates that one or both sides of the VConnection should be terminated. After this call is issued, no further I/O can be done on the specified direction of the connection. The processor must not send any further events (including timeout events) to the state machine, and the state machine must not use any VIOs from a shutdown direction of the connection. Even if both sides of a connection are shutdown, the state machine must still call do_io_close() when it wishes the VConnection to be deallocated.
Possible howto values
Value | Meaning |
IO_SHUTDOWN_READ | Indicates that this VConnection should not generate any more read events |
IO_SHUTDOWN_WRITE | Indicates that this VConnection should not generate any more write events |
IO_SHUTDOWN_READWRITE | Indicates that this VConnection should not generate any more read nor write events |
howto | Specifies which direction of the VConnection to shutdown. |
Implements VConnection.
Definition at line 239 of file HttpClientSession.cc.
References NetVConnection::do_io_shutdown().
VIO * HttpClientSession::do_io_write | ( | Continuation * | c = NULL , |
|
int64_t | nbytes = INT64_MAX , |
|||
IOBufferReader * | buf = 0 , |
|||
bool | owner = false | |||
) | [virtual] |
Write data to the VConnection.
This method is called by a state machine to write data to the VConnection.
Possible Event Codes
On the callback to the continuation, the VConnection may use on of the following event codes:
Event code | Meaning |
VC_EVENT_WRITE_READY | Data was written from the reader or there are no bytes available for the reader to write. |
VC_EVENT_WRITE_COMPLETE | The amount of data indicated by 'nbytes' has been written to the VConnection |
VC_EVENT_INACTIVITY_TIMEOUT | No activity was performed for a certain period. |
VC_EVENT_ACTIVE_TIMEOUT | Write operation continued beyond a time limit. |
VC_EVENT_ERROR | An error occurred during the write |
c | Continuation to be called back with events. | |
nbytes | Number of bytes to write. If unknown, nbytes must be set to INT64_MAX. | |
buf | Reader whose data is to be read from. | |
owner |
Implements VConnection.
Definition at line 216 of file HttpClientSession.cc.
References DebugHttpSsn, and NetVConnection::do_io_write().
Referenced by HttpSM::state_send_server_request_header().
HttpServerSession * HttpClientSession::get_bound_ss | ( | ) |
Definition at line 508 of file HttpClientSession.cc.
Referenced by HttpSM::tunnel_handler_ua().
NetVConnection* HttpClientSession::get_netvc | ( | ) | const [inline] |
Definition at line 76 of file HttpClientSession.h.
Referenced by HttpSM::attach_client_session(), HttpSM::do_http_server_open(), HttpSM::handle_api_return(), HttpTransact::HandleBlindTunnel(), HttpTransact::initialize_state_variables_from_request(), HttpSM::process_hostdb_info(), HttpSM::set_next_state(), HttpSM::state_read_client_request_header(), HttpSM::state_read_server_response_header(), HttpSM::state_send_server_request_header(), TSHttpIsInternalSession(), TSHttpSsnClientAddrGet(), TSHttpSsnClientFdGet(), TSHttpSsnIncomingAddrGet(), TSHttpSsnSSLConnectionGet(), TSHttpTxnClientPacketMarkSet(), TSHttpTxnClientPacketTosSet(), and HttpSM::update_stats().
HttpServerSession* HttpClientSession::get_server_session | ( | ) | const [inline] |
Definition at line 79 of file HttpClientSession.h.
Referenced by HttpSessionManager::acquire_session(), HttpSM::do_http_server_open(), HttpSM::is_private(), TSHttpTxnServerPacketMarkSet(), and TSHttpTxnServerPacketTosSet().
int HttpClientSession::get_transact_count | ( | ) | const [inline] |
Definition at line 88 of file HttpClientSession.h.
Referenced by HttpSM::is_transparent_passthrough_allowed(), and TSHttpSsnTransactionCount().
void HttpClientSession::new_connection | ( | NetVConnection * | new_vc, | |
MIOBuffer * | iobuf, | |||
IOBufferReader * | reader, | |||
bool | backdoor | |||
) | [virtual] |
Implements ProxyClientSession.
Definition at line 143 of file HttpClientSession.cc.
References MIOBuffer::alloc_reader(), NetVConnection::attributes, Ptr< T >::clear(), debug_cs_list_mutex, DebugHttpSsn, ProxyClientSession::do_api_callout(), NetVConnection::get_remote_addr(), ProxyClientSession::hooks_on, http_current_client_connections_stat, HTTP_HEADER_BUFFER_SIZE_INDEX, HTTP_INCREMENT_DYN_STAT, http_total_client_connections_ipv4_stat, http_total_client_connections_ipv6_stat, http_total_client_connections_stat, http_total_incoming_connections_stat, https_total_client_connections_stat, ink_assert, ink_mutex_acquire(), ink_mutex_release(), Continuation::mutex, MUTEX_TAKE_LOCK, MUTEX_TRY_LOCK, MUTEX_UNTAKE_LOCK, new_MIOBuffer, ProxyClientSession::next_connection_id(), DLL< C, L >::push(), this_ethread(), HttpProxyPort::TRANSPORT_SSL, and TS_HTTP_SSN_START_HOOK.
Referenced by HttpSessionAccept::accept().
void HttpClientSession::new_transaction | ( | ) |
Definition at line 122 of file HttpClientSession.cc.
References HttpSM::allocate(), HttpSM::attach_client_session(), DebugHttpSsn, PluginIdentity::getPluginId(), PluginIdentity::getPluginTag(), HttpSM::init(), ink_assert, HttpSM::plugin_id, HttpSM::plugin_tag, and HttpSM::sm_id.
void HttpClientSession::reenable | ( | VIO * | vio | ) | [virtual] |
Reimplemented from VConnection.
Definition at line 417 of file HttpClientSession.cc.
References NetVConnection::reenable().
void HttpClientSession::release | ( | IOBufferReader * | r | ) | [virtual] |
Definition at line 465 of file HttpClientSession.cc.
References NetVConnection::cancel_active_timeout(), DebugHttpSsn, do_io_close(), do_io_read(), HRTIME_SECONDS, http_current_active_client_connections_stat, http_current_client_transactions_stat, HTTP_DECREMENT_DYN_STAT, ink_assert, INT64_MAX, OverridableHttpConfigParams::keep_alive_no_activity_timeout_in, m_active, new_transaction(), IOBufferReader::read_avail(), SET_HANDLER, NetVConnection::set_inactivity_timeout(), HttpSM::sm_id, HttpSM::t_state, and HttpTransact::State::txn_conf.
Referenced by HttpSM::tunnel_handler_ua().
void HttpClientSession::set_half_close_flag | ( | ) | [inline] |
Definition at line 74 of file HttpClientSession.h.
Referenced by HttpSM::set_ua_half_close_flag(), and HttpSM::tunnel_handler_ua().
void HttpClientSession::ssn_hook_append | ( | TSHttpHookID | id, | |
INKContInternal * | cont | |||
) | [virtual] |
Reimplemented from ProxyClientSession.
Definition at line 104 of file HttpClientSession.cc.
References HttpSM::hooks_set.
Referenced by TSHttpSsnHookAdd().
void HttpClientSession::ssn_hook_prepend | ( | TSHttpHookID | id, | |
INKContInternal * | cont | |||
) | [virtual] |
Reimplemented from ProxyClientSession.
Definition at line 113 of file HttpClientSession.cc.
References HttpSM::hooks_set.
virtual void HttpClientSession::start | ( | ) | [inline, virtual] |
Implements ProxyClientSession.
Definition at line 58 of file HttpClientSession.h.
References new_transaction().
acl record - cache IpAllow::match() call
Definition at line 141 of file HttpClientSession.h.
Referenced by HttpSessionAccept::accept(), and HttpTransact::process_quick_http_filter().
Set outbound connection to transparent.
Definition at line 135 of file HttpClientSession.h.
Referenced by HttpSessionAccept::accept(), HttpSM::do_http_server_open(), HttpTransact::EndRemapRequest(), HttpTransact::initialize_state_variables_from_response(), TSHttpTxnOutgoingTransparencySet(), and HttpSM::tunnel_handler_server().
Transparently pass-through non-HTTP traffic.
Definition at line 137 of file HttpClientSession.h.
Referenced by HttpSessionAccept::accept(), and HttpSM::is_transparent_passthrough_allowed().
DNS resolution preferences.
Definition at line 139 of file HttpClientSession.h.
Referenced by HttpSessionAccept::accept(), HttpSM::do_hostdb_lookup(), HttpTransact::handle_response_from_server(), and HttpSM::state_hostdb_lookup().
Definition at line 147 of file HttpClientSession.h.
Referenced by attach_server_session(), do_io_close(), release(), and HttpSM::state_read_client_request_header().
Local address for outbound connection.
Definition at line 129 of file HttpClientSession.h.
Referenced by HttpSessionAccept::accept(), HttpSM::do_http_server_open(), and TSHttpTxnOutgoingAddrSet().
Local address for outbound connection.
Definition at line 131 of file HttpClientSession.h.
Referenced by HttpSessionAccept::accept(), HttpSM::do_http_server_open(), and TSHttpTxnOutgoingAddrSet().
uint16_t HttpClientSession::outbound_port |
Local port for outbound connection.
Definition at line 133 of file HttpClientSession.h.
Referenced by HttpSessionAccept::accept(), HttpSM::do_http_server_open(), and TSHttpTxnOutgoingAddrSet().