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 2013/08/03 22:51:36 UTC

[27/52] [abbrv] git commit: TS-1255 Added proxy.config.http.cache.range.lookup as overridable config, and also organized the switch statement in InkAPI.cc to match ts.h

TS-1255 Added proxy.config.http.cache.range.lookup as overridable config, and also organized the switch statement in InkAPI.cc to match ts.h


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/bb6939cf
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/bb6939cf
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/bb6939cf

Branch: refs/heads/3.3.x
Commit: bb6939cf56cc0664fff971da81b59b0b26dd4068
Parents: cecc082
Author: Leif Hedstrom <zw...@apache.org>
Authored: Sat Jul 27 02:46:17 2013 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Thu Aug 1 22:42:48 2013 +0200

----------------------------------------------------------------------
 proxy/InkAPI.cc            | 51 +++++++++++++++++++++++++----------------
 proxy/InkAPITest.cc        |  3 ++-
 proxy/api/ts/ts.h.in       |  1 +
 proxy/http/HttpConfig.cc   |  4 ++--
 proxy/http/HttpConfig.h    |  6 ++---
 proxy/http/HttpTransact.cc |  2 +-
 6 files changed, 40 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/bb6939cf/proxy/InkAPI.cc
----------------------------------------------------------------------
diff --git a/proxy/InkAPI.cc b/proxy/InkAPI.cc
index 540bec8..3433f7d 100644
--- a/proxy/InkAPI.cc
+++ b/proxy/InkAPI.cc
@@ -7362,14 +7362,6 @@ _conf_to_memberp(TSOverridableConfigKey conf, HttpSM* sm, OverridableDataType *t
     typ = OVERRIDABLE_TYPE_INT;
     ret = &sm->t_state.txn_conf->sock_option_flag_out;
     break;
-  case TS_CONFIG_NET_SOCK_PACKET_MARK_OUT:
-    typ = OVERRIDABLE_TYPE_INT;
-    ret = &sm->t_state.txn_conf->sock_packet_mark_out;
-    break;
-  case TS_CONFIG_NET_SOCK_PACKET_TOS_OUT:
-    typ = OVERRIDABLE_TYPE_INT;
-    ret = &sm->t_state.txn_conf->sock_packet_tos_out;
-    break;
   case TS_CONFIG_HTTP_FORWARD_PROXY_AUTH_TO_PARENT:
     ret = &sm->t_state.txn_conf->fwd_proxy_auth_to_parent;
     break;
@@ -7526,11 +7518,10 @@ _conf_to_memberp(TSOverridableConfigKey conf, HttpSM* sm, OverridableDataType *t
   case TS_CONFIG_HTTP_BACKGROUND_FILL_ACTIVE_TIMEOUT:
     ret = &sm->t_state.txn_conf->background_fill_active_timeout;
     break;
-  case TS_CONFIG_HTTP_INSERT_AGE_IN_RESPONSE:
-    typ = OVERRIDABLE_TYPE_INT;
-    ret = &sm->t_state.txn_conf->insert_age_in_response;
+  case TS_CONFIG_HTTP_RESPONSE_SERVER_STR:
+    typ = OVERRIDABLE_TYPE_STRING;
+    ret = &sm->t_state.txn_conf->proxy_response_server_string;
     break;
-
   case TS_CONFIG_HTTP_CACHE_HEURISTIC_LM_FACTOR:
     typ = OVERRIDABLE_TYPE_FLOAT;
     ret = &sm->t_state.txn_conf->cache_heuristic_lm_factor;
@@ -7543,10 +7534,17 @@ _conf_to_memberp(TSOverridableConfigKey conf, HttpSM* sm, OverridableDataType *t
     typ = OVERRIDABLE_TYPE_FLOAT;
     ret = &sm->t_state.txn_conf->background_fill_threshold;
     break;
-
-  case TS_CONFIG_HTTP_RESPONSE_SERVER_STR:
-    typ = OVERRIDABLE_TYPE_STRING;
-    ret = &sm->t_state.txn_conf->proxy_response_server_string;
+  case TS_CONFIG_NET_SOCK_PACKET_MARK_OUT:
+    typ = OVERRIDABLE_TYPE_INT;
+    ret = &sm->t_state.txn_conf->sock_packet_mark_out;
+    break;
+  case TS_CONFIG_NET_SOCK_PACKET_TOS_OUT:
+    typ = OVERRIDABLE_TYPE_INT;
+    ret = &sm->t_state.txn_conf->sock_packet_tos_out;
+    break;
+  case TS_CONFIG_HTTP_INSERT_AGE_IN_RESPONSE:
+    typ = OVERRIDABLE_TYPE_INT;
+    ret = &sm->t_state.txn_conf->insert_age_in_response;
     break;
   case TS_CONFIG_HTTP_CHUNKING_SIZE:
     typ = OVERRIDABLE_TYPE_INT;
@@ -7555,13 +7553,17 @@ _conf_to_memberp(TSOverridableConfigKey conf, HttpSM* sm, OverridableDataType *t
   case TS_CONFIG_HTTP_FLOW_CONTROL_ENABLED:
     ret = &sm->t_state.txn_conf->flow_control_enabled;
     break;
+  case TS_CONFIG_HTTP_FLOW_CONTROL_LOW_WATER_MARK:
+    typ = OVERRIDABLE_TYPE_INT;
+    ret = &sm->t_state.txn_conf->flow_low_water_mark;
+    break;
   case TS_CONFIG_HTTP_FLOW_CONTROL_HIGH_WATER_MARK:
     typ = OVERRIDABLE_TYPE_INT;
     ret = &sm->t_state.txn_conf->flow_high_water_mark;
     break;
-  case TS_CONFIG_HTTP_FLOW_CONTROL_LOW_WATER_MARK:
+  case TS_CONFIG_HTTP_CACHE_RANGE_LOOKUP:
     typ = OVERRIDABLE_TYPE_INT;
-    ret = &sm->t_state.txn_conf->flow_low_water_mark;
+    ret = &sm->t_state.txn_conf->cache_range_lookup;
     break;
 
     // This helps avoiding compiler warnings, yet detect unhandled enum members.
@@ -7746,6 +7748,7 @@ TSHttpTxnConfigFind(const char* name, int length, TSOverridableConfigKey *conf,
     if (!strncmp(name, "proxy.config.http.cache.http", length))
       cnf = TS_CONFIG_HTTP_CACHE_HTTP;
     break;
+
   case 31:
     if (!strncmp(name, "proxy.config.http.chunking.size", length))
       cnf = TS_CONFIG_HTTP_CHUNKING_SIZE;
@@ -7762,8 +7765,16 @@ TSHttpTxnConfigFind(const char* name, int length, TSOverridableConfigKey *conf,
     break;
 
   case 36:
-    if (!strncmp(name, "proxy.config.net.sock_packet_tos_out", length))
-      cnf = TS_CONFIG_NET_SOCK_PACKET_TOS_OUT;
+    switch (name[length-1]) {
+    case 'p':
+      if (!strncmp(name, "proxy.config.http.cache.range.lookup", length))
+        cnf = TS_CONFIG_HTTP_CACHE_RANGE_LOOKUP;
+      break;
+    case 't':
+      if (!strncmp(name, "proxy.config.net.sock_packet_tos_out", length))
+        cnf = TS_CONFIG_NET_SOCK_PACKET_TOS_OUT;
+      break;
+    }
     break;
 
   case 37:

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/bb6939cf/proxy/InkAPITest.cc
----------------------------------------------------------------------
diff --git a/proxy/InkAPITest.cc b/proxy/InkAPITest.cc
index 1be5eb0..6f54a3b 100644
--- a/proxy/InkAPITest.cc
+++ b/proxy/InkAPITest.cc
@@ -7395,7 +7395,8 @@ const char *SDK_Overridable_Configs[TS_CONFIG_LAST_ENTRY] = {
   "proxy.config.http.chunking.size",
   "proxy.config.http.flow_control.enabled",
   "proxy.config.http.flow_control.low_water",
-  "proxy.config.http.flow_control.high_water"
+  "proxy.config.http.flow_control.high_water",
+  "proxy.config.http.cache.range.lookup"
 };
 
 REGRESSION_TEST(SDK_API_OVERRIDABLE_CONFIGS) (RegressionTest * test, int /* atype ATS_UNUSED */, int *pstatus)

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/bb6939cf/proxy/api/ts/ts.h.in
----------------------------------------------------------------------
diff --git a/proxy/api/ts/ts.h.in b/proxy/api/ts/ts.h.in
index fc65e0e..7793055 100644
--- a/proxy/api/ts/ts.h.in
+++ b/proxy/api/ts/ts.h.in
@@ -671,6 +671,7 @@ extern "C"
     TS_CONFIG_HTTP_FLOW_CONTROL_ENABLED,
     TS_CONFIG_HTTP_FLOW_CONTROL_LOW_WATER_MARK,
     TS_CONFIG_HTTP_FLOW_CONTROL_HIGH_WATER_MARK,
+    TS_CONFIG_HTTP_CACHE_RANGE_LOOKUP,
     TS_CONFIG_LAST_ENTRY,
   } TSOverridableConfigKey;
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/bb6939cf/proxy/http/HttpConfig.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpConfig.cc b/proxy/http/HttpConfig.cc
index 2080f65..fb5b9ed 100644
--- a/proxy/http/HttpConfig.cc
+++ b/proxy/http/HttpConfig.cc
@@ -1289,7 +1289,7 @@ HttpConfig::startup()
   HttpEstablishStaticConfigByte(c.cache_when_to_add_no_cache_to_msie_requests,
                                     "proxy.config.http.cache.when_to_add_no_cache_to_msie_requests");
   HttpEstablishStaticConfigByte(c.oride.cache_required_headers, "proxy.config.http.cache.required_headers");
-  HttpEstablishStaticConfigByte(c.cache_range_lookup, "proxy.config.http.cache.range.lookup");
+  HttpEstablishStaticConfigByte(c.oride.cache_range_lookup, "proxy.config.http.cache.range.lookup");
 
   HttpEstablishStaticConfigStringAlloc(c.connect_ports_string, "proxy.config.http.connect_ports");
 
@@ -1560,7 +1560,7 @@ HttpConfig::reconfigure()
   params->cache_when_to_add_no_cache_to_msie_requests = m_master.cache_when_to_add_no_cache_to_msie_requests;
 
   params->oride.cache_required_headers = m_master.oride.cache_required_headers;
-  params->cache_range_lookup = INT_TO_BOOL(m_master.cache_range_lookup);
+  params->oride.cache_range_lookup = INT_TO_BOOL(m_master.oride.cache_range_lookup);
 
   params->connect_ports_string = ats_strdup(m_master.connect_ports_string);
   params->connect_ports = parse_ports_list(params->connect_ports_string);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/bb6939cf/proxy/http/HttpConfig.h
----------------------------------------------------------------------
diff --git a/proxy/http/HttpConfig.h b/proxy/http/HttpConfig.h
index 659bbe7..cbee1fd 100644
--- a/proxy/http/HttpConfig.h
+++ b/proxy/http/HttpConfig.h
@@ -408,10 +408,10 @@ struct OverridableHttpConfigParams {
        anonymize_remove_from(0), anonymize_remove_referer(0), anonymize_remove_user_agent(0),
        anonymize_remove_cookie(0), anonymize_remove_client_ip(0), anonymize_insert_client_ip(1),
        proxy_response_server_enabled(0), insert_squid_x_forwarded_for(0),
-       send_http11_requests(3), // SEND_HTTP11_IF_REQUEST_11_AND_HOSTDB
+       send_http11_requests(3),
        cache_http(0), cache_cluster_cache_local(0), cache_ignore_client_no_cache(0), cache_ignore_client_cc_max_age(1),
        cache_ims_on_client_no_cache(0), cache_ignore_server_no_cache(0), cache_responses_to_cookies(0),
-       cache_ignore_auth(0), cache_urls_that_look_dynamic(0), cache_required_headers(0), // CACHE_REQUIRED_HEADERS_NONE
+       cache_ignore_auth(0), cache_urls_that_look_dynamic(0), cache_required_headers(0), cache_range_lookup(1),
        insert_request_via_string(0), insert_response_via_string(0), doc_in_cache_skip_dns(1),
        negative_caching_lifetime(0),
        sock_recv_buffer_size_out(0), sock_send_buffer_size_out(0), sock_option_flag_out(0),
@@ -498,6 +498,7 @@ struct OverridableHttpConfigParams {
   MgmtByte cache_ignore_auth;
   MgmtByte cache_urls_that_look_dynamic;
   MgmtByte cache_required_headers;
+  MgmtByte cache_range_lookup;
 
   MgmtByte insert_request_via_string;
   MgmtByte insert_response_via_string;
@@ -692,7 +693,6 @@ public:
   ///////////////////
   MgmtByte cache_enable_default_vary_headers;
   MgmtByte cache_when_to_add_no_cache_to_msie_requests;
-  MgmtByte cache_range_lookup;
 
   ////////////////////////////////////////////
   // CONNECT ports (used to be == ssl_ports //

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/bb6939cf/proxy/http/HttpTransact.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index f31a8bc..c1cf88d 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -5887,7 +5887,7 @@ HttpTransact::is_request_cache_lookupable(State* s)
   }
 
   // Don't cache if it's a RANGE request but the cache is not enabled for RANGE.
-  if (!s->http_config_param->cache_range_lookup && s->hdr_info.client_request.presence(MIME_PRESENCE_RANGE)) {
+  if (!s->txn_conf->cache_range_lookup && s->hdr_info.client_request.presence(MIME_PRESENCE_RANGE)) {
     SET_VIA_STRING(VIA_DETAIL_TUNNEL, VIA_DETAIL_TUNNEL_HEADER_FIELD);
     return false;
   }