You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by am...@apache.org on 2010/11/30 02:43:06 UTC
svn commit: r1040383 [16/38] - in /trafficserver/traffic/branches/wccp: ./
build/ contrib/ contrib/perl/AdminClient/lib/Apache/TS/ example/
example/add-header/ example/app-template/ example/append-transform/
example/basic-auth/ example/blacklist-0/ exa...
Modified: trafficserver/traffic/branches/wccp/proxy/http2/HttpConfig.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/branches/wccp/proxy/http2/HttpConfig.h?rev=1040383&r1=1040382&r2=1040383&view=diff
==============================================================================
--- trafficserver/traffic/branches/wccp/proxy/http2/HttpConfig.h (original)
+++ trafficserver/traffic/branches/wccp/proxy/http2/HttpConfig.h Tue Nov 30 01:42:55 2010
@@ -60,6 +60,12 @@
#include "P_RecProcess.h"
+
+/* Some defines that might be candidates for configurable settings later.
+ */
+#define HTTP_SSN_TXN_MAX_USER_ARG 16 /* max number of user arguments for Transactions and Sessions */
+
+
/* Instead of enumerating the stats in DynamicStats.h, each module needs
to enumerate its stats separately and register them with librecords
*/
@@ -83,7 +89,14 @@ enum
http_ua_msecs_counts_errors_early_hangups_stat,
// Http Total Connections Stats
+ //
+ // it is assumed that this inequality will always be satisifed:
+ // http_total_client_connections_stat >=
+ // http_total_client_connections_ipv4_stat +
+ // http_total_client_connections_ipv6_stat
http_total_client_connections_stat,
+ http_total_client_connections_ipv4_stat,
+ http_total_client_connections_ipv6_stat,
http_total_server_connections_stat,
http_total_parent_proxy_connections_stat,
http_current_parent_proxy_connections_stat,
@@ -292,13 +305,51 @@ enum
http_cache_write_errors,
http_cache_read_errors,
- // jg specific stats
- http_jg_cache_hits_stat,
- http_jg_cache_misses_stat,
- http_jg_client_aborts_stat,
- http_jg_cache_hit_time_stat,
- http_jg_cache_miss_time_stat,
-
+ // status code stats
+ http_response_status_100_count_stat,
+ http_response_status_101_count_stat,
+ http_response_status_1xx_count_stat,
+ http_response_status_200_count_stat,
+ http_response_status_201_count_stat,
+ http_response_status_202_count_stat,
+ http_response_status_203_count_stat,
+ http_response_status_204_count_stat,
+ http_response_status_205_count_stat,
+ http_response_status_206_count_stat,
+ http_response_status_2xx_count_stat,
+ http_response_status_300_count_stat,
+ http_response_status_301_count_stat,
+ http_response_status_302_count_stat,
+ http_response_status_303_count_stat,
+ http_response_status_304_count_stat,
+ http_response_status_305_count_stat,
+ http_response_status_307_count_stat,
+ http_response_status_3xx_count_stat,
+ http_response_status_400_count_stat,
+ http_response_status_401_count_stat,
+ http_response_status_402_count_stat,
+ http_response_status_403_count_stat,
+ http_response_status_404_count_stat,
+ http_response_status_405_count_stat,
+ http_response_status_406_count_stat,
+ http_response_status_407_count_stat,
+ http_response_status_408_count_stat,
+ http_response_status_409_count_stat,
+ http_response_status_410_count_stat,
+ http_response_status_411_count_stat,
+ http_response_status_412_count_stat,
+ http_response_status_413_count_stat,
+ http_response_status_414_count_stat,
+ http_response_status_415_count_stat,
+ http_response_status_416_count_stat,
+ http_response_status_4xx_count_stat,
+ http_response_status_500_count_stat,
+ http_response_status_501_count_stat,
+ http_response_status_502_count_stat,
+ http_response_status_503_count_stat,
+ http_response_status_504_count_stat,
+ http_response_status_505_count_stat,
+ http_response_status_5xx_count_stat,
http_stat_count
};
@@ -306,31 +357,19 @@ enum
extern RecRawStatBlock *http_rsb;
/* Stats should only be accessed using these macros */
+#define HTTP_INCREMENT_DYN_STAT(x) RecIncrRawStat(http_rsb, mutex->thread_holding, (int) x, 1)
+#define HTTP_DECREMENT_DYN_STAT(x) RecIncrRawStat(http_rsb, mutex->thread_holding, (int) x, -1)
+#define HTTP_SUM_DYN_STAT(x, y) RecIncrRawStat(http_rsb, mutex->thread_holding, (int) x, (int) y)
+#define HTTP_SUM_GLOBAL_DYN_STAT(x, y) RecIncrGlobalRawStatSum(http_rsb, x, y)
-#define HTTP_SET_DYN_STAT(x,C, S) \
-do { \
- RecSetRawStatSum(http_rsb, x, S); \
- RecSetRawStatCount(http_rsb, x, C); \
-} while (0);
-#define HTTP_INCREMENT_DYN_STAT(x) \
- RecIncrRawStat(http_rsb, mutex->thread_holding, (int) x, 1);
-#define HTTP_DECREMENT_DYN_STAT(x) \
- RecIncrRawStat(http_rsb, mutex->thread_holding, (int) x, -1);
-#define HTTP_SUM_DYN_STAT(x, y) \
- RecIncrRawStat(http_rsb, mutex->thread_holding, (int) x, (int) y);
-#define HTTP_SUM_GLOBAL_DYN_STAT(x, y) \
- RecIncrGlobalRawStatSum(http_rsb,x,y)
#define HTTP_CLEAR_DYN_STAT(x) \
do { \
RecSetRawStatSum(http_rsb, x, 0); \
RecSetRawStatCount(http_rsb, x, 0); \
-} while (0);
-#define HTTP_READ_DYN_STAT(x, C, S) \
- RecGetRawStatCount(http_rsb, (int) x, &C); \
- RecGetRawStatSum(http_rsb, (int) x, &S);
+ } while (0);
-#define HTTP_READ_DYN_SUM(x, S) \
- RecGetRawStatSum(http_rsb, (int) x, &S);
+#define HTTP_READ_DYN_SUM(x, S) RecGetRawStatSum(http_rsb, (int)x, &S) // This aggregates threads too
+#define HTTP_READ_GLOBAL_DYN_SUM(x, S) RecGetGlobalRawStatSum(http_rsb, (int)x, &S)
#define HTTP_ConfigReadInteger REC_ConfigReadInteger
#define HTTP_ConfigReadString REC_ConfigReadString
@@ -467,7 +506,6 @@ public:
MgmtInt connect_attempts_max_retries_dead_server;
MgmtInt connect_attempts_rr_retries;
MgmtInt connect_attempts_timeout;
- MgmtInt streaming_connect_attempts_timeout;
MgmtInt post_connect_attempts_timeout;
MgmtInt parent_connect_attempts;
MgmtInt per_parent_connect_attempts;
@@ -569,12 +607,6 @@ public:
MgmtInt cache_required_headers;
MgmtInt cache_range_lookup;
- /////////
- // SSL //
- /////////
- char *ssl_ports_string;
- HttpConfigPortRange *ssl_ports;
-
////////////////////////////////////////////
// CONNECT ports (used to be == ssl_ports //
////////////////////////////////////////////
@@ -814,7 +846,7 @@ public:
static void dump_config();
// parse ssl ports configuration string
- static HttpConfigPortRange *parse_ports_list(char *ssl_ports_str);
+ static HttpConfigPortRange *parse_ports_list(char *ports_str);
// parse DNS URL expansions string
static char **parse_url_expansions(char *url_expansions_str, int *num_expansions);
@@ -892,7 +924,6 @@ connect_attempts_max_retries(0),
connect_attempts_max_retries_dead_server(0),
connect_attempts_rr_retries(0),
connect_attempts_timeout(0),
-streaming_connect_attempts_timeout(0),
post_connect_attempts_timeout(0),
parent_connect_attempts(0),
per_parent_connect_attempts(0),
@@ -948,8 +979,6 @@ cache_enable_default_vary_headers(false)
cache_when_to_revalidate(0),
cache_when_to_add_no_cache_to_msie_requests(0),
cache_required_headers(CACHE_REQUIRED_HEADERS_NONE),
-ssl_ports_string(0),
-ssl_ports(0),
connect_ports_string(0),
connect_ports(0),
request_hdr_max_size(0),
@@ -1018,14 +1047,9 @@ HttpConfigParams()
xfree(cache_vary_default_text);
xfree(cache_vary_default_images);
xfree(cache_vary_default_other);
- xfree(ssl_ports_string);
xfree(connect_ports_string);
xfree(reverse_proxy_no_host_redirect);
- if (ssl_ports) {
- delete ssl_ports;
- }
-
if (connect_ports) {
delete connect_ports;
}
Modified: trafficserver/traffic/branches/wccp/proxy/http2/HttpConnectionCount.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/branches/wccp/proxy/http2/HttpConnectionCount.cc?rev=1040383&r1=1040382&r2=1040383&view=diff
==============================================================================
--- trafficserver/traffic/branches/wccp/proxy/http2/HttpConnectionCount.cc (original)
+++ trafficserver/traffic/branches/wccp/proxy/http2/HttpConnectionCount.cc Tue Nov 30 01:42:55 2010
@@ -24,7 +24,5 @@
#include "HttpConnectionCount.h"
-ConnectionCount *
- ConnectionCount::_connectionCount = NULL;
-ink_mutex
- ConnectionCount::_mutex;
+ConnectionCount *ConnectionCount::_connectionCount = NULL;
+ink_mutex ConnectionCount::_mutex;
Modified: trafficserver/traffic/branches/wccp/proxy/http2/HttpDebugNames.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/branches/wccp/proxy/http2/HttpDebugNames.cc?rev=1040383&r1=1040382&r2=1040383&view=diff
==============================================================================
--- trafficserver/traffic/branches/wccp/proxy/http2/HttpDebugNames.cc (original)
+++ trafficserver/traffic/branches/wccp/proxy/http2/HttpDebugNames.cc Tue Nov 30 01:42:55 2010
@@ -391,10 +391,12 @@ HttpDebugNames::get_action_name(HttpTran
return ("HTTP_API_SM_SHUTDOWN");
case HttpTransact::HTTP_REMAP_REQUEST:
return ("HTTP_REMAP_REQUEST");
- case HttpTransact::HTTP_API_READ_REQUEST_PRE_REMAP:
- return ("HTTP_API_READ_REQUEST_PRE_REMAP");
- case HttpTransact::HTTP_END_REMAP_REQUEST:
- return ("HTTP_END_REMAP_REQUEST");
+ case HttpTransact::HTTP_API_PRE_REMAP:
+ return ("HTTP_API_PRE_REMAP");
+ case HttpTransact::HTTP_API_POST_REMAP:
+ return ("HTTP_API_POST_REMAP");
+ case HttpTransact::HTTP_POST_REMAP_SKIP:
+ return ("HTTP_POST_REMAP_SKIP");
}
@@ -450,42 +452,43 @@ HttpDebugNames::get_cache_action_name(Ht
//
//////////////////////////////////////////////////////////////////
const char *
-HttpDebugNames::get_api_hook_name(INKHttpHookID t)
+HttpDebugNames::get_api_hook_name(TSHttpHookID t)
{
-
switch (t) {
- case INK_HTTP_READ_REQUEST_HDR_HOOK:
- return "INK_HTTP_READ_REQUEST_HDR_HOOK";
- case INK_HTTP_OS_DNS_HOOK:
- return "INK_HTTP_OS_DNS_HOOK";
- case INK_HTTP_SEND_REQUEST_HDR_HOOK:
- return "INK_HTTP_SEND_REQUEST_HDR_HOOK";
- case INK_HTTP_READ_CACHE_HDR_HOOK:
- return "INK_HTTP_READ_CACHE_HDR_HOOK";
- case INK_HTTP_CACHE_LOOKUP_COMPLETE_HOOK:
- return "INK_HTTP_CACHE_LOOKUP_COMPLETE_HOOK";
- case INK_HTTP_READ_RESPONSE_HDR_HOOK:
- return "INK_HTTP_READ_RESPONSE_HDR_HOOK";
- case INK_HTTP_SEND_RESPONSE_HDR_HOOK:
- return "INK_HTTP_SEND_RESPONSE_HDR_HOOK";
- case INK_HTTP_REQUEST_TRANSFORM_HOOK:
- return "INK_HTTP_REQUEST_TRANSFORM_HOOK";
- case INK_HTTP_RESPONSE_TRANSFORM_HOOK:
- return "INK_HTTP_RESPONSE_TRANSFORM_HOOK";
- case INK_HTTP_SELECT_ALT_HOOK:
- return "INK_HTTP_SELECT_ALT_HOOK";
- case INK_HTTP_TXN_START_HOOK:
- return "INK_HTTP_TXN_START_HOOK";
- case INK_HTTP_TXN_CLOSE_HOOK:
- return "INK_HTTP_TXN_CLOSE_HOOK";
- case INK_HTTP_SSN_START_HOOK:
- return "INK_HTTP_SSN_START_HOOK";
- case INK_HTTP_SSN_CLOSE_HOOK:
- return "INK_HTTP_SSN_CLOSE_HOOK";
- case INK_HTTP_READ_REQUEST_PRE_REMAP_HOOK:
- return "INK_HTTP_READ_REQUEST_PRE_REMAP_HOOK";
- case INK_HTTP_LAST_HOOK:
- return "INK_HTTP_LAST_HOOK";
+ case TS_HTTP_READ_REQUEST_HDR_HOOK:
+ return "TS_HTTP_READ_REQUEST_HDR_HOOK";
+ case TS_HTTP_OS_DNS_HOOK:
+ return "TS_HTTP_OS_DNS_HOOK";
+ case TS_HTTP_SEND_REQUEST_HDR_HOOK:
+ return "TS_HTTP_SEND_REQUEST_HDR_HOOK";
+ case TS_HTTP_READ_CACHE_HDR_HOOK:
+ return "TS_HTTP_READ_CACHE_HDR_HOOK";
+ case TS_HTTP_CACHE_LOOKUP_COMPLETE_HOOK:
+ return "TS_HTTP_CACHE_LOOKUP_COMPLETE_HOOK";
+ case TS_HTTP_READ_RESPONSE_HDR_HOOK:
+ return "TS_HTTP_READ_RESPONSE_HDR_HOOK";
+ case TS_HTTP_SEND_RESPONSE_HDR_HOOK:
+ return "TS_HTTP_SEND_RESPONSE_HDR_HOOK";
+ case TS_HTTP_REQUEST_TRANSFORM_HOOK:
+ return "TS_HTTP_REQUEST_TRANSFORM_HOOK";
+ case TS_HTTP_RESPONSE_TRANSFORM_HOOK:
+ return "TS_HTTP_RESPONSE_TRANSFORM_HOOK";
+ case TS_HTTP_SELECT_ALT_HOOK:
+ return "TS_HTTP_SELECT_ALT_HOOK";
+ case TS_HTTP_TXN_START_HOOK:
+ return "TS_HTTP_TXN_START_HOOK";
+ case TS_HTTP_TXN_CLOSE_HOOK:
+ return "TS_HTTP_TXN_CLOSE_HOOK";
+ case TS_HTTP_SSN_START_HOOK:
+ return "TS_HTTP_SSN_START_HOOK";
+ case TS_HTTP_SSN_CLOSE_HOOK:
+ return "TS_HTTP_SSN_CLOSE_HOOK";
+ case TS_HTTP_PRE_REMAP_HOOK:
+ return "TS_HTTP_PRE_REMAP_HOOK";
+ case TS_HTTP_POST_REMAP_HOOK:
+ return "TS_HTTP_POST_REMAP_HOOK";
+ case TS_HTTP_LAST_HOOK:
+ return "TS_HTTP_LAST_HOOK";
}
return "unknown hook";
Modified: trafficserver/traffic/branches/wccp/proxy/http2/HttpDebugNames.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/branches/wccp/proxy/http2/HttpDebugNames.h?rev=1040383&r1=1040382&r2=1040383&view=diff
==============================================================================
--- trafficserver/traffic/branches/wccp/proxy/http2/HttpDebugNames.h (original)
+++ trafficserver/traffic/branches/wccp/proxy/http2/HttpDebugNames.h Tue Nov 30 01:42:55 2010
@@ -34,7 +34,7 @@ public:
static const char *get_action_name(HttpTransact::StateMachineAction_t e);
static const char *get_method_name(const char *method);
static const char *get_cache_action_name(HttpTransact::CacheAction_t t);
- static const char *get_api_hook_name(INKHttpHookID t);
+ static const char *get_api_hook_name(TSHttpHookID t);
static const char *get_server_state_name(HttpTransact::ServerState_t state);
};
Modified: trafficserver/traffic/branches/wccp/proxy/http2/HttpPages.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/branches/wccp/proxy/http2/HttpPages.cc?rev=1040383&r1=1040382&r2=1040383&view=diff
==============================================================================
--- trafficserver/traffic/branches/wccp/proxy/http2/HttpPages.cc (original)
+++ trafficserver/traffic/branches/wccp/proxy/http2/HttpPages.cc Tue Nov 30 01:42:55 2010
@@ -415,8 +415,8 @@ HttpPagesHandler::handle_smlist(int even
}
resp_begin_item();
- resp_add("id: <a href=\"http://{http}/sm_details?id=%lld\"> "
- "%lld </a> | %s %s | %s\n", sm->sm_id, sm->sm_id, method ? method : "", url, sm_state ? sm_state : "");
+ resp_add("id: <a href=\"./sm_details?id=%lld\"> %lld </a> | %s %s | %s\n",
+ sm->sm_id, sm->sm_id, method ? method : "", url, sm_state ? sm_state : "");
resp_end_item();
arena.str_free(url);
Modified: trafficserver/traffic/branches/wccp/proxy/http2/HttpProxyServerMain.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/branches/wccp/proxy/http2/HttpProxyServerMain.cc?rev=1040383&r1=1040382&r2=1040383&view=diff
==============================================================================
--- trafficserver/traffic/branches/wccp/proxy/http2/HttpProxyServerMain.cc (original)
+++ trafficserver/traffic/branches/wccp/proxy/http2/HttpProxyServerMain.cc Tue Nov 30 01:42:55 2010
@@ -186,6 +186,7 @@ parse_http_server_other_ports()
Attributes attr;
get_connection_attributes(attr_str, &attr);
additional_ports_array[accept_index].type = attr.type;
+ additional_ports_array[accept_index].domain = attr.domain;
additional_ports_array[accept_index].f_outbound_transparent = attr.f_outbound_transparent;
additional_ports_array[accept_index].f_inbound_transparent = attr.f_inbound_transparent;
@@ -222,7 +223,7 @@ init_HttpProxyServer(void)
// INKqa11918
init_max_chunk_buf();
-#ifndef INK_NO_API
+#ifndef TS_NO_API
// Used to give plugins the ability to create http requests
// The equivalent of the connecting to localhost on the proxy
// port but without going through the operating system
@@ -236,7 +237,7 @@ init_HttpProxyServer(void)
void
-start_HttpProxyServer(int fd, int port, int ssl_fd)
+start_HttpProxyServer(int fd, int port, int ssl_fd, int accept_threads)
{
char *dump_every_str = 0;
static bool called_once = false;
@@ -275,6 +276,7 @@ start_HttpProxyServer(int fd, int port,
static HttpPortTypes type = SERVER_PORT_DEFAULT;
NetProcessor::AcceptOptions opt;
opt.port = port;
+ opt.accept_threads = accept_threads;
if (!called_once) {
// function can be called several times : do memory allocation once
@@ -289,11 +291,11 @@ start_HttpProxyServer(int fd, int port,
type = attr.type;
opt.domain = attr.domain;
Debug("http_tproxy", "Primary listen socket transparency is %s\n",
- attr.f_inbound_transparent && attr.f_outbound_transparent ? "bidirectional"
- : attr.f_inbound_transparent ? "inbound"
- : attr.f_outbound_transparent ? "outbound"
- : "off"
- );
+ attr.f_inbound_transparent && attr.f_outbound_transparent ? "bidirectional"
+ : attr.f_inbound_transparent ? "inbound"
+ : attr.f_outbound_transparent ? "outbound"
+ : "off"
+ );
opt.f_outbound_transparent = attr.f_outbound_transparent;
opt.f_inbound_transparent = attr.f_inbound_transparent;
xfree(attr_string);
@@ -312,8 +314,7 @@ start_HttpProxyServer(int fd, int port,
}
}
if (!http_port_attr_array) {
- netProcessor.main_accept(NEW(new HttpAccept(type)), fd, NULL, NULL, false,
- opt);
+ netProcessor.main_accept(NEW(new HttpAccept(type)), fd, NULL, NULL, false, opt);
if (http_other_port_array) {
for (int i = 0; http_other_port_array[i].port != -1; i++) {
@@ -321,21 +322,18 @@ start_HttpProxyServer(int fd, int port,
if ((e.port<1) || (e.port> 65535))
Warning("additional port out of range ignored: %d", e.port);
else {
- opt.port = e.port;
- opt.f_outbound_transparent = e.f_outbound_transparent;
- netProcessor.main_accept(NEW(new HttpAccept(e.type)),
- fd, NULL, NULL, false, opt
- );
- }
+ opt.port = e.port;
+ opt.domain = e.domain;
+ opt.f_outbound_transparent = e.f_outbound_transparent;
+ netProcessor.main_accept(NEW(new HttpAccept(e.type)), fd, NULL, NULL, false, opt);
+ }
}
}
} else {
for (int i = 0; http_port_attr_array[i].fd != NO_FD; i++) {
HttpPortEntry & e = http_port_attr_array[i];
if (!e.fd) {
- netProcessor.main_accept(NEW(new HttpAccept(type)),
- fd, NULL, NULL, false, opt
- );
+ netProcessor.main_accept(NEW(new HttpAccept(type)), fd, NULL, NULL, false, opt);
}
}
}
@@ -345,8 +343,8 @@ start_HttpProxyServer(int fd, int port,
if (sslParam->getTerminationMode() & sslParam->SSL_TERM_MODE_CLIENT) {
opt.reset();
opt.port = sslParam->getAcceptPort();
- sslNetProcessor.main_accept(NEW(new HttpAccept(SERVER_PORT_SSL)), ssl_fd,
- 0, 0, false, opt);
+ opt.accept_threads = accept_threads;
+ sslNetProcessor.main_accept(NEW(new HttpAccept(SERVER_PORT_SSL)), ssl_fd, 0, 0, false, opt);
}
sslTerminationConfig.release(sslParam);
@@ -356,7 +354,7 @@ start_HttpProxyServer(int fd, int port,
// HttpStateMachine::dump_state_machines();
}
#endif
-#ifndef INK_NO_TESTS
+#if TS_HAS_TESTS
if (is_action_tag_set("http_update_test")) {
init_http_update_test();
}
@@ -364,10 +362,11 @@ start_HttpProxyServer(int fd, int port,
}
void
-start_HttpProxyServerBackDoor(int port)
+start_HttpProxyServerBackDoor(int port, int accept_threads)
{
NetProcessor::AcceptOptions opt;
+
opt.port = port;
- netProcessor.main_accept(NEW(new HttpAccept(SERVER_PORT_DEFAULT, true)),
- NO_FD, 0, 0, false, opt);
+ opt.accept_threads = accept_threads;
+ netProcessor.main_accept(NEW(new HttpAccept(SERVER_PORT_DEFAULT, true)), NO_FD, 0, 0, false, opt);
}
Modified: trafficserver/traffic/branches/wccp/proxy/http2/HttpProxyServerMain.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/branches/wccp/proxy/http2/HttpProxyServerMain.h?rev=1040383&r1=1040382&r2=1040383&view=diff
==============================================================================
--- trafficserver/traffic/branches/wccp/proxy/http2/HttpProxyServerMain.h (original)
+++ trafficserver/traffic/branches/wccp/proxy/http2/HttpProxyServerMain.h Tue Nov 30 01:42:55 2010
@@ -29,6 +29,6 @@ void init_HttpProxyServer(void);
descriptor should be opened.
*/
-void start_HttpProxyServer(int fd, int port, int ssl_fd = NO_FD);
+void start_HttpProxyServer(int fd, int port, int ssl_fd, int accept_threads = 0);
-void start_HttpProxyServerBackDoor(int port);
+void start_HttpProxyServerBackDoor(int port, int accept_threads = 0);
Modified: trafficserver/traffic/branches/wccp/proxy/http2/HttpSM.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/branches/wccp/proxy/http2/HttpSM.cc?rev=1040383&r1=1040382&r2=1040383&view=diff
==============================================================================
--- trafficserver/traffic/branches/wccp/proxy/http2/HttpSM.cc (original)
+++ trafficserver/traffic/branches/wccp/proxy/http2/HttpSM.cc Tue Nov 30 01:42:55 2010
@@ -48,10 +48,6 @@
//#include "HttpAuthParams.h"
#include "congest/Congestion.h"
-#if defined(solaris) && !defined(__GNUC__)
-#include <string>
-#endif
-
#define DEFAULT_RESPONSE_BUFFER_SIZE_INDEX 6 // 8K
#define DEFAULT_REQUEST_BUFFER_SIZE_INDEX 6 // 8K
#define MIN_CONFIG_BUFFER_SIZE_INDEX 5 // 4K
@@ -157,13 +153,10 @@ HttpSM::_instantiate_func(HttpSM * proto
pd[to[j]] = val[j];
}
- ink_debug_assert((memcmp((char *) new_instance,
- (char *) prototype,
- pre_history_len) == 0) &&
- (memcmp(((char *) new_instance) + post_offset,
- ((char *) prototype) + post_offset, post_history_len) == 0));
+ ink_debug_assert((memcmp((char *) new_instance, (char *) prototype, pre_history_len) == 0) &&
+ (memcmp(((char *) new_instance) + post_offset, ((char *) prototype) + post_offset, post_history_len) == 0));
#else
-// memcpy(new_instance, prototype, total_len);
+ // memcpy(new_instance, prototype, total_len);
memcpy(new_instance, prototype, pre_history_len);
memcpy(((char *) new_instance) + post_offset, ((char *) prototype) + post_offset, post_history_len);
#endif
@@ -206,7 +199,6 @@ HttpVCTable::find_entry(VConnection * vc
HttpVCTableEntry *
HttpVCTable::find_entry(VIO * vio)
{
-
for (int i = 0; i < vc_table_max_entries; i++) {
if (vc_table[i].read_vio == vio || vc_table[i].write_vio == vio) {
ink_assert(vc_table[i].vc != NULL);
@@ -252,10 +244,8 @@ HttpVCTable::remove_entry(HttpVCTableEnt
void
HttpVCTable::cleanup_entry(HttpVCTableEntry * e)
{
-
ink_assert(e->vc);
if (e->in_tunnel == false) {
-
// Update stats
switch (e->vc_type) {
case HTTP_UA_VC:
@@ -320,35 +310,35 @@ history[pos].fileline = __FILE__ ":" _RE
static int next_sm_id = 0;
-HttpSM::HttpSM():
-Continuation(NULL), sm_id(-1), magic(HTTP_SM_MAGIC_DEAD),
- //YTS Team, yamsat Plugin
- enable_redirection(false), api_enable_redirection(true), redirect_url(NULL), redirect_url_len(0), redirection_tries(0), transfered_bytes(0),
-post_failed(false),
- //YTS Team, yamsat
- is_cache_enabled(false), request_inserted(false),
-Hashtable_index(0), piggybacking_scheduled(false), event_scheduled(NULL),
-plugin_tunnel_type(HTTP_NO_PLUGIN_TUNNEL),
-plugin_tunnel(NULL), reentrancy_count(0),
-history_pos(0), tunnel(), ua_entry(NULL),
-ua_session(NULL), background_fill(BACKGROUND_FILL_NONE),
-server_entry(NULL), server_session(NULL), shared_session_retries(0),
-server_buffer_reader(NULL),
-transform_info(), post_transform_info(), second_cache_sm(NULL),
-default_handler(NULL), pending_action(NULL), historical_action(NULL),
-last_action(HttpTransact::STATE_MACHINE_ACTION_UNDEFINED),
-client_request_hdr_bytes(0), client_request_body_bytes(0),
-server_request_hdr_bytes(0), server_request_body_bytes(0),
-server_response_hdr_bytes(0), server_response_body_bytes(0),
-client_response_hdr_bytes(0), client_response_body_bytes(0),
-pushed_response_hdr_bytes(0), pushed_response_body_bytes(0),
-hooks_set(0), cur_hook_id(INK_HTTP_LAST_HOOK), cur_hook(NULL),
-// TODO: This needs to be supported with non-V2 APIs as well.
+HttpSM::HttpSM()
+ : Continuation(NULL), sm_id(-1), magic(HTTP_SM_MAGIC_DEAD),
+ //YTS Team, yamsat Plugin
+ enable_redirection(false), api_enable_redirection(true), redirect_url(NULL), redirect_url_len(0), redirection_tries(0), transfered_bytes(0),
+ post_failed(false),
+ //YTS Team, yamsat
+ is_cache_enabled(false), request_inserted(false),
+ Hashtable_index(0), piggybacking_scheduled(false), event_scheduled(NULL),
+ plugin_tunnel_type(HTTP_NO_PLUGIN_TUNNEL),
+ plugin_tunnel(NULL), reentrancy_count(0),
+ history_pos(0), tunnel(), ua_entry(NULL),
+ ua_session(NULL), background_fill(BACKGROUND_FILL_NONE),
+ server_entry(NULL), server_session(NULL), shared_session_retries(0),
+ server_buffer_reader(NULL),
+ transform_info(), post_transform_info(), second_cache_sm(NULL),
+ default_handler(NULL), pending_action(NULL), historical_action(NULL),
+ last_action(HttpTransact::STATE_MACHINE_ACTION_UNDEFINED),
+ client_request_hdr_bytes(0), client_request_body_bytes(0),
+ server_request_hdr_bytes(0), server_request_body_bytes(0),
+ server_response_hdr_bytes(0), server_response_body_bytes(0),
+ client_response_hdr_bytes(0), client_response_body_bytes(0),
+ pushed_response_hdr_bytes(0), pushed_response_body_bytes(0),
+ hooks_set(0), cur_hook_id(TS_HTTP_LAST_HOOK), cur_hook(NULL),
+ // TODO: This needs to be supported with non-V2 APIs as well.
#if TS_HAS_V2STATS
-prev_hook_start_time(0),
-prev_hook_stats_enabled(false),
+ prev_hook_start_time(0),
+ prev_hook_stats_enabled(false),
#endif
-cur_hooks(0), callout_state(HTTP_API_NO_CALLOUT), terminate_sm(false), kill_this_async_done(false)
+ cur_hooks(0), callout_state(HTTP_API_NO_CALLOUT), terminate_sm(false), kill_this_async_done(false)
{
static int scatter_init = 0;
@@ -647,11 +637,11 @@ HttpSM::attach_client_session(HttpClient
t_state.client_info.port = netvc->get_local_port();
t_state.client_info.is_transparent = netvc->get_is_transparent();
t_state.backdoor_request = client_vc->backdoor_connect;
-
+ memset(&(t_state.client_info.addr), 0, sizeof(t_state.client_info.addr));
+ t_state.client_info.addr = client_vc->get_netvc()->get_remote_addr();
t_state.client_info.port_attribute = (HttpPortTypes) netvc->attributes;
HTTP_INCREMENT_DYN_STAT(http_current_client_transactions_stat);
- client_vc->client_trans_stat++;
// Record api hook set state
hooks_set = http_global_hooks->hooks_set | client_vc->hooks_set;
@@ -677,7 +667,6 @@ HttpSM::attach_client_session(HttpClient
void
HttpSM::setup_client_read_request_header()
{
-
ink_assert(ua_entry->vc_handler == &HttpSM::state_read_client_request_header);
// The header may already be in the buffer if this
@@ -786,7 +775,6 @@ HttpSM::state_read_client_request_header
case PARSE_CONT:
if (ua_entry->eos) {
-
Debug("http_seq", "[%lld] EOS before client request parsing finished", sm_id);
set_ua_abort(HttpTransact::ABORTED, event);
@@ -838,7 +826,6 @@ HttpSM::state_read_client_request_header
int
HttpSM::state_drain_client_request_body(int event, void *data)
{
-
STATE_ENTER(&HttpSM::state_drain_client_request_body, event);
ink_assert(ua_entry->read_vio == (VIO *) data);
@@ -906,7 +893,6 @@ HttpSM::state_watch_for_client_abort(int
case VC_EVENT_INACTIVITY_TIMEOUT:
{
if (tunnel.is_tunnel_active()) {
-
// Check to see if the user agent is part of the tunnel.
// If so forward the event to the tunnel. Otherwise,
// kill the tunnel and fallthrough to the case
@@ -946,7 +932,6 @@ HttpSM::state_watch_for_client_abort(int
void
HttpSM::setup_push_read_response_header()
{
-
ink_assert(server_session == NULL);
ink_assert(server_entry == NULL);
ink_assert(ua_session != NULL);
@@ -995,12 +980,10 @@ HttpSM::setup_push_read_response_header(
int
HttpSM::state_read_push_response_header(int event, void *data)
{
-
STATE_ENTER(&HttpSM::state_read_push_response_header, event);
ink_assert(ua_entry->read_vio == (VIO *) data);
ink_assert(t_state.current.server == NULL);
-
int data_size = 0;
int bytes_used = 0;
// Not used here.
@@ -1098,7 +1081,6 @@ HttpSM::state_read_push_response_header(
int
HttpSM::state_raw_http_server_open(int event, void *data)
{
-
STATE_ENTER(&HttpSM::state_raw_http_server_open, event);
ink_assert(server_entry == NULL);
// milestones.server_connect_end = ink_get_hrtime();
@@ -1162,7 +1144,6 @@ HttpSM::state_raw_http_server_open(int e
int
HttpSM::state_request_wait_for_transform_read(int event, void *data)
{
-
STATE_ENTER(&HttpSM::state_request_wait_for_transform_read, event);
int size = (int)(intptr_t) data;
@@ -1205,7 +1186,6 @@ HttpSM::state_request_wait_for_transform
int
HttpSM::state_response_wait_for_transform_read(int event, void *data)
{
-
STATE_ENTER(&HttpSM::state_response_wait_for_transform_read, event);
int size = (int)(intptr_t) data;
@@ -1235,10 +1215,8 @@ HttpSM::state_response_wait_for_transfor
// transforms which prevents code duplication
//
int
-HttpSM::state_common_wait_for_transform_read(HttpTransformInfo * t_info,
- HttpSMHandler tunnel_handler, int event, void *data)
+HttpSM::state_common_wait_for_transform_read(HttpTransformInfo * t_info, HttpSMHandler tunnel_handler, int event, void *data)
{
-
STATE_ENTER(&HttpSM::state_common_wait_for_transform_read, event);
HttpTunnelConsumer *c = 0;
@@ -1259,7 +1237,6 @@ HttpSM::state_common_wait_for_transform_
// transform fall through to vc event error case
ink_assert(c->write_success == false);
} else if (c->producer->read_success == false) {
-
// Case 2 - error from data source
if (c->producer->vc_type == HT_HTTP_CLIENT) {
// Our source is the client. POST can't
@@ -1315,7 +1292,6 @@ HttpSM::state_common_wait_for_transform_
int
HttpSM::state_api_callback(int event, void *data)
{
-
ink_release_assert(magic == HTTP_SM_MAGIC_ALIVE);
ink_assert(reentrancy_count >= 0);
@@ -1347,7 +1323,6 @@ HttpSM::state_api_callback(int event, vo
int
HttpSM::state_api_callout(int event, void *data)
{
-
// enum and variable for figuring out what the next action is after
// after we've finished the api state
enum AfterApiReturn_t
@@ -1373,7 +1348,7 @@ HttpSM::state_api_callout(int event, voi
// FALLTHROUGH
case EVENT_NONE:
case HTTP_API_CONTINUE:
- if ((cur_hook_id >= 0) && (cur_hook_id < INK_HTTP_LAST_HOOK)) {
+ if ((cur_hook_id >= 0) && (cur_hook_id < TS_HTTP_LAST_HOOK)) {
if (!cur_hook) {
if (cur_hooks == 0) {
cur_hook = http_global_hooks->get(cur_hook_id);
@@ -1437,7 +1412,7 @@ HttpSM::state_api_callout(int event, voi
hook->m_cont->statCallsMade(cur_hook_id);
// Stat time spent in previous plugin
- int64 curr_time = INKhrtime();
+ int64 curr_time = ink_get_based_hrtime();
// TODO: This needs to be supported with non-V2 APIs as well.
if(prev_hook_stats_enabled && prev_hook_start_time) {
int64 time_in_plugin_ms = (curr_time - prev_hook_start_time)/1000000;
@@ -1455,7 +1430,7 @@ HttpSM::state_api_callout(int event, voi
prev_hook_stats = hook->m_cont->cont_time_stats[cur_hook_id];
#endif
- hook->invoke(INK_EVENT_HTTP_READ_REQUEST_HDR + cur_hook_id, this);
+ hook->invoke(TS_EVENT_HTTP_READ_REQUEST_HDR + cur_hook_id, this);
if (plugin_lock) {
Mutex_unlock(plugin_mutex, mutex->thread_holding);
@@ -1488,7 +1463,7 @@ HttpSM::state_api_callout(int event, voi
case HTTP_API_ERROR:
if (callout_state == HTTP_API_DEFERED_CLOSE) {
api_next = API_RETURN_DEFERED_CLOSE;
- } else if (cur_hook_id == INK_HTTP_TXN_CLOSE_HOOK) {
+ } else if (cur_hook_id == TS_HTTP_TXN_CLOSE_HOOK) {
// If we are closing the state machine, we can't
// jump to an error state so just continue
api_next = API_RETURN_CONTINUE;
@@ -1535,7 +1510,7 @@ HttpSM::state_api_callout(int event, voi
// TODO: This needs to be supported with non-V2 APIs as well.
#if TS_HAS_V2STATS
if(prev_hook_stats_enabled && prev_hook_start_time) {
- int64 time_in_plugin_ms = (INKhrtime() - prev_hook_start_time)/1000000;
+ int64 time_in_plugin_ms = (ink_get_based_hrtime() - prev_hook_start_time)/1000000;
Debug("http", "[%lld] Last plugin : Time spent : %s %lld",
sm_id, HttpDebugNames::get_api_hook_name(cur_hook_id), time_in_plugin_ms);
prev_hook_stats.inc(time_in_plugin_ms);
@@ -1586,7 +1561,6 @@ HttpSM::state_api_callout(int event, voi
void
HttpSM::handle_api_return()
{
-
switch (t_state.api_next_action) {
case HttpTransact::HTTP_API_SM_START:
if (t_state.client_info.port_attribute == SERVER_PORT_BLIND_TUNNEL) {
@@ -1595,7 +1569,8 @@ HttpSM::handle_api_return()
setup_client_read_request_header();
}
return;
- case HttpTransact::HTTP_API_READ_REQUEST_PRE_REMAP:
+ case HttpTransact::HTTP_API_PRE_REMAP:
+ case HttpTransact::HTTP_API_POST_REMAP:
case HttpTransact::HTTP_API_READ_REQUEST_HDR:
case HttpTransact::HTTP_API_OS_DNS:
case HttpTransact::HTTP_API_READ_CACHE_HDR:
@@ -1681,12 +1656,10 @@ HttpSM::handle_api_return()
case HttpTransact::REDIRECT_READ:
{
-
call_transact_and_set_next_state(HttpTransact::HandleRequest);
break;
}
-
default:
{
ink_release_assert(!"Should not get here");
@@ -1774,7 +1747,6 @@ HttpSM::state_http_server_open(int event
int
HttpSM::state_read_server_response_header(int event, void *data)
{
-
STATE_ENTER(&HttpSM::state_read_server_response_header, event);
ink_assert(server_entry->read_vio == (VIO *) data);
ink_assert(t_state.current.server->state == HttpTransact::STATE_UNDEFINED);
@@ -1868,7 +1840,6 @@ HttpSM::state_read_server_response_heade
bool allow_error = false;
if (t_state.hdr_info.server_response.type_get() == HTTP_TYPE_RESPONSE &&
t_state.hdr_info.server_response.status_get() == HTTP_STATUS_MOVED_TEMPORARILY) {
-
if (t_state.hdr_info.server_response.field_find(MIME_FIELD_LOCATION, MIME_LEN_LOCATION)) {
allow_error = true;
}
@@ -1949,7 +1920,6 @@ HttpSM::state_read_server_response_heade
int
HttpSM::state_send_server_request_header(int event, void *data)
{
-
STATE_ENTER(&HttpSM::state_send_server_request_header, event);
ink_assert(server_entry != NULL);
ink_assert(server_entry->write_vio == (VIO *) data || server_entry->read_vio == (VIO *) data);
@@ -1971,7 +1941,6 @@ HttpSM::state_send_server_request_header
(method != HTTP_WKSIDX_GET) &&
(method == HTTP_WKSIDX_POST || method == HTTP_WKSIDX_PUT ||
(t_state.hdr_info.extension_method && t_state.hdr_info.request_content_length > 0))) {
-
if (post_transform_info.vc) {
setup_transform_to_server_transfer();
} else {
@@ -2155,7 +2124,6 @@ HttpSM::process_hostdb_info(HostDBInfo *
int
HttpSM::state_hostdb_lookup(int event, void *data)
{
-
STATE_ENTER(&HttpSM::state_hostdb_lookup, event);
// HTTP_DEBUG_ASSERT (m_origin_server_vc == 0);
@@ -2183,7 +2151,6 @@ HttpSM::state_hostdb_lookup(int event, v
int
HttpSM::state_hostdb_reverse_lookup(int event, void *data)
{
-
STATE_ENTER(&HttpSM::state_hostdb_reverse_lookup, event);
// REQ_FLAVOR_SCHEDULED_UPDATE can be transformed into
@@ -2252,7 +2219,6 @@ HttpSM::state_mark_os_down(int event, vo
int
HttpSM::state_handle_stat_page(int event, void *data)
{
-
STATE_ENTER(&HttpSM::state_handle_stat_page, event);
switch (event) {
case STAT_PAGE_SUCCESS:
@@ -2385,7 +2351,6 @@ STATE_ENTER(&HttpSM:state_cache_open_wri
pending_action = NULL;
switch (event) {
-
case CACHE_EVENT_OPEN_WRITE:
//////////////////////////////
// OPEN WRITE is successful //
@@ -2565,11 +2530,11 @@ HttpSM::main_handler(int event, void *da
} else {
jump_point = vc_entry->vc_handler;
}
- ink_assert(jump_point != NULL);
- ink_assert(vc_entry->vc != NULL);
+ ink_assert(jump_point != (HttpSMHandler)NULL);
+ ink_assert(vc_entry->vc != (VConnection *)NULL);
(this->*jump_point) (event, data);
} else {
- ink_assert(default_handler != NULL);
+ ink_assert(default_handler != (HttpSMHandler)NULL);
(this->*default_handler) (event, data);
}
@@ -2601,7 +2566,6 @@ HttpSM::main_handler(int event, void *da
void
HttpSM::tunnel_handler_post_or_put(HttpTunnelProducer * p)
{
-
ink_assert(p->vc_type == HT_HTTP_CLIENT);
HttpTunnelConsumer *c;
@@ -2800,7 +2764,6 @@ HttpSM::tunnel_handler(int event, void *
bool
HttpSM::is_http_server_eos_truncation(HttpTunnelProducer * p)
{
-
// If we are keep alive, an eos event means we
// did not get all the data
if (t_state.current.server->keep_alive == HTTP_KEEPALIVE) {
@@ -2882,8 +2845,7 @@ HttpSM::tunnel_handler_server(int event,
ink_assert(p->vc_type == HT_HTTP_SERVER);
if (is_http_server_eos_truncation(p)) {
- Debug("http", "[%lld] [HttpSM::tunnel_handler_server] "
- "aborting cache writes due to server truncation", sm_id);
+ Debug("http", "[%lld] [HttpSM::tunnel_handler_server] aborting cache writes due to server truncation", sm_id);
tunnel.abort_cache_write_finish_others(p);
t_state.current.server->abort = HttpTransact::ABORTED;
if (t_state.http_config_param->log_spider_codes) {
@@ -3039,13 +3001,11 @@ HttpSM::tunnel_handler_100_continue_ua(i
bool
HttpSM::is_bg_fill_necessary(HttpTunnelConsumer * c)
{
-
ink_assert(c->vc_type == HT_HTTP_CLIENT);
// There must be another consumer for it to worthwhile to
// set up a background fill
if (c->producer->num_consumers > 1 && c->producer->vc_type == HT_HTTP_SERVER && c->producer->alive == true) {
-
// If threshold is 0.0 or negative then do background
// fill regardless of the content length. Since this
// is floating point just make sure the number is near zero
@@ -3077,7 +3037,6 @@ HttpSM::is_bg_fill_necessary(HttpTunnelC
int
HttpSM::tunnel_handler_ua(int event, HttpTunnelConsumer * c)
{
-
bool close_connection = true;
HttpTunnelProducer *p = NULL;
HttpTunnelConsumer *selfc = NULL;
@@ -3158,7 +3117,6 @@ HttpSM::tunnel_handler_ua(int event, Htt
ink_assert(ua_entry->vc == c->vc);
if (close_connection) {
-
// If the client could be pipelining or is doing a POST, we need to
// set the ua_session into half close mode
if ((t_state.method == HTTP_WKSIDX_POST || t_state.client_info.pipeline_possible == true)
@@ -3181,7 +3139,6 @@ HttpSM::tunnel_handler_ua(int event, Htt
int
HttpSM::tunnel_handler_ua_push(int event, HttpTunnelProducer * p)
{
-
STATE_ENTER(&HttpSM::tunnel_handler_ua_push, event);
pushed_response_body_bytes += p->bytes_read;
@@ -3315,12 +3272,10 @@ HttpSM::tunnel_handler_cache_write(int e
int
HttpSM::tunnel_handler_post_ua(int event, HttpTunnelProducer * p)
{
-
STATE_ENTER(&HttpSM::tunnel_handler_post_ua, event);
client_request_body_bytes = p->init_bytes_done + p->bytes_read;
switch (event) {
-
case VC_EVENT_EOS:
// My reading of spec says that user agents can not ternminate
// posts with a half close so this is an error
@@ -3402,13 +3357,11 @@ HttpSM::tunnel_handler_for_partial_post(
int
HttpSM::tunnel_handler_post_server(int event, HttpTunnelConsumer * c)
{
-
STATE_ENTER(&HttpSM::tunnel_handler_post_server, event);
server_request_body_bytes = c->bytes_written;
switch (event) {
-
case VC_EVENT_EOS:
case VC_EVENT_ERROR:
case VC_EVENT_INACTIVITY_TIMEOUT:
@@ -3500,7 +3453,6 @@ HttpSM::tunnel_handler_ssl_producer(int
STATE_ENTER(&HttpSM::tunnel_handler_ssl_producer, event);
switch (event) {
-
case VC_EVENT_EOS:
// The write side of this connection is still alive
// so half-close the read
@@ -3561,11 +3513,9 @@ HttpSM::tunnel_handler_ssl_producer(int
int
HttpSM::tunnel_handler_ssl_consumer(int event, HttpTunnelConsumer * c)
{
-
STATE_ENTER(&HttpSM::tunnel_handler_ssl_consumer, event);
switch (event) {
-
case VC_EVENT_ERROR:
case VC_EVENT_EOS:
case VC_EVENT_INACTIVITY_TIMEOUT:
@@ -3630,7 +3580,6 @@ HttpSM::tunnel_handler_ssl_consumer(int
int
HttpSM::tunnel_handler_transform_write(int event, HttpTunnelConsumer * c)
{
-
STATE_ENTER(&HttpSM::tunnel_handler_transform_write, event);
HttpTransformInfo *i;
@@ -3695,7 +3644,6 @@ HttpSM::tunnel_handler_transform_write(i
int
HttpSM::tunnel_handler_transform_read(int event, HttpTunnelProducer * p)
{
-
STATE_ENTER(&HttpSM::tunnel_handler_transform_read, event);
ink_assert(p->vc == transform_info.vc || p->vc == post_transform_info.vc);
@@ -3739,7 +3687,6 @@ HttpSM::tunnel_handler_transform_read(in
int
HttpSM::state_srv_lookup(int event, void *data)
{
-
STATE_ENTER(&HttpSM::state_srv_lookup, event);
ink_assert(t_state.req_flavor == HttpTransact::REQ_FLAVOR_SCHEDULED_UPDATE ||
@@ -3767,7 +3714,6 @@ HttpSM::state_remap_request(int event, v
STATE_ENTER(&HttpSM::state_remap_request, event);
switch (event) {
-
case EVENT_REMAP_ERROR:
{
ink_debug_assert(!"this doesn't happen");
@@ -3831,7 +3777,6 @@ HttpSM::do_remap_request(bool run_inline
void
HttpSM::do_hostdb_lookup()
{
-
/*
//////////////////////////////////////////
// if a connection to the origin server //
@@ -3851,22 +3796,18 @@ HttpSM::do_hostdb_lookup()
bool use_srv_records = HttpConfig::m_master.srv_enabled;
if (use_srv_records) {
- // TODO: Get rid of string?
- string s = "_http._tcp.";
- s += t_state.server_info.name;
+ char* d = t_state.dns_info.srv_hostname;
- ink_strncpy(&t_state.dns_info.srv_hostname[0], (char *) s.c_str(), MAXDNAME);
- t_state.dns_info.srv_hostname[MAXDNAME - 1] = '\0';
+ memcpy(d, "_http._tcp.", 11);
+ ink_strncpy(d+11, t_state.server_info.name, MAXDNAME - 11);
+ d[MAXDNAME - 1] = '\0'; // Just to be sure it's NULL terminated in case of truncation
- Debug("dns_srv", "Beginning lookup of SRV records for origin %s", (char *) s.c_str());
+ Debug("dns_srv", "Beginning lookup of SRV records for origin %s", d);
HTTP_SM_SET_DEFAULT_HANDLER(&HttpSM::state_srv_lookup);
- Action *srv_lookup_action_handle = hostDBProcessor.getSRVbyname_imm(this,
- (process_srv_info_pfn) & HttpSM::
- process_srv_info,
- (char *) s.c_str(),
- (t_state.api_txn_dns_timeout_value != -1) ? t_state.
- api_txn_dns_timeout_value : 0);
+ Action *srv_lookup_action_handle =
+ hostDBProcessor.getSRVbyname_imm(this, (process_srv_info_pfn) & HttpSM::process_srv_info, d,
+ (t_state.api_txn_dns_timeout_value != -1) ? t_state.api_txn_dns_timeout_value : 0);
if (srv_lookup_action_handle != ACTION_RESULT_DONE) {
ink_assert(!pending_action);
@@ -3990,7 +3931,7 @@ HttpSM::do_hostdb_update_if_necessary()
// this function first checks if cached response has Accept-Ranges and
// Content-Length header and is HTTP/1.1. && There is no other plugins
-// hooked to INK_HTTP_RESPONSE_TRANSFORM_HOOK.
+// hooked to TS_HTTP_RESPONSE_TRANSFORM_HOOK.
// Then setup Range transformation if necessary
void
HttpSM::do_range_setup_if_necessary()
@@ -4006,14 +3947,13 @@ HttpSM::do_range_setup_if_necessary()
t_state.range_setup = HttpTransact::RANGE_NONE;
if (t_state.method == HTTP_WKSIDX_GET && t_state.hdr_info.client_request.version_get() == HTTPVersion(1, 1)) {
-
- if (api_hooks.get(INK_HTTP_RESPONSE_TRANSFORM_HOOK) == NULL) {
+ if (api_hooks.get(TS_HTTP_RESPONSE_TRANSFORM_HOOK) == NULL) {
// We may still not do Range if it is out of order Range.
range_trans = transformProcessor.range_transform(mutex, field,
t_state.cache_info.object_read,
&t_state.hdr_info.transform_response, res);
if (range_trans != NULL) {
- api_hooks.append(INK_HTTP_RESPONSE_TRANSFORM_HOOK, range_trans);
+ api_hooks.append(TS_HTTP_RESPONSE_TRANSFORM_HOOK, range_trans);
t_state.range_setup = HttpTransact::RANGE_TRANSFORM;
} else if (res)
t_state.range_setup = HttpTransact::RANGE_NOT_SATISFIABLE;
@@ -4088,13 +4028,8 @@ HttpSM::do_cache_delete_all_alts(Continu
Action *cache_action_handle = NULL;
- if (!cont && cache_global_hooks->get(INK_CACHE_PLUGIN_HOOK)) {
- // cache plugin, must pass a continuation
- cacheProcessor.remove(&cache_sm, t_state.cache_info.lookup_url);
- } else {
- cache_action_handle = cacheProcessor.remove(cont, // continuation
- t_state.cache_info.lookup_url); // url
- }
+ cache_action_handle = cacheProcessor.remove(cont, // continuation
+ t_state.cache_info.lookup_url); // url
if (cont != NULL) {
if (cache_action_handle != ACTION_RESULT_DONE) {
@@ -4205,8 +4140,6 @@ HttpSM::do_cache_prepare_action(HttpCach
}
-inline bool is_request_from_streaming_client(HTTPHdr * hdr);
-
//////////////////////////////////////////////////////////////////////////
//
// HttpStateMachineGet::do_http_server_open()
@@ -4355,13 +4288,14 @@ HttpSM::do_http_server_open(bool raw)
// Atomically read the current number of connections and check to see
// if we have gone above the max allowed.
if (t_state.http_config_param->server_max_connections > 0) {
- int64 Count, Sum;
- HTTP_READ_DYN_STAT(http_current_server_connections_stat, Count, Sum);
+ int64 sum;
+
+ HTTP_READ_GLOBAL_DYN_SUM(http_current_server_connections_stat, sum);
// Note that there is a potential race condition here where
// the value of the http_current_server_connections_stat gets changed
// between the statement above and the check below.
// If this happens, we might go over the max by 1 but this is ok.
- if (Sum >= t_state.http_config_param->server_max_connections) {
+ if (sum >= t_state.http_config_param->server_max_connections) {
ink_debug_assert(pending_action == NULL);
pending_action = eventProcessor.schedule_in(this, HRTIME_MSECONDS(100));
httpSessionManager.purge_keepalives();
@@ -4408,8 +4342,6 @@ HttpSM::do_http_server_open(bool raw)
MgmtInt connect_timeout;
if (t_state.method == HTTP_WKSIDX_POST || t_state.method == HTTP_WKSIDX_PUT) {
connect_timeout = t_state.http_config_param->post_connect_attempts_timeout;
- } else if (is_request_from_streaming_client(&t_state.hdr_info.client_request)) {
- connect_timeout = t_state.http_config_param->streaming_connect_attempts_timeout;
} else if (t_state.current.server == &t_state.parent_info) {
connect_timeout = t_state.http_config_param->parent_connect_timeout;
} else {
@@ -4435,22 +4367,6 @@ HttpSM::do_http_server_open(bool raw)
return;
}
-//void
-//HttpSM::do_auth_callout()
-//{
-
- // ink_assert(pending_action == NULL);
- //authAdapter.StartAuthenticate(this);
-
-//OLD AND UGLY: Action *auth_action_handle = authAdapter.StartAuthenticate(this);
-// if (auth_action_handle != ACTION_RESULT_DONE)
-// {
-// pending_action = auth_action_handle;
-// historical_action = pending_action;
-// }
-
- // return;
-//}
void
HttpSM::do_icp_lookup()
@@ -4481,43 +4397,46 @@ HttpSM::do_api_callout_internal()
switch (t_state.api_next_action) {
case HttpTransact::HTTP_API_SM_START:
- cur_hook_id = INK_HTTP_TXN_START_HOOK;
+ cur_hook_id = TS_HTTP_TXN_START_HOOK;
+ break;
+ case HttpTransact::HTTP_API_PRE_REMAP:
+ cur_hook_id = TS_HTTP_PRE_REMAP_HOOK;
break;
- case HttpTransact::HTTP_API_READ_REQUEST_PRE_REMAP:
- cur_hook_id = INK_HTTP_READ_REQUEST_PRE_REMAP_HOOK;
+ case HttpTransact::HTTP_API_POST_REMAP:
+ cur_hook_id = TS_HTTP_POST_REMAP_HOOK;
break;
case HttpTransact::HTTP_API_READ_REQUEST_HDR:
- cur_hook_id = INK_HTTP_READ_REQUEST_HDR_HOOK;
+ cur_hook_id = TS_HTTP_READ_REQUEST_HDR_HOOK;
break;
case HttpTransact::HTTP_API_OS_DNS:
- cur_hook_id = INK_HTTP_OS_DNS_HOOK;
+ cur_hook_id = TS_HTTP_OS_DNS_HOOK;
break;
case HttpTransact::HTTP_API_SEND_REQUEST_HDR:
- cur_hook_id = INK_HTTP_SEND_REQUEST_HDR_HOOK;
+ cur_hook_id = TS_HTTP_SEND_REQUEST_HDR_HOOK;
break;
case HttpTransact::HTTP_API_READ_CACHE_HDR:
- cur_hook_id = INK_HTTP_READ_CACHE_HDR_HOOK;
+ cur_hook_id = TS_HTTP_READ_CACHE_HDR_HOOK;
break;
case HttpTransact::HTTP_API_CACHE_LOOKUP_COMPLETE:
- cur_hook_id = INK_HTTP_CACHE_LOOKUP_COMPLETE_HOOK;
+ cur_hook_id = TS_HTTP_CACHE_LOOKUP_COMPLETE_HOOK;
break;
case HttpTransact::HTTP_API_READ_REPONSE_HDR:
- cur_hook_id = INK_HTTP_READ_RESPONSE_HDR_HOOK;
+ cur_hook_id = TS_HTTP_READ_RESPONSE_HDR_HOOK;
break;
case HttpTransact::HTTP_API_SEND_REPONSE_HDR:
- cur_hook_id = INK_HTTP_SEND_RESPONSE_HDR_HOOK;
+ cur_hook_id = TS_HTTP_SEND_RESPONSE_HDR_HOOK;
break;
case HttpTransact::HTTP_API_SM_SHUTDOWN:
if (callout_state == HTTP_API_IN_CALLOUT || callout_state == HTTP_API_DEFERED_SERVER_ERROR) {
callout_state = HTTP_API_DEFERED_CLOSE;
return;
} else {
- cur_hook_id = INK_HTTP_TXN_CLOSE_HOOK;
+ cur_hook_id = TS_HTTP_TXN_CLOSE_HOOK;
}
break;
default:
- cur_hook_id = (INKHttpHookID) - 1;
+ cur_hook_id = (TSHttpHookID) - 1;
ink_assert(!"not reached");
}
@@ -4529,16 +4448,14 @@ HttpSM::do_api_callout_internal()
VConnection *
HttpSM::do_post_transform_open()
{
-
ink_assert(post_transform_info.vc == NULL);
if (is_action_tag_set("http_post_nullt")) {
- txn_hook_prepend(INK_HTTP_REQUEST_TRANSFORM_HOOK, transformProcessor.null_transform(mutex));
+ txn_hook_prepend(TS_HTTP_REQUEST_TRANSFORM_HOOK, transformProcessor.null_transform(mutex));
}
- post_transform_info.vc = transformProcessor.open(this, api_hooks.get(INK_HTTP_REQUEST_TRANSFORM_HOOK));
+ post_transform_info.vc = transformProcessor.open(this, api_hooks.get(TS_HTTP_REQUEST_TRANSFORM_HOOK));
if (post_transform_info.vc) {
-
// Record the transform VC in our table
post_transform_info.entry = vc_table.new_entry();
post_transform_info.entry->vc = post_transform_info.vc;
@@ -4551,15 +4468,14 @@ HttpSM::do_post_transform_open()
VConnection *
HttpSM::do_transform_open()
{
-
ink_assert(transform_info.vc == NULL);
APIHook *hooks;
if (is_action_tag_set("http_nullt")) {
- txn_hook_prepend(INK_HTTP_RESPONSE_TRANSFORM_HOOK, transformProcessor.null_transform(mutex));
+ txn_hook_prepend(TS_HTTP_RESPONSE_TRANSFORM_HOOK, transformProcessor.null_transform(mutex));
}
- hooks = api_hooks.get(INK_HTTP_RESPONSE_TRANSFORM_HOOK);
+ hooks = api_hooks.get(TS_HTTP_RESPONSE_TRANSFORM_HOOK);
if (hooks) {
transform_info.vc = transformProcessor.open(this, hooks);
@@ -4577,7 +4493,6 @@ HttpSM::do_transform_open()
void
HttpSM::mark_host_failure(HostDBInfo * info, time_t time_down)
{
-
if (info->app.http_data.last_failure == 0) {
if (!t_state.traffic_net_req) {
int url_len;
@@ -4614,7 +4529,6 @@ HttpSM::mark_host_failure(HostDBInfo * i
void
HttpSM::set_ua_abort(HttpTransact::AbortState_t ua_abort, int event)
{
-
bool log_spider_codes = t_state.http_config_param->log_spider_codes != 0;
t_state.client_info.abort = ua_abort;
@@ -4650,7 +4564,6 @@ HttpSM::set_ua_abort(HttpTransact::Abort
void
HttpSM::mark_server_down_on_client_abort()
{
-
/////////////////////////////////////////////////////
// Check see if the client aborted because the //
// origin server was too slow in sending the //
@@ -4665,9 +4578,7 @@ HttpSM::mark_server_down_on_client_abort
// the actual origin server is one that is hung //
/////////////////////////////////////////////////////
if (t_state.current.request_to == HttpTransact::ORIGIN_SERVER && t_state.hdr_info.request_content_length == 0) {
-
if (milestones.server_first_connect != 0 && milestones.server_first_read == 0) {
-
// Check to see if client waited for the threshold
// to declare the origin server as down
ink_hrtime wait = ink_get_hrtime() - milestones.server_first_connect;
@@ -4731,7 +4642,6 @@ HttpSM::release_server_session(bool serv
void
HttpSM::handle_post_failure()
{
-
STATE_ENTER(&HttpSM::handle_post_failure, VC_EVENT_NONE);
ink_assert(ua_entry->vc == ua_session);
@@ -4775,7 +4685,6 @@ HttpSM::handle_post_failure()
void
HttpSM::handle_http_server_open()
{
-
if (t_state.pCongestionEntry != NULL) {
if (t_state.congestion_connection_opened == 0) {
t_state.congestion_connection_opened = 1;
@@ -4802,7 +4711,6 @@ HttpSM::handle_http_server_open()
void
HttpSM::handle_server_setup_error(int event, void *data)
{
-
VIO *vio = (VIO *) data;
ink_assert(vio != NULL);
@@ -4974,7 +4882,6 @@ HttpSM::do_drain_request_body()
void
HttpSM::do_setup_post_tunnel(HttpVC_t to_vc_type)
{
-
bool chunked = (t_state.client_info.transfer_encoding == HttpTransact::CHUNKED_ENCODING);
bool post_redirect = false;
@@ -5001,7 +4908,6 @@ HttpSM::do_setup_post_tunnel(HttpVC_t to
int alloc_index;
// content length is undefined, use default buffer size
if (t_state.hdr_info.request_content_length == HTTP_UNDEFINED_CL) {
-
alloc_index = (int) t_state.http_config_param->default_buffer_size_index;
if (alloc_index<MIN_CONFIG_BUFFER_SIZE_INDEX || alloc_index> MAX_BUFFER_SIZE_INDEX) {
alloc_index = DEFAULT_REQUEST_BUFFER_SIZE_INDEX;
@@ -5073,7 +4979,6 @@ HttpSM::do_setup_post_tunnel(HttpVC_t to
void
HttpSM::perform_transform_cache_write_action()
{
-
Debug("http", "[%lld] perform_transform_cache_write_action %s", sm_id,
HttpDebugNames::get_cache_action_name(t_state.cache_info.action));
@@ -5114,7 +5019,6 @@ HttpSM::perform_transform_cache_write_ac
void
HttpSM::perform_cache_write_action()
{
-
Debug("http", "[%lld] perform_cache_write_action %s",
sm_id, HttpDebugNames::get_cache_action_name(t_state.cache_info.action));
@@ -5229,53 +5133,9 @@ HttpSM::write_header_into_buffer(HTTPHdr
return dumpoffset;
}
-inline bool
-is_request_from_streaming_client(HTTPHdr * hdr)
-{
- if (!hdr->valid())
- return false;
-
- if (hdr->presence(MIME_PRESENCE_USER_AGENT)) {
- int length;
- const char *user_agent = hdr->value_get(MIME_FIELD_USER_AGENT,
- MIME_LEN_USER_AGENT, &length);
-
- // be as efficient as possible - avoid unnecessary calls to memcmp
- if (length <= 0)
- return false;
-
- switch (*user_agent) {
- case 'Q':
- // QTS - QuickTime
- if (length > 2 && memcmp(user_agent + 1, "TS", 2) == 0)
- return true;
- break;
- case 'R':
- // RMA, RealPlayer or RealMediaPlayer - Real
- if (length > 2 && memcmp(user_agent + 1, "MA", 2) == 0)
- return true;
- else if (length > 9 && memcmp(user_agent + 1, "ealPlayer", 9) == 0)
- return true;
- else if (length > 14 && memcmp(user_agent + 1, "ealMediaPlayer", 14) == 0)
- return true;
- break;
- case 'N':
- // NSPlayer - WMT
- if (length > 7 && memcmp(user_agent + 1, "SPlayer", 7) == 0)
- return true;
- break;
- default:
- break;
- }
- }
-
- return false;
-}
-
void
HttpSM::attach_server_session(HttpServerSession * s)
{
-
hsm_release_assert(server_session == NULL);
hsm_release_assert(server_entry == NULL);
hsm_release_assert(s->state == HSS_ACTIVE);
@@ -5324,8 +5184,6 @@ HttpSM::attach_server_session(HttpServer
MgmtInt connect_timeout;
if (t_state.method == HTTP_WKSIDX_POST || t_state.method == HTTP_WKSIDX_PUT) {
connect_timeout = t_state.http_config_param->post_connect_attempts_timeout;
- } else if (is_request_from_streaming_client(&t_state.hdr_info.client_request)) {
- connect_timeout = t_state.http_config_param->streaming_connect_attempts_timeout;
} else if (t_state.current.server == &t_state.parent_info) {
connect_timeout = t_state.http_config_param->parent_connect_timeout;
} else {
@@ -5361,7 +5219,6 @@ HttpSM::setup_server_send_request_api()
void
HttpSM::setup_server_send_request()
{
-
bool api_set;
int hdr_length;
int64 msg_len = 0; /* lv: just make gcc happy */
@@ -5411,7 +5268,6 @@ HttpSM::setup_server_send_request()
void
HttpSM::setup_server_read_response_header()
{
-
ink_assert(server_session != NULL);
ink_assert(server_entry != NULL);
// REQ_FLAVOR_SCHEDULED_UPDATE can be transformed in REQ_FLAVOR_REVPROXY
@@ -5482,7 +5338,6 @@ HttpSM::setup_server_read_response_heade
void
HttpSM::setup_cache_read_transfer()
{
-
int alloc_index, hdr_size;
int64 doc_size;
@@ -5526,7 +5381,6 @@ HttpSM::setup_cache_read_transfer()
HttpTunnelProducer *
HttpSM::setup_cache_transfer_to_transform()
{
-
int alloc_index;
int64 doc_size;
@@ -5567,7 +5421,6 @@ void
HttpSM::setup_cache_write_transfer(HttpCacheSM * c_sm,
VConnection * source_vc, HTTPInfo * store_info, int64 skip_bytes, const char *name)
{
-
ink_assert(c_sm->cache_write_vc != NULL);
ink_assert(t_state.request_sent_time > 0);
ink_assert(t_state.response_received_time > 0);
@@ -5587,7 +5440,6 @@ HttpSM::setup_cache_write_transfer(HttpC
void
HttpSM::setup_100_continue_transfer()
{
-
int64 buf_size = HTTP_HEADER_BUFFER_SIZE;
MIOBuffer *buf = new_MIOBuffer(buffer_size_to_index(buf_size));
@@ -5651,7 +5503,6 @@ HttpSM::setup_error_transfer()
void
HttpSM::setup_internal_transfer(HttpSMHandler handler_arg)
{
-
bool is_msg_buf_present;
if (t_state.internal_msg_buffer) {
is_msg_buf_present = true;
@@ -5703,7 +5554,6 @@ HttpSM::setup_internal_transfer(HttpSMHa
// to it so that it can be freed.
if (is_msg_buf_present && t_state.method != HTTP_WKSIDX_HEAD) {
-
nbytes += t_state.internal_msg_buffer_size;
if (t_state.internal_msg_buffer_fast_allocator_size < 0)
@@ -5820,7 +5670,6 @@ HttpSM::server_transfer_init(MIOBuffer *
HttpTunnelProducer *
HttpSM::setup_server_transfer_to_transform()
{
-
int alloc_index;
int64 nbytes;
@@ -5861,7 +5710,6 @@ HttpSM::setup_server_transfer_to_transfo
HttpTunnelProducer *
HttpSM::setup_transfer_from_transform()
{
-
int alloc_index = find_server_buffer_size();
// TODO change this call to new_empty_MIOBuffer()
@@ -5901,7 +5749,6 @@ HttpSM::setup_transfer_from_transform()
HttpTunnelProducer *
HttpSM::setup_transfer_from_transform_to_cache_only()
{
-
int alloc_index = find_server_buffer_size();
MIOBuffer *buf = new_MIOBuffer(alloc_index);
IOBufferReader *buf_start = buf->alloc_reader();
@@ -5966,7 +5813,6 @@ HttpSM::setup_server_transfer_to_cache_o
void
HttpSM::setup_server_transfer()
{
-
int alloc_index, hdr_size;
int64 nbytes;
@@ -6051,7 +5897,6 @@ HttpSM::setup_server_transfer()
void
HttpSM::setup_push_transfer_to_cache()
{
-
int64 nbytes, alloc_index;
alloc_index = find_http_resp_buffer_size(t_state.hdr_info.request_content_length);
@@ -6094,7 +5939,6 @@ HttpSM::setup_push_transfer_to_cache()
void
HttpSM::setup_blind_tunnel(bool send_response_hdr)
{
-
HttpTunnelConsumer *c_ua;
HttpTunnelConsumer *c_os;
HttpTunnelProducer *p_ua;
@@ -6146,7 +5990,7 @@ HttpSM::setup_blind_tunnel(bool send_res
}
inline void
-HttpSM::transform_cleanup(INKHttpHookID hook, HttpTransformInfo * info)
+HttpSM::transform_cleanup(TSHttpHookID hook, HttpTransformInfo * info)
{
APIHook *t_hook = api_hooks.get(hook);
if (t_hook && info->vc == NULL) {
@@ -6195,7 +6039,6 @@ HttpSM::kill_this()
}
if (kill_this_async_done == false) {
-
////////////////////////////////
// cancel uncompleted actions //
////////////////////////////////
@@ -6221,8 +6064,8 @@ HttpSM::kill_this()
// In that case, we need to manually close all the
// transforms to prevent memory leaks (INKqa06147)
if (hooks_set) {
- transform_cleanup(INK_HTTP_RESPONSE_TRANSFORM_HOOK, &transform_info);
- transform_cleanup(INK_HTTP_REQUEST_TRANSFORM_HOOK, &post_transform_info);
+ transform_cleanup(TS_HTTP_RESPONSE_TRANSFORM_HOOK, &transform_info);
+ transform_cleanup(TS_HTTP_REQUEST_TRANSFORM_HOOK, &post_transform_info);
}
// It's also possible that the plugin_tunnel vc was never
// executed due to not contacting the server
@@ -6260,7 +6103,6 @@ HttpSM::kill_this()
// then the value of kill_this_async_done has changed so
// we must check it again
if (kill_this_async_done == true) {
-
// In the async state, the plugin could have been
// called resulting in the creation of a plugin_tunnel.
// So it needs to be deleted now.
@@ -6305,7 +6147,6 @@ HttpSM::kill_this()
void
HttpSM::update_stats()
{
-
milestones.sm_finish = ink_get_hrtime();
if (t_state.cop_test_page && !t_state.http_config_param->record_cop_page) {
@@ -6415,7 +6256,6 @@ HttpSM::update_stats()
// print slow requests if the threshold is set (> 0) and if we are over the time threshold
if (t_state.http_config_param->slow_log_threshold != 0 &&
ink_hrtime_from_msec(t_state.http_config_param->slow_log_threshold) < total_time) {
-
// get the url to log
URL *url = t_state.hdr_info.client_request.url_get();
char url_string[256];
@@ -6515,7 +6355,6 @@ HttpSM::update_stats()
void
HttpSM::dump_state_on_assert()
{
-
Error("[%lld] ------- begin http state dump -------", sm_id);
int hist_size = this->history_pos;
@@ -6553,7 +6392,6 @@ HttpSM::dump_state_on_assert()
void
HttpSM::dump_state_hdr(HTTPHdr *h, const char *s)
{
-
// Dump the client request if available
if (h->valid()) {
int l = h->length_get();
@@ -6635,9 +6473,9 @@ HttpSM::set_next_state()
// Use the returned "next action" code to set the next state handler //
///////////////////////////////////////////////////////////////////////
switch (t_state.next_action) {
-
- case HttpTransact::HTTP_API_READ_REQUEST_PRE_REMAP:
case HttpTransact::HTTP_API_READ_REQUEST_HDR:
+ case HttpTransact::HTTP_API_PRE_REMAP:
+ case HttpTransact::HTTP_API_POST_REMAP:
case HttpTransact::HTTP_API_OS_DNS:
case HttpTransact::HTTP_API_SEND_REQUEST_HDR:
case HttpTransact::HTTP_API_READ_CACHE_HDR:
@@ -6649,7 +6487,13 @@ HttpSM::set_next_state()
do_api_callout();
break;
}
-
+
+ case HttpTransact::HTTP_POST_REMAP_SKIP:
+ {
+ call_transact_and_set_next_state(NULL);
+ break;
+ }
+
case HttpTransact::HTTP_REMAP_REQUEST:
{
if (!remapProcessor.using_separate_thread()) {
@@ -6662,25 +6506,10 @@ HttpSM::set_next_state()
do_remap_request(false); /* dont run inline (iow on another thread) */
}
break;
- }
-
- /*case HttpTransact::HTTP_START_REMAP_REQUEST:
- {
- nop for now
- call_transact_and_set_next_state(NULL);
- break;
- } */
- case HttpTransact::HTTP_END_REMAP_REQUEST:
- {
- /* nop for now */
- call_transact_and_set_next_state(NULL);
- break;
- }
-
+ }
+
case HttpTransact::DNS_LOOKUP:
{
- uint32 addr;
-
if (url_remap_mode == 2 && t_state.first_dns_lookup) {
Debug("cdn", "Skipping DNS Lookup");
// skip the DNS lookup
@@ -6723,15 +6552,6 @@ HttpSM::set_next_state()
break;
}
- //case HttpTransact::AUTH_LOOKUP:
- // {
- // HTTP_SM_SET_DEFAULT_HANDLER(&HttpSM::state_auth_callback);
-
- // do_auth_callout();
- //break;
-
- //}
-
case HttpTransact::CACHE_LOOKUP:
{
HTTP_SM_SET_DEFAULT_HANDLER(&HttpSM::state_cache_open_read);
@@ -6742,8 +6562,7 @@ HttpSM::set_next_state()
case HttpTransact::ORIGIN_SERVER_OPEN:
{
- if (congestionControlEnabled
- && (t_state.congest_saved_next_action == HttpTransact::STATE_MACHINE_ACTION_UNDEFINED)) {
+ if (congestionControlEnabled && (t_state.congest_saved_next_action == HttpTransact::STATE_MACHINE_ACTION_UNDEFINED)) {
t_state.congest_saved_next_action = HttpTransact::ORIGIN_SERVER_OPEN;
HTTP_SM_SET_DEFAULT_HANDLER(&HttpSM::state_congestion_control_lookup);
if (!do_congestion_control_lookup())
@@ -6878,7 +6697,6 @@ HttpSM::set_next_state()
case HttpTransact::PROXY_INTERNAL_CACHE_DELETE:
{
-
// Nuke all the alternates since this is mostly likely
// the result of a delete method
cache_sm.end_both();
@@ -6940,8 +6758,7 @@ HttpSM::set_next_state()
}
case HttpTransact::ORIGIN_SERVER_RAW_OPEN:{
- if (congestionControlEnabled
- && (t_state.congest_saved_next_action == HttpTransact::STATE_MACHINE_ACTION_UNDEFINED)) {
+ if (congestionControlEnabled && (t_state.congest_saved_next_action == HttpTransact::STATE_MACHINE_ACTION_UNDEFINED)) {
t_state.congest_saved_next_action = HttpTransact::ORIGIN_SERVER_RAW_OPEN;
HTTP_SM_SET_DEFAULT_HANDLER(&HttpSM::state_congestion_control_lookup);
if (!do_congestion_control_lookup())
@@ -6958,15 +6775,12 @@ HttpSM::set_next_state()
case HttpTransact::ICP_QUERY:
{
HTTP_SM_SET_DEFAULT_HANDLER(&HttpSM::state_icp_lookup);
-
do_icp_lookup();
-
break;
}
case HttpTransact::CACHE_ISSUE_WRITE_TRANSFORM:
{
-
ink_assert(t_state.cache_info.transform_action == HttpTransact::CACHE_PREPARE_TO_WRITE);
if (transform_cache_sm.cache_write_vc) {
@@ -6977,7 +6791,6 @@ HttpSM::set_next_state()
t_state.cache_info.write_lock_state = HttpTransact::CACHE_WL_SUCCESS;
call_transact_and_set_next_state(NULL);
} else {
-
HTTP_SM_SET_DEFAULT_HANDLER(&HttpSM::state_cache_open_write);
do_cache_prepare_write_transform();
@@ -7107,9 +6920,7 @@ HttpSM::do_redirect()
HTTPStatus status = t_state.hdr_info.client_response.status_get();
// if redirect_url is set by an user's plugin, yts will redirect to this url anyway.
if ((redirect_url != NULL) || (status == HTTP_STATUS_MOVED_TEMPORARILY) || (status == HTTP_STATUS_MOVED_PERMANENTLY)) {
-
if (redirect_url != NULL || t_state.hdr_info.client_response.field_find(MIME_FIELD_LOCATION, MIME_LEN_LOCATION)) {
-
if (Log::transaction_logging_enabled() && t_state.api_info.logging_enabled) {
LogAccessHttp accessor(this);
if (redirect_url == NULL) {
@@ -7117,8 +6928,7 @@ HttpSM::do_redirect()
t_state.squid_codes.log_code = SQUID_LOG_TCP_HIT_REDIRECT;
else
t_state.squid_codes.log_code = SQUID_LOG_TCP_MISS_REDIRECT;
- }
- else {
+ } else {
if (t_state.squid_codes.log_code == SQUID_LOG_TCP_HIT)
t_state.squid_codes.log_code = SQUID_LOG_TCP_HIT_X_REDIRECT;
else
@@ -7266,4 +7076,3 @@ int HttpSM::get_http_schedule(int event,
return 0;
}
-
Modified: trafficserver/traffic/branches/wccp/proxy/http2/HttpSM.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/branches/wccp/proxy/http2/HttpSM.h?rev=1040383&r1=1040382&r2=1040383&view=diff
==============================================================================
--- trafficserver/traffic/branches/wccp/proxy/http2/HttpSM.h (original)
+++ trafficserver/traffic/branches/wccp/proxy/http2/HttpSM.h Tue Nov 30 01:42:55 2010
@@ -255,9 +255,9 @@ public:
void dump_state_hdr(HTTPHdr *h, const char *s);
// Functions for manipulating api hooks
- void txn_hook_append(INKHttpHookID id, INKContInternal * cont);
- void txn_hook_prepend(INKHttpHookID id, INKContInternal * cont);
- APIHook *txn_hook_get(INKHttpHookID id);
+ void txn_hook_append(TSHttpHookID id, INKContInternal * cont);
+ void txn_hook_prepend(TSHttpHookID id, INKContInternal * cont);
+ APIHook *txn_hook_get(TSHttpHookID id);
void add_history_entry(const char *fileline, int event, int reentrant);
void add_cache_sm();
@@ -387,8 +387,7 @@ protected:
// API
int state_request_wait_for_transform_read(int event, void *data);
int state_response_wait_for_transform_read(int event, void *data);
- int state_common_wait_for_transform_read(HttpTransformInfo * t_info,
- HttpSMHandler tunnel_handler, int event, void *data);
+ int state_common_wait_for_transform_read(HttpTransformInfo * t_info, HttpSMHandler tunnel_handler, int event, void *data);
// Tunnel event handlers
int tunnel_handler_server(int event, HttpTunnelProducer * p);
@@ -496,7 +495,7 @@ public:
int hooks_set;
protected:
- INKHttpHookID cur_hook_id;
+ TSHttpHookID cur_hook_id;
APIHook *cur_hook;
//
@@ -525,7 +524,7 @@ protected:
virtual int kill_this_async_hook(int event, void *data);
void kill_this();
void update_stats();
- void transform_cleanup(INKHttpHookID hook, HttpTransformInfo * info);
+ void transform_cleanup(TSHttpHookID hook, HttpTransformInfo * info);
public:
LINK(HttpSM, debug_link);
@@ -594,21 +593,21 @@ HttpSM::find_server_buffer_size()
}
inline void
-HttpSM::txn_hook_append(INKHttpHookID id, INKContInternal * cont)
+HttpSM::txn_hook_append(TSHttpHookID id, INKContInternal * cont)
{
api_hooks.append(id, cont);
hooks_set = 1;
}
inline void
-HttpSM::txn_hook_prepend(INKHttpHookID id, INKContInternal * cont)
+HttpSM::txn_hook_prepend(TSHttpHookID id, INKContInternal * cont)
{
api_hooks.prepend(id, cont);
hooks_set = 1;
}
inline APIHook *
-HttpSM::txn_hook_get(INKHttpHookID id)
+HttpSM::txn_hook_get(TSHttpHookID id)
{
return api_hooks.get(id);
}
Modified: trafficserver/traffic/branches/wccp/proxy/http2/HttpServerSession.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/branches/wccp/proxy/http2/HttpServerSession.cc?rev=1040383&r1=1040382&r2=1040383&view=diff
==============================================================================
--- trafficserver/traffic/branches/wccp/proxy/http2/HttpServerSession.cc (original)
+++ trafficserver/traffic/branches/wccp/proxy/http2/HttpServerSession.cc Tue Nov 30 01:42:55 2010
@@ -39,24 +39,6 @@
static int64 next_ss_id = (int64) 0;
ClassAllocator<HttpServerSession> httpServerSessionAllocator("httpServerSessionAllocator");
-enum
-{
- HTTP_SS_MAGIC_ALIVE = 0x0123FEED,
- HTTP_SS_MAGIC_DEAD = 0xDEADFEED
-};
-
-HttpServerSession::HttpServerSession():
-VConnection(NULL),
-server_ip(0), server_port(0), hostname_hash(),
-host_hash_computed(false), con_id(0), transact_count(0),
-state(HSS_INIT), to_parent_proxy(false), server_trans_stat(0),
-private_session(false),
-enable_origin_connection_limiting(false),
-connection_count(NULL),
-read_buffer(NULL), server_vc(NULL), magic(HTTP_SS_MAGIC_DEAD), buf_reader(NULL)
-{
-}
-
void
HttpServerSession::destroy()
{
@@ -84,7 +66,6 @@ HttpServerSession::allocate()
void
HttpServerSession::new_connection(NetVConnection * new_vc)
{
-
ink_assert(new_vc != NULL);
server_vc = new_vc;
@@ -98,7 +79,7 @@ HttpServerSession::new_connection(NetVCo
con_id = ink_atomic_increment64((int64 *) (&next_ss_id), 1);
magic = HTTP_SS_MAGIC_ALIVE;
- HTTP_INCREMENT_DYN_STAT(http_current_server_connections_stat);
+ HTTP_SUM_GLOBAL_DYN_STAT(http_current_server_connections_stat, 1); // Update the true global stat
HTTP_INCREMENT_DYN_STAT(http_total_server_connections_stat);
// Check to see if we are limiting the number of connections
// per host
@@ -106,8 +87,7 @@ HttpServerSession::new_connection(NetVCo
if(connection_count == NULL)
connection_count = ConnectionCount::getInstance();
connection_count->incrementCount(server_ip);
- Debug("http_ss", "[%lld] new connection, ip: %u, count: %u",
- con_id, server_ip, connection_count->getCount(server_ip));
+ Debug("http_ss", "[%lld] new connection, ip: %u, count: %u", con_id, server_ip, connection_count->getCount(server_ip));
}
#ifdef LAZY_BUF_ALLOC
read_buffer = new_empty_MIOBuffer(HTTP_SERVER_RESP_HDR_BUFFER_INDEX);
@@ -144,17 +124,13 @@ HttpServerSession::do_io_close(int alerr
HTTP_DECREMENT_DYN_STAT(http_current_server_transactions_stat);
this->server_trans_stat--;
}
+
server_vc->do_io_close(alerrno);
Debug("http_ss", "[%lld] session closed", con_id);
server_vc = NULL;
-// Have to a taken mutex to use normal stat stuff now, we don't
-// so use funny macros here....
-// HTTP_DECREMENT_DYN_STAT(http_current_server_connections_stat);
-// HTTP_SUM_DYN_STAT(http_transactions_per_server_con, transact_count);
-
- HTTP_SUM_GLOBAL_DYN_STAT(http_current_server_connections_stat, -1);
- HTTP_SUM_GLOBAL_DYN_STAT(http_transactions_per_server_con, transact_count);
+ HTTP_SUM_GLOBAL_DYN_STAT(http_current_server_connections_stat, -1); // Make sure to work on the global stat
+ HTTP_SUM_DYN_STAT(http_transactions_per_server_con, transact_count);
// Check to see if we are limiting the number of connections
// per host
@@ -171,7 +147,7 @@ HttpServerSession::do_io_close(int alerr
}
if (to_parent_proxy) {
- HTTP_SUM_GLOBAL_DYN_STAT(http_current_parent_proxy_connections_stat, -1);
+ HTTP_DECREMENT_DYN_STAT(http_current_parent_proxy_connections_stat);
}
destroy();
}
Modified: trafficserver/traffic/branches/wccp/proxy/http2/HttpServerSession.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/branches/wccp/proxy/http2/HttpServerSession.h?rev=1040383&r1=1040382&r2=1040383&view=diff
==============================================================================
--- trafficserver/traffic/branches/wccp/proxy/http2/HttpServerSession.h (original)
+++ trafficserver/traffic/branches/wccp/proxy/http2/HttpServerSession.h Tue Nov 30 01:42:55 2010
@@ -52,24 +52,34 @@ class HttpSM;
class MIOBuffer;
class IOBufferReader;
-enum HSS_State
-{
+enum HSS_State {
HSS_INIT,
HSS_ACTIVE,
HSS_KA_CLIENT_SLAVE,
- HSS_KA_SHARED
+ HSS_KA_SHARED
+};
+
+enum {
+ HTTP_SS_MAGIC_ALIVE = 0x0123FEED,
+ HTTP_SS_MAGIC_DEAD = 0xDEADFEED
};
-class HttpServerSession:public VConnection
+class HttpServerSession : public VConnection
{
public:
- HttpServerSession();
- void destroy();
+ HttpServerSession()
+ : VConnection(NULL),
+ server_ip(0), server_port(0), hostname_hash(),
+ host_hash_computed(false), con_id(0), transact_count(0),
+ state(HSS_INIT), to_parent_proxy(false), server_trans_stat(0),
+ private_session(false),
+ enable_origin_connection_limiting(false),
+ connection_count(NULL),
+ read_buffer(NULL), server_vc(NULL), magic(HTTP_SS_MAGIC_DEAD), buf_reader(NULL)
+ { }
-public:
+ void destroy();
static HttpServerSession *allocate();
-
-public:
void new_connection(NetVConnection * new_vc);
void reset_read_buffer(void)