You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2011/01/01 18:09:13 UTC
svn commit: r1054257 - in /trafficserver/traffic/trunk/proxy:
CacheControl.cc CacheControl.h InkAPI.cc api/ts/ts.h.in http2/HttpConfig.cc
http2/HttpConfig.h http2/HttpSM.cc http2/HttpTransact.cc http2/HttpTransact.h
Author: zwoop
Date: Sat Jan 1 17:09:12 2011
New Revision: 1054257
URL: http://svn.apache.org/viewvc?rev=1054257&view=rev
Log:
TS-599 Added more options, and cleaned things up a little. Checkpoint.
Modified:
trafficserver/traffic/trunk/proxy/CacheControl.cc
trafficserver/traffic/trunk/proxy/CacheControl.h
trafficserver/traffic/trunk/proxy/InkAPI.cc
trafficserver/traffic/trunk/proxy/api/ts/ts.h.in
trafficserver/traffic/trunk/proxy/http2/HttpConfig.cc
trafficserver/traffic/trunk/proxy/http2/HttpConfig.h
trafficserver/traffic/trunk/proxy/http2/HttpSM.cc
trafficserver/traffic/trunk/proxy/http2/HttpTransact.cc
trafficserver/traffic/trunk/proxy/http2/HttpTransact.h
Modified: trafficserver/traffic/trunk/proxy/CacheControl.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/CacheControl.cc?rev=1054257&r1=1054256&r2=1054257&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/CacheControl.cc (original)
+++ trafficserver/traffic/trunk/proxy/CacheControl.cc Sat Jan 1 17:09:12 2011
@@ -177,20 +177,21 @@ reloadCacheControl()
}
void
-getCacheControl(CacheControlResult * result, HttpRequestData * rdata, HttpConfigParams * h_params, char *tag)
+getCacheControl(CacheControlResult *result, HttpRequestData *rdata, HttpConfigParams *h_params,
+ OverridableHttpConfigParams *h_txn_conf, char *tag)
{
rdata->tag = tag;
CacheControlTable->Match(rdata, result);
- if (h_params->cache_ignore_client_no_cache) {
+ if (h_txn_conf->cache_ignore_client_no_cache) {
result->ignore_client_no_cache = true;
}
- if (h_params->cache_ignore_server_no_cache) {
+ if (h_txn_conf->cache_ignore_server_no_cache) {
result->ignore_server_no_cache = true;
}
- if (!h_params->cache_ignore_client_cc_max_age) {
+ if (!h_txn_conf->cache_ignore_client_cc_max_age) {
result->ignore_client_cc_max_age = false;
}
}
@@ -461,17 +462,18 @@ CacheControlRecord::UpdateMatch(CacheCon
{
}
void
-getCacheControl(CacheControlResult * result, HttpRequestData * rdata, HttpConfigParams * h_params)
+getCacheControl(CacheControlResult * result, HttpRequestData * rdata, HttpConfigParams * h_params,
+ OverridableHttpConfigParams *h_txn_conf)
{
- if (h_params->cache_ignore_client_no_cache) {
+ if (h_txn_conf->cache_ignore_client_no_cache) {
result->ignore_client_no_cache = true;
}
- if (h_params->cache_ignore_server_no_cache) {
+ if (h_txn_conf->cache_ignore_server_no_cache) {
result->ignore_server_no_cache = true;
}
- if (!h_params->cache_ignore_client_cc_max_age) {
+ if (!h_txn_conf->cache_ignore_client_cc_max_age) {
result->ignore_client_cc_max_age = false;
}
}
Modified: trafficserver/traffic/trunk/proxy/CacheControl.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/CacheControl.h?rev=1054257&r1=1054256&r2=1054257&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/CacheControl.h (original)
+++ trafficserver/traffic/trunk/proxy/CacheControl.h Sat Jan 1 17:09:12 2011
@@ -47,10 +47,18 @@ const int CC_UNSET_TIME = -1;
//#define CACHE_CONTROL_TIMEOUT (HRTIME_SECOND*10)
enum CacheControlType
-{ CC_INVALID = 0, CC_REVALIDATE_AFTER, CC_NEVER_CACHE,
- CC_STANDARD_CACHE, CC_IGNORE_NO_CACHE, CC_IGNORE_CLIENT_NO_CACHE,
- //CC_IGNORE_SERVER_NO_CACHE, CC_PIN_IN_CACHE, CC_TTL_IN_CACHE, CC_CACHE_AUTH_CONTENT, CC_NUM_TYPES
- CC_IGNORE_SERVER_NO_CACHE, CC_PIN_IN_CACHE, CC_TTL_IN_CACHE, CC_NUM_TYPES
+{
+ CC_INVALID = 0,
+ CC_REVALIDATE_AFTER,
+ CC_NEVER_CACHE,
+ CC_STANDARD_CACHE,
+ CC_IGNORE_NO_CACHE,
+ CC_IGNORE_CLIENT_NO_CACHE,
+ //CC_IGNORE_SERVER_NO_CACHE,CC_PIN_IN_CACHE, CC_TTL_IN_CACHE, CC_CACHE_AUTH_CONTENT, CC_NUM_TYPES
+ CC_IGNORE_SERVER_NO_CACHE,
+ CC_PIN_IN_CACHE,
+ CC_TTL_IN_CACHE,
+ CC_NUM_TYPES
};
struct matcher_line;
@@ -93,26 +101,25 @@ public:
};
inline
-CacheControlResult::CacheControlResult():
-revalidate_after(CC_UNSET_TIME),
-pin_in_cache_for(CC_UNSET_TIME),
-ttl_in_cache(CC_UNSET_TIME),
-never_cache(false),
-ignore_client_no_cache(false),
-ignore_server_no_cache(false),
-ignore_client_cc_max_age(true),
-//cache_auth_content(false),
-reval_line(-1),
-never_line(-1),
-pin_line(-1),
-ttl_line(-1),
-ignore_client_line(-1),
-ignore_server_line(-1)
-//cache_auth_line(-1)
-{
-}
+CacheControlResult::CacheControlResult()
+ : revalidate_after(CC_UNSET_TIME),
+ pin_in_cache_for(CC_UNSET_TIME),
+ ttl_in_cache(CC_UNSET_TIME),
+ never_cache(false),
+ ignore_client_no_cache(false),
+ ignore_server_no_cache(false),
+ ignore_client_cc_max_age(true),
+ //cache_auth_content(false),
+ reval_line(-1),
+ never_line(-1),
+ pin_line(-1),
+ ttl_line(-1),
+ ignore_client_line(-1),
+ ignore_server_line(-1)
+ //cache_auth_line(-1)
+{ }
-class CacheControlRecord:public ControlBase
+class CacheControlRecord : public ControlBase
{
public:
CacheControlRecord();
@@ -124,20 +131,19 @@ public:
};
inline
-CacheControlRecord::CacheControlRecord():
-ControlBase(),
-directive(CC_INVALID),
-time_arg(0)
-{
-}
+CacheControlRecord::CacheControlRecord()
+ : ControlBase(), directive(CC_INVALID), time_arg(0)
+{}
//
// API to outside world
//
class URL;
struct HttpConfigParams;
-inkcoreapi void getCacheControl(CacheControlResult * result,
- HttpRequestData * rdata, HttpConfigParams * h_params, char *tag = NULL);
+struct OverridableHttpConfigParams;
+
+inkcoreapi void getCacheControl(CacheControlResult *result, HttpRequestData * rdata, HttpConfigParams * h_params,
+ OverridableHttpConfigParams *h_txn_conf, char *tag = NULL);
inkcoreapi bool host_rule_in_CacheControlTable();
inkcoreapi bool ip_rule_in_CacheControlTable();
Modified: trafficserver/traffic/trunk/proxy/InkAPI.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/InkAPI.cc?rev=1054257&r1=1054256&r2=1054257&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/InkAPI.cc (original)
+++ trafficserver/traffic/trunk/proxy/InkAPI.cc Sat Jan 1 17:09:12 2011
@@ -7385,6 +7385,8 @@ TSHttpTxnConfigIntSet(TSHttpTxn txnp, TS
HttpSM *sm = (HttpSM*) txnp;
+ // *((MgmtInt*)(&(sm->t_state.txn_conf) + conf*sizeof(MgmtInt))) = value;
+
switch (conf) {
case TS_CONFIG_URL_REMAP_PRISTINE_HOST_HDR:
sm->t_state.txn_conf.maintain_pristine_host_hdr = value;
@@ -7437,6 +7439,27 @@ TSHttpTxnConfigIntSet(TSHttpTxn txnp, TS
case TS_CONFIG_HTTP_RESPONSE_SERVER_ENABLED:
sm->t_state.txn_conf.append_xforwards_header = value;
break;
+ case TS_CONFIG_HTTP_INSERT_SQUID_X_FORWARDED_FOR:
+ sm->t_state.txn_conf.append_xforwards_header = value;
+ break;
+ case TS_CONFIG_HTTP_SEND_HTTP11_REQUESTS:
+ sm->t_state.txn_conf.send_http11_requests = value;
+ break;
+ case TS_CONFIG_HTTP_CACHE_HTTP:
+ sm->t_state.txn_conf.cache_http = value;
+ break;
+ case TS_CONFIG_HTTP_CACHE_IGNORE_CLIENT_NO_CACHE:
+ sm->t_state.txn_conf.cache_ignore_client_no_cache = value;
+ break;
+ case TS_CONFIG_HTTP_CACHE_IGNORE_CLIENT_CC_MAX_AGE:
+ sm->t_state.txn_conf.cache_ignore_client_cc_max_age = value;
+ break;
+ case TS_CONFIG_HTTP_CACHE_IMS_ON_CLIENT_NO_CACHE:
+ sm->t_state.txn_conf.cache_ims_on_client_no_cache = value;
+ break;
+ case TS_CONFIG_HTTP_CACHE_IGNORE_SERVER_NO_CACHE:
+ sm->t_state.txn_conf.cache_ignore_server_no_cache = value;
+ break;
default:
return TS_ERROR;
break;
@@ -7453,6 +7476,8 @@ TSHttpTxnConfigIntGet(TSHttpTxn txnp, TS
HttpSM *sm = (HttpSM*) txnp;
+ // *value = *((MgmtInt*)(&(sm->t_state.txn_conf) + conf*sizeof(MgmtInt)));
+
switch (conf) {
case TS_CONFIG_URL_REMAP_PRISTINE_HOST_HDR:
*value = sm->t_state.txn_conf.maintain_pristine_host_hdr;
@@ -7505,6 +7530,27 @@ TSHttpTxnConfigIntGet(TSHttpTxn txnp, TS
case TS_CONFIG_HTTP_RESPONSE_SERVER_ENABLED:
*value = sm->t_state.txn_conf.append_xforwards_header;
break;
+ case TS_CONFIG_HTTP_INSERT_SQUID_X_FORWARDED_FOR:
+ *value = sm->t_state.txn_conf.append_xforwards_header;
+ break;
+ case TS_CONFIG_HTTP_SEND_HTTP11_REQUESTS:
+ *value = sm->t_state.txn_conf.send_http11_requests;
+ break;
+ case TS_CONFIG_HTTP_CACHE_HTTP:
+ *value = sm->t_state.txn_conf.cache_http;
+ break;
+ case TS_CONFIG_HTTP_CACHE_IGNORE_CLIENT_NO_CACHE:
+ *value = sm->t_state.txn_conf.cache_ignore_client_no_cache;
+ break;
+ case TS_CONFIG_HTTP_CACHE_IGNORE_CLIENT_CC_MAX_AGE:
+ *value = sm->t_state.txn_conf.cache_ignore_client_cc_max_age;
+ break;
+ case TS_CONFIG_HTTP_CACHE_IMS_ON_CLIENT_NO_CACHE:
+ *value = sm->t_state.txn_conf.cache_ims_on_client_no_cache;
+ break;
+ case TS_CONFIG_HTTP_CACHE_IGNORE_SERVER_NO_CACHE:
+ *value = sm->t_state.txn_conf.cache_ignore_server_no_cache;
+ break;
default:
return TS_ERROR;
break;
@@ -7582,6 +7628,11 @@ TSHttpTxnConfigFind(const char* name, in
// Lots of string comparisons here, but avoid a few at least
switch (length) {
+ case 28:
+ if (!strncmp(name, "proxy.config.http.cache.http", length))
+ *conf = TS_CONFIG_HTTP_CACHE_HTTP;
+ break;
+
case 34:
if (!strncmp(name, "proxy.config.http.chunking_enabled", length))
*conf = TS_CONFIG_HTTP_CHUNKING_ENABLED;
@@ -7610,6 +7661,11 @@ TSHttpTxnConfigFind(const char* name, in
}
break;
+ case 38:
+ if (!strncmp(name, "proxy.config.http.send_http11_requests", length))
+ *conf = TS_CONFIG_HTTP_SEND_HTTP11_REQUESTS;
+ break;
+
case 39:
if (!strncmp(name, "proxy.config.http.anonymize_remove_from", length))
*conf = TS_CONFIG_HTTP_ANONYMIZE_REMOVE_FROM;
@@ -7670,6 +7726,29 @@ TSHttpTxnConfigFind(const char* name, in
if (!strncmp(name, "proxy.config.http.anonymize_remove_user_agent", length))
*conf = TS_CONFIG_HTTP_ANONYMIZE_REMOVE_USER_AGENT;
break;
+
+ case 46:
+ switch (name[length-1]) {
+ case 'e':
+ if (!strncmp(name, "proxy.config.http.cache.ignore_client_no_cache", length))
+ *conf = TS_CONFIG_HTTP_CACHE_IGNORE_CLIENT_NO_CACHE;
+ else if (!strncmp(name, "proxy.config.http.cache.ims_on_client_no_cache", length))
+ *conf = TS_CONFIG_HTTP_CACHE_IMS_ON_CLIENT_NO_CACHE;
+ else if (!strncmp(name, "proxy.config.http.cache.ignore_server_no_cache", length))
+ *conf = TS_CONFIG_HTTP_CACHE_IGNORE_SERVER_NO_CACHE;
+ break;
+ case 'r':
+ if (!strncmp(name, "proxy.config.http.insert_squid_x_forwarded_for", length))
+ *conf = TS_CONFIG_HTTP_INSERT_SQUID_X_FORWARDED_FOR;
+ break;
+ }
+ break;
+
+ case 48:
+ if (!strncmp(name, "proxy.config.http.cache.ignore_client_cc_max_age", length))
+ *conf = TS_CONFIG_HTTP_CACHE_IGNORE_CLIENT_CC_MAX_AGE;
+ break;
+
}
return ((*conf != TS_CONFIG_NULL) ? TS_SUCCESS: TS_ERROR);
Modified: trafficserver/traffic/trunk/proxy/api/ts/ts.h.in
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/api/ts/ts.h.in?rev=1054257&r1=1054256&r2=1054257&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/api/ts/ts.h.in (original)
+++ trafficserver/traffic/trunk/proxy/api/ts/ts.h.in Sat Jan 1 17:09:12 2011
@@ -484,6 +484,8 @@ extern "C"
typedef enum
{
TS_CONFIG_NULL = 0,
+ // The order of these enum's must match the order of
+ // struct OverridableHttpConfigParams in HttpConfig.h.
TS_CONFIG_URL_REMAP_PRISTINE_HOST_HDR,
TS_CONFIG_HTTP_CHUNKING_ENABLED,
TS_CONFIG_HTTP_NEGATIVE_CACHING_ENABLED,
@@ -500,8 +502,16 @@ extern "C"
TS_CONFIG_HTTP_ANONYMIZE_REMOVE_CLIENT_IP,
TS_CONFIG_HTTP_ANONYMIZE_INSERT_CLIENT_IP,
TS_CONFIG_HTTP_APPEND_XFORWARDS_HEADER,
- TS_CONFIG_HTTP_RESPONSE_SERVER_STR,
TS_CONFIG_HTTP_RESPONSE_SERVER_ENABLED,
+ TS_CONFIG_HTTP_INSERT_SQUID_X_FORWARDED_FOR,
+ TS_CONFIG_HTTP_SEND_HTTP11_REQUESTS,
+ TS_CONFIG_HTTP_CACHE_HTTP,
+ TS_CONFIG_HTTP_CACHE_IGNORE_CLIENT_NO_CACHE,
+ TS_CONFIG_HTTP_CACHE_IGNORE_CLIENT_CC_MAX_AGE,
+ TS_CONFIG_HTTP_CACHE_IMS_ON_CLIENT_NO_CACHE,
+ TS_CONFIG_HTTP_CACHE_IGNORE_SERVER_NO_CACHE,
+ // Strings and floats must come after all the integer configs
+ TS_CONFIG_HTTP_RESPONSE_SERVER_STR,
TS_CONFIG_LAST_ENTRY
} TSOverridableConfigKey;
Modified: trafficserver/traffic/trunk/proxy/http2/HttpConfig.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/http2/HttpConfig.cc?rev=1054257&r1=1054256&r2=1054257&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/http2/HttpConfig.cc (original)
+++ trafficserver/traffic/trunk/proxy/http2/HttpConfig.cc Sat Jan 1 17:09:12 2011
@@ -1239,7 +1239,7 @@ HttpConfig::startup()
c.oride.proxy_response_server_string_len = c.oride.proxy_response_server_string ?
strlen(c.oride.proxy_response_server_string) : 0;
- HttpEstablishStaticConfigLongLong(c.insert_squid_x_forwarded_for, "proxy.config.http.insert_squid_x_forwarded_for");
+ HttpEstablishStaticConfigLongLong(c.oride.insert_squid_x_forwarded_for, "proxy.config.http.insert_squid_x_forwarded_for");
HttpEstablishStaticConfigLongLong(c.insert_age_in_response, "proxy.config.http.insert_age_in_response");
@@ -1278,12 +1278,12 @@ HttpConfig::startup()
HttpEstablishStaticConfigLongLong(c.max_cache_open_write_retries, "proxy.config.http.cache.max_open_write_retries");
HttpEstablishStaticConfigLongLong(c.cache_open_write_retry_time, "proxy.config.http.cache.open_write_retry_time");
- HttpEstablishStaticConfigLongLong(c.cache_http, "proxy.config.http.cache.http");
- HttpEstablishStaticConfigLongLong(c.cache_ignore_client_no_cache, "proxy.config.http.cache.ignore_client_no_cache");
- HttpEstablishStaticConfigLongLong(c.cache_ignore_client_cc_max_age,
+ HttpEstablishStaticConfigLongLong(c.oride.cache_http, "proxy.config.http.cache.http");
+ HttpEstablishStaticConfigLongLong(c.oride.cache_ignore_client_no_cache, "proxy.config.http.cache.ignore_client_no_cache");
+ HttpEstablishStaticConfigLongLong(c.oride.cache_ignore_client_cc_max_age,
"proxy.config.http.cache.ignore_client_cc_max_age");
- HttpEstablishStaticConfigLongLong(c.cache_ims_on_client_no_cache, "proxy.config.http.cache.ims_on_client_no_cache");
- HttpEstablishStaticConfigLongLong(c.cache_ignore_server_no_cache, "proxy.config.http.cache.ignore_server_no_cache");
+ HttpEstablishStaticConfigLongLong(c.oride.cache_ims_on_client_no_cache, "proxy.config.http.cache.ims_on_client_no_cache");
+ HttpEstablishStaticConfigLongLong(c.oride.cache_ignore_server_no_cache, "proxy.config.http.cache.ignore_server_no_cache");
HttpEstablishStaticConfigLongLong(c.cache_responses_to_cookies, "proxy.config.http.cache.cache_responses_to_cookies");
HttpEstablishStaticConfigLongLong(c.cache_ignore_auth, "proxy.config.http.cache.ignore_authentication");
@@ -1329,6 +1329,8 @@ HttpConfig::startup()
HttpEstablishStaticConfigLongLong(c.record_tcp_mem_hit, "proxy.config.http.record_tcp_mem_hit");
+ HttpEstablishStaticConfigLongLong(c.oride.send_http11_requests, "proxy.config.http.send_http11_requests");
+
if (!c.transparency_enabled) {
//By this time, we would have read Socks configuration.
c.transparency_enabled = netProcessor.socks_conf_stuff->accept_enabled;
@@ -1554,7 +1556,7 @@ HttpConfig::reconfigure()
strlen(params->oride.proxy_response_server_string) : 0;
params->oride.proxy_response_server_enabled = m_master.oride.proxy_response_server_enabled;
- params->insert_squid_x_forwarded_for = INT_TO_BOOL(m_master.insert_squid_x_forwarded_for);
+ params->oride.insert_squid_x_forwarded_for = INT_TO_BOOL(m_master.oride.insert_squid_x_forwarded_for);
params->insert_age_in_response = INT_TO_BOOL(m_master.insert_age_in_response);
params->avoid_content_spoofing = INT_TO_BOOL(m_master.avoid_content_spoofing);
params->enable_http_stats = INT_TO_BOOL(m_master.enable_http_stats);
@@ -1591,11 +1593,11 @@ HttpConfig::reconfigure()
params->max_cache_open_write_retries = m_master.max_cache_open_write_retries;
params->cache_open_write_retry_time = m_master.cache_open_write_retry_time;
- params->cache_http = INT_TO_BOOL(m_master.cache_http);
- params->cache_ignore_client_no_cache = INT_TO_BOOL(m_master.cache_ignore_client_no_cache);
- params->cache_ignore_client_cc_max_age = INT_TO_BOOL(m_master.cache_ignore_client_cc_max_age);
- params->cache_ims_on_client_no_cache = INT_TO_BOOL(m_master.cache_ims_on_client_no_cache);
- params->cache_ignore_server_no_cache = INT_TO_BOOL(m_master.cache_ignore_server_no_cache);
+ params->oride.cache_http = INT_TO_BOOL(m_master.oride.cache_http);
+ params->oride.cache_ignore_client_no_cache = INT_TO_BOOL(m_master.oride.cache_ignore_client_no_cache);
+ params->oride.cache_ignore_client_cc_max_age = INT_TO_BOOL(m_master.oride.cache_ignore_client_cc_max_age);
+ params->oride.cache_ims_on_client_no_cache = INT_TO_BOOL(m_master.oride.cache_ims_on_client_no_cache);
+ params->oride.cache_ignore_server_no_cache = INT_TO_BOOL(m_master.oride.cache_ignore_server_no_cache);
params->cache_responses_to_cookies = m_master.cache_responses_to_cookies;
params->cache_ignore_auth = INT_TO_BOOL(m_master.cache_ignore_auth);
params->cache_urls_that_look_dynamic = INT_TO_BOOL(m_master.cache_urls_that_look_dynamic);
@@ -1625,7 +1627,7 @@ HttpConfig::reconfigure()
params->slow_log_threshold = m_master.slow_log_threshold;
params->record_cop_page = INT_TO_BOOL(m_master.record_cop_page);
params->record_tcp_mem_hit = INT_TO_BOOL(m_master.record_tcp_mem_hit);
- params->send_http11_requests = m_master.send_http11_requests;
+ params->oride.send_http11_requests = m_master.oride.send_http11_requests;
params->doc_in_cache_skip_dns = m_master.doc_in_cache_skip_dns;
params->default_buffer_size_index = m_master.default_buffer_size_index;
params->default_buffer_water_mark = m_master.default_buffer_water_mark;
Modified: trafficserver/traffic/trunk/proxy/http2/HttpConfig.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/http2/HttpConfig.h?rev=1054257&r1=1054256&r2=1054257&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/http2/HttpConfig.h (original)
+++ trafficserver/traffic/trunk/proxy/http2/HttpConfig.h Sat Jan 1 17:09:12 2011
@@ -390,11 +390,11 @@ struct HttpConfigPortRange
int high;
HttpConfigPortRange *next;
- HttpConfigPortRange()
- : low(0), high(0), next(0)
- {
- }
- ~HttpConfigPortRange()
+ HttpConfigPortRange()
+ : low(0), high(0), next(0)
+ { }
+
+ ~HttpConfigPortRange()
{
if (next)
delete next;
@@ -412,10 +412,18 @@ struct OverridableHttpConfigParams {
sock_recv_buffer_size_out(0), sock_send_buffer_size_out(0), sock_option_flag_out(0),
anonymize_remove_from(false), anonymize_remove_referer(false), anonymize_remove_user_agent(false),
anonymize_remove_cookie(false), anonymize_remove_client_ip(false), anonymize_insert_client_ip(true),
- append_xforwards_header(false),
- proxy_response_server_string(NULL), proxy_response_server_string_len(0), proxy_response_server_enabled(0)
+ append_xforwards_header(false), proxy_response_server_enabled(0),
+ insert_squid_x_forwarded_for(0), send_http11_requests(3), // SEND_HTTP11_IF_REQUEST_11_AND_HOSTDB
+ cache_http(false), cache_ignore_client_no_cache(false), cache_ignore_client_cc_max_age(true),
+ cache_ims_on_client_no_cache(false), cache_ignore_server_no_cache(false),
+
+ // Strings / floats must come last
+ proxy_response_server_string(NULL), proxy_response_server_string_len(0)
{}
+ // IMPORTANT: All MgmtInt configs should come before any other string / float
+ // configs!!!
+
// These three configs used to be @-parameters in remap.config
MgmtInt maintain_pristine_host_hdr;
MgmtInt chunking_enabled;
@@ -444,12 +452,34 @@ struct OverridableHttpConfigParams {
MgmtInt anonymize_insert_client_ip;
MgmtInt append_xforwards_header;
+ MgmtInt proxy_response_server_enabled;
+
+ /////////////////////
+ // X-Forwarded-For //
+ /////////////////////
+ MgmtInt insert_squid_x_forwarded_for;
+
+ //////////////////////
+ // Version Hell //
+ //////////////////////
+ MgmtInt send_http11_requests;
+
+ ///////////////////
+ // cache control //
+ ///////////////////
+ MgmtInt cache_http;
+ MgmtInt cache_ignore_client_no_cache;
+ MgmtInt cache_ignore_client_cc_max_age;
+ MgmtInt cache_ims_on_client_no_cache;
+ MgmtInt cache_ignore_server_no_cache;
+
+ // IMPORTANT: Here comes all strings / floats configs.
+
///////////////////////////////////////////////////////////////////
// Server header //
///////////////////////////////////////////////////////////////////
char *proxy_response_server_string; // This does not get free'd by us!
size_t proxy_response_server_string_len; // Updated when server_string is set.
- MgmtInt proxy_response_server_enabled;
};
@@ -571,11 +601,6 @@ public:
size_t global_user_agent_header_size;
/////////////////////
- // X-Forwarded-For //
- /////////////////////
- MgmtInt insert_squid_x_forwarded_for;
-
- /////////////////////
// Benchmark hacks //
/////////////////////
MgmtInt insert_age_in_response; // INKqa09853
@@ -619,11 +644,6 @@ public:
///////////////////
// cache control //
///////////////////
- MgmtInt cache_http;
- MgmtInt cache_ignore_client_no_cache;
- MgmtInt cache_ignore_client_cc_max_age;
- MgmtInt cache_ims_on_client_no_cache;
- MgmtInt cache_ignore_server_no_cache;
MgmtInt cache_responses_to_cookies;
MgmtInt cache_ignore_auth;
MgmtInt cache_urls_that_look_dynamic;
@@ -724,11 +744,6 @@ public:
MgmtInt slow_log_threshold;
//////////////////////
- // Version Hell //
- //////////////////////
- MgmtInt send_http11_requests;
-
- //////////////////////
// DOC IN CACHE NO DNS//
//////////////////////
MgmtInt doc_in_cache_skip_dns;
@@ -940,7 +955,6 @@ HttpConfigParams::HttpConfigParams()
anonymize_other_header_list(NULL),
global_user_agent_header(NULL),
global_user_agent_header_size(0),
- insert_squid_x_forwarded_for(0),
insert_age_in_response(1),
avoid_content_spoofing(1),
enable_http_stats(1),
@@ -962,11 +976,6 @@ HttpConfigParams::HttpConfigParams()
cache_open_read_retry_time(0),
max_cache_open_write_retries(0),
cache_open_write_retry_time(0),
- cache_http(false),
- cache_ignore_client_no_cache(false),
- cache_ignore_client_cc_max_age(true),
- cache_ims_on_client_no_cache(false),
- cache_ignore_server_no_cache(false),
cache_responses_to_cookies(0),
cache_ignore_auth(0),
cache_urls_that_look_dynamic(false),
@@ -994,7 +1003,6 @@ HttpConfigParams::HttpConfigParams()
record_cop_page(0),
record_tcp_mem_hit(0),
errors_log_error_pages(0),
- send_http11_requests(SEND_HTTP11_IF_REQUEST_11_AND_HOSTDB),
doc_in_cache_skip_dns(1), // Added for SKIPPING DNS If DOC IN CACHE
default_buffer_size_index(0),
default_buffer_water_mark(0),
Modified: trafficserver/traffic/trunk/proxy/http2/HttpSM.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/http2/HttpSM.cc?rev=1054257&r1=1054256&r2=1054257&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/http2/HttpSM.cc (original)
+++ trafficserver/traffic/trunk/proxy/http2/HttpSM.cc Sat Jan 1 17:09:12 2011
@@ -407,25 +407,28 @@ HttpSM::init()
t_state.state_machine = this;
t_state.http_config_param = HttpConfig::acquire();
+
// TODO: this might want to be "lazy" (on write from a plugin)
memcpy(&(t_state.txn_conf), &(t_state.http_config_param->oride), sizeof(t_state.txn_conf));
// update the cache info config structure so that
// selection from alternates happens correctly.
- t_state.cache_info.config.cache_global_user_agent_header =
- t_state.http_config_param->global_user_agent_header ? true : false;
-
+ t_state.cache_info.config.cache_global_user_agent_header = t_state.http_config_param->global_user_agent_header ? true : false;
t_state.cache_info.config.ignore_accept_mismatch = t_state.http_config_param->ignore_accept_mismatch ? true : false;
+
t_state.cache_info.config.ignore_accept_language_mismatch =
t_state.http_config_param->ignore_accept_language_mismatch ? true : false;
+
t_state.cache_info.config.ignore_accept_encoding_mismatch =
t_state.http_config_param->ignore_accept_encoding_mismatch ? true : false;
+
t_state.cache_info.config.ignore_accept_charset_mismatch =
t_state.http_config_param->ignore_accept_charset_mismatch ? true : false;
t_state.cache_info.config.cache_enable_default_vary_headers =
t_state.http_config_param->cache_enable_default_vary_headers ? true : false;
+
t_state.cache_info.config.cache_vary_default_text = t_state.http_config_param->cache_vary_default_text;
t_state.cache_info.config.cache_vary_default_images = t_state.http_config_param->cache_vary_default_images;
t_state.cache_info.config.cache_vary_default_other = t_state.http_config_param->cache_vary_default_other;
@@ -433,10 +436,7 @@ HttpSM::init()
t_state.init();
// Added to skip dns if the document is in cache. DNS will be forced if there is a ip based based ACL in cache control or parent.config or if the doc_in_cache_skip_dns is disabled or if http caching is disabled
t_state.force_dns = (ip_rule_in_CacheControlTable() || t_state.parent_params->ParentTable->ipMatch ||
- !(t_state.http_config_param->doc_in_cache_skip_dns) || !(t_state.http_config_param->cache_http));
- //printf("%d doc_in_cache_skip_dns\n", t_state.http_config_param->doc_in_cache_skip_dns);
- //printf("%d t_state.force_dns\n", t_state.force_dns);
-
+ !(t_state.http_config_param->doc_in_cache_skip_dns) || !(t_state.txn_conf.cache_http));
http_parser_init(&http_parser);
Modified: trafficserver/traffic/trunk/proxy/http2/HttpTransact.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/http2/HttpTransact.cc?rev=1054257&r1=1054256&r2=1054257&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/http2/HttpTransact.cc (original)
+++ trafficserver/traffic/trunk/proxy/http2/HttpTransact.cc Sat Jan 1 17:09:12 2011
@@ -175,7 +175,7 @@ is_port_in_range(int port, HttpConfigPor
inline static void
update_cache_control_information_from_config(HttpTransact::State * s)
{
- getCacheControl(&s->cache_control, &s->request_data, s->http_config_param);
+ getCacheControl(&s->cache_control, &s->request_data, s->http_config_param, &(s->txn_conf));
s->cache_info.directives.does_config_permit_lookup &= (s->cache_control.never_cache == false);
s->cache_info.directives.does_config_permit_storing &= (s->cache_control.never_cache == false);
@@ -184,7 +184,7 @@ update_cache_control_information_from_co
HttpTransact::does_client_request_permit_storing(&(s->cache_control), &s->hdr_info.client_request);
s->cache_info.directives.does_client_permit_lookup =
- HttpTransact::does_client_request_permit_cached_response(s->http_config_param, &(s->cache_control),
+ HttpTransact::does_client_request_permit_cached_response(&(s->txn_conf), &(s->cache_control),
&s->hdr_info.client_request, s->via_string);
s->cache_info.directives.does_client_permit_dns_storing =
@@ -1214,7 +1214,7 @@ HttpTransact::HandleRequest(State * s)
//YTS Team, yamsat Plugin
//Doing a Cache Lookup in case of a Redirection to ensure that
//the newly requested object is not in the CACHE
- if (s->http_config_param->cache_http && s->redirect_info.redirect_in_process && s->state_machine->enable_redirection) {
+ if (s->txn_conf.cache_http && s->redirect_info.redirect_in_process && s->state_machine->enable_redirection) {
TRANSACT_RETURN(CACHE_LOOKUP, NULL);
}
@@ -2188,7 +2188,7 @@ HttpTransact::issue_revalidate(State * s
presence(MIME_PRESENCE_IF_MODIFIED_SINCE))) &&
(!(s->hdr_info.client_request.presence(MIME_PRESENCE_IF_NONE_MATCH)))
&& (no_cache_in_request == true) &&
- (!s->http_config_param->cache_ims_on_client_no_cache) && (s->www_auth_content == CACHE_AUTH_NONE)) {
+ (!s->txn_conf.cache_ims_on_client_no_cache) && (s->www_auth_content == CACHE_AUTH_NONE)) {
Debug("http_trans", "[issue_revalidate] Can not make this a conditional request. This is the force update of the cached copy case");
// set cache action to update. response will be a 200 or error,
// causing cached copy to be replaced (if 200).
@@ -5041,7 +5041,7 @@ HttpTransact::get_ka_info_from_host_db(S
bool force_http11 = false;
bool http11_if_hostdb = false;
- switch (s->http_config_param->send_http11_requests) {
+ switch (s->txn_conf.send_http11_requests) {
case HttpConfigParams::SEND_HTTP11_NEVER:
// No need to do anything since above vars
// are defaulted false
@@ -5244,32 +5244,26 @@ HttpTransact::add_client_ip_to_outgoing_
}
}
- if (s->http_config_param->insert_squid_x_forwarded_for) {
+ if (s->txn_conf.insert_squid_x_forwarded_for) {
// Use insert an extra space in the front so we're append,
// everything looks ok. If we're not appending, we'll
// skip over it
if (ip_string_size > 1) {
MIMEField *x_for;
- if (s->http_config_param->insert_squid_x_forwarded_for) {
- if ((x_for = request->field_find(MIME_FIELD_X_FORWARDED_FOR, MIME_LEN_X_FORWARDED_FOR)) != 0) {
- // My undersanding is that X-Forwarded header does
- // not use comma to separate tokens...
- // but...
- // According to http://www.openinfo.co.uk/apache/
- // "If a request has passed through multiple proxies then the X-Forwarded-For may
- // contain several IPs like this: X-Forwarded-For: client1, proxy1, proxy2 "
- //
- // I am going to fix it.
- //
- //request->field_value_append(x_for, ip_string, ip_string_size, false); // false => no comma
- request->field_value_append(x_for, ip_string, ip_string_size, true); // true => comma must be inserted
- } else {
- request->value_set(MIME_FIELD_X_FORWARDED_FOR, MIME_LEN_X_FORWARDED_FOR, ip_string + 1, ip_string_size - 1);
- }
- Debug("http_trans", "[add_client_ip_to_outgoing_request] Appended connecting client's "
- "(%s) to the X-Forwards header", ip_string + 1);
+ if ((x_for = request->field_find(MIME_FIELD_X_FORWARDED_FOR, MIME_LEN_X_FORWARDED_FOR)) != 0) {
+ // My undersanding is that X-Forwarded header does
+ // not use comma to separate tokens...
+ // but...
+ // According to http://www.openinfo.co.uk/apache/
+ // "If a request has passed through multiple proxies then the X-Forwarded-For may
+ // contain several IPs like this: X-Forwarded-For: client1, proxy1, proxy2 "
+ request->field_value_append(x_for, ip_string, ip_string_size, true); // true => comma must be inserted
+ } else {
+ request->value_set(MIME_FIELD_X_FORWARDED_FOR, MIME_LEN_X_FORWARDED_FOR, ip_string + 1, ip_string_size - 1);
}
+ Debug("http_trans", "[add_client_ip_to_outgoing_request] Appended connecting client's "
+ "(%s) to the X-Forwards header", ip_string + 1);
}
}
}
@@ -6058,7 +6052,7 @@ HttpTransact::is_request_cache_lookupabl
return true;
}
// is cache turned on?
- if (!s->http_config_param->cache_http) {
+ if (!s->txn_conf.cache_http) {
SET_VIA_STRING(VIA_DETAIL_TUNNEL, VIA_DETAIL_TUNNEL_CACHE_OFF);
return false;
}
@@ -7186,7 +7180,7 @@ HttpTransact::delete_all_document_altern
}
bool
-HttpTransact::does_client_request_permit_cached_response(const HttpConfigParams *p, CacheControlResult *c,
+HttpTransact::does_client_request_permit_cached_response(const OverridableHttpConfigParams *p, CacheControlResult *c,
HTTPHdr *h, char *via_string)
{
NOWARN_UNUSED(p);
Modified: trafficserver/traffic/trunk/proxy/http2/HttpTransact.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/http2/HttpTransact.h?rev=1054257&r1=1054256&r2=1054257&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/http2/HttpTransact.h (original)
+++ trafficserver/traffic/trunk/proxy/http2/HttpTransact.h Sat Jan 1 17:09:12 2011
@@ -1319,8 +1319,8 @@ public:
static ResponseError_t check_response_validity(State * s, HTTPHdr * incoming_hdr);
static bool delete_all_document_alternates_and_return(State * s, bool cache_hit);
static bool did_forward_server_send_0_9_response(State * s);
- static bool does_client_request_permit_cached_response(const HttpConfigParams * p, CacheControlResult * c, HTTPHdr * h,
- char *via_string);
+ static bool does_client_request_permit_cached_response(const OverridableHttpConfigParams *p, CacheControlResult *c,
+ HTTPHdr *h, char *via_string);
static bool does_client_request_permit_dns_caching(CacheControlResult * c, HTTPHdr * h);
static bool does_client_request_permit_storing(CacheControlResult * c, HTTPHdr * h);
static bool handle_internal_request(State * s, HTTPHdr * incoming_hdr);