Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef _HTTP_CLIENT_SESSION_H_
00033 #define _HTTP_CLIENT_SESSION_H_
00034
00035 #include "libts.h"
00036 #include "P_Net.h"
00037 #include "InkAPIInternal.h"
00038 #include "HTTP.h"
00039 #include "HttpConfig.h"
00040 #include "IPAllow.h"
00041 #include "ProxyClientSession.h"
00042
00043 extern ink_mutex debug_cs_list_mutex;
00044
00045 class HttpSM;
00046 class HttpServerSession;
00047
00048 class SecurityContext;
00049
00050 class HttpClientSession: public ProxyClientSession
00051 {
00052 public:
00053 HttpClientSession();
00054
00055
00056 virtual void destroy();
00057
00058 virtual void start() {
00059 new_transaction();
00060 }
00061
00062 void new_connection(NetVConnection * new_vc, MIOBuffer * iobuf, IOBufferReader * reader, bool backdoor);
00063
00064
00065 virtual VIO *do_io_read(Continuation * c, int64_t nbytes = INT64_MAX, MIOBuffer * buf = 0);
00066 virtual VIO *do_io_write(Continuation * c = NULL, int64_t nbytes = INT64_MAX, IOBufferReader * buf = 0, bool owner = false);
00067
00068 virtual void do_io_close(int lerrno = -1);
00069 virtual void do_io_shutdown(ShutdownHowTo_t howto);
00070 virtual void reenable(VIO * vio);
00071
00072 void new_transaction();
00073
00074 void set_half_close_flag() { half_close = true; };
00075 virtual void release(IOBufferReader * r);
00076 NetVConnection *get_netvc() const { return client_vc; };
00077
00078 virtual void attach_server_session(HttpServerSession * ssession, bool transaction_done = true);
00079 HttpServerSession *get_server_session() const { return bound_ss; };
00080
00081
00082 HttpServerSession *get_bound_ss();
00083
00084
00085 void ssn_hook_append(TSHttpHookID id, INKContInternal * cont);
00086 void ssn_hook_prepend(TSHttpHookID id, INKContInternal * cont);
00087
00088 int get_transact_count() const { return transact_count; }
00089
00090 private:
00091 HttpClientSession(HttpClientSession &);
00092
00093 int state_keep_alive(int event, void *data);
00094 int state_slave_keep_alive(int event, void *data);
00095 int state_wait_for_close(int event, void *data);
00096 void set_tcp_init_cwnd();
00097
00098 enum C_Read_State
00099 {
00100 HCS_INIT,
00101 HCS_ACTIVE_READER,
00102 HCS_KEEP_ALIVE,
00103 HCS_HALF_CLOSED,
00104 HCS_CLOSED
00105 };
00106
00107 int64_t con_id;
00108 NetVConnection *client_vc;
00109 int magic;
00110 int transact_count;
00111 bool tcp_init_cwnd_set;
00112 bool half_close;
00113 bool conn_decrease;
00114
00115 HttpServerSession *bound_ss;
00116
00117 MIOBuffer *read_buffer;
00118 IOBufferReader *sm_reader;
00119 HttpSM *current_reader;
00120 C_Read_State read_state;
00121
00122 VIO *ka_vio;
00123 VIO *slave_ka_vio;
00124
00125 Link<HttpClientSession> debug_link;
00126
00127 public:
00128
00129 IpAddr outbound_ip4;
00130
00131 IpAddr outbound_ip6;
00132
00133 uint16_t outbound_port;
00134
00135 bool f_outbound_transparent;
00136
00137 bool f_transparent_passthrough;
00138
00139 HostResStyle host_res_style;
00140
00141 const AclRecord *acl_record;
00142
00143
00144
00145
00146
00147 bool m_active;
00148 };
00149
00150 extern ClassAllocator<HttpClientSession> httpClientSessionAllocator;
00151
00152 #endif