You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by so...@apache.org on 2016/05/20 23:11:13 UTC

[trafficserver] 17/28: TS-4401 Override proxy.config.http.uncacheable_requests_bypass_parent

This is an automated email from the ASF dual-hosted git repository.

sorber pushed a commit to branch 6.2.x
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

commit 908a85a81e1ea061e4cb82c8ae51ea4b2cd66cf7
Author: Leif Hedstrom <zw...@apache.org>
AuthorDate: Sat Apr 30 12:58:58 2016 -0600

    TS-4401 Override proxy.config.http.uncacheable_requests_bypass_parent
    
    (cherry picked from commit ea4f7e2c0a346e7a34a93816fcbfb45357a641f2)
    
     Conflicts:
    	proxy/http/HttpConfig.h
---
 doc/admin-guide/files/records.config.en.rst      | 2 ++
 lib/ts/apidefs.h.in                              | 1 +
 plugins/experimental/ts_lua/ts_lua_http_config.c | 2 ++
 proxy/InkAPI.cc                                  | 5 +++++
 proxy/InkAPITest.cc                              | 1 +
 proxy/http/HttpConfig.cc                         | 4 ++--
 proxy/http/HttpConfig.h                          | 3 ++-
 proxy/http/HttpTransact.cc                       | 2 +-
 8 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/doc/admin-guide/files/records.config.en.rst b/doc/admin-guide/files/records.config.en.rst
index 1fa0d3e..1bb1bd0 100644
--- a/doc/admin-guide/files/records.config.en.rst
+++ b/doc/admin-guide/files/records.config.en.rst
@@ -1280,6 +1280,8 @@ Origin Server Connect Attempts
    because the origin server was too slow in sending the response header.
 
 .. ts:cv:: CONFIG proxy.config.http.uncacheable_requests_bypass_parent INT 1
+   :reloadable:
+   :overridable:
 
    When enabled (1), Traffic Server bypasses the parent proxy for a request that is not cacheable.
 
diff --git a/lib/ts/apidefs.h.in b/lib/ts/apidefs.h.in
index b876e99..d4b94db 100644
--- a/lib/ts/apidefs.h.in
+++ b/lib/ts/apidefs.h.in
@@ -697,6 +697,7 @@ typedef enum {
   TS_CONFIG_HTTP_ORIGIN_MAX_CONNECTIONS_QUEUE,
   TS_CONFIG_WEBSOCKET_NO_ACTIVITY_TIMEOUT,
   TS_CONFIG_WEBSOCKET_ACTIVE_TIMEOUT,
+  TS_CONFIG_HTTP_UNCACHEABLE_REQUESTS_BYPASS_PARENT,
   TS_CONFIG_LAST_ENTRY
 } TSOverridableConfigKey;
 
diff --git a/plugins/experimental/ts_lua/ts_lua_http_config.c b/plugins/experimental/ts_lua/ts_lua_http_config.c
index 952af54..aca39ce 100644
--- a/plugins/experimental/ts_lua/ts_lua_http_config.c
+++ b/plugins/experimental/ts_lua/ts_lua_http_config.c
@@ -116,6 +116,7 @@ typedef enum {
   TS_LUA_CONFIG_HTTP_ORIGIN_MAX_CONNECTIONS_QUEUE = TS_CONFIG_HTTP_ORIGIN_MAX_CONNECTIONS_QUEUE,
   TS_LUA_CONFIG_WEBSOCKET_NO_ACTIVITY_TIMEOUT = TS_CONFIG_WEBSOCKET_NO_ACTIVITY_TIMEOUT,
   TS_LUA_CONFIG_WEBSOCKET_ACTIVE_TIMEOUT = TS_CONFIG_WEBSOCKET_ACTIVE_TIMEOUT,
+  TS_LUA_CONFIG_HTTP_UNCACHEABLE_REQUESTS_BYPASS_PARENT = TS_CONFIG_HTTP_UNCACHEABLE_REQUESTS_BYPASS_PARENT,
   TS_LUA_CONFIG_LAST_ENTRY = TS_CONFIG_LAST_ENTRY,
 } TSLuaOverridableConfigKey;
 
@@ -224,6 +225,7 @@ ts_lua_var_item ts_lua_http_config_vars[] = {
   TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_ORIGIN_MAX_CONNECTIONS_QUEUE),
   TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_WEBSOCKET_NO_ACTIVITY_TIMEOUT),
   TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_WEBSOCKET_ACTIVE_TIMEOUT),
+  TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_UNCACHEABLE_REQUESTS_BYPASS_PARENT),
   TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_LAST_ENTRY),
 };
 
diff --git a/proxy/InkAPI.cc b/proxy/InkAPI.cc
index 5b8375b..3336449 100644
--- a/proxy/InkAPI.cc
+++ b/proxy/InkAPI.cc
@@ -7968,6 +7968,9 @@ _conf_to_memberp(TSOverridableConfigKey conf, OverridableHttpConfigParams *overr
     typ = OVERRIDABLE_TYPE_INT;
     ret = &overridableHttpConfig->websocket_active_timeout;
     break;
+  case TS_CONFIG_HTTP_UNCACHEABLE_REQUESTS_BYPASS_PARENT:
+    ret = &overridableHttpConfig->uncacheable_requests_bypass_parent;
+    break;
   // This helps avoiding compiler warnings, yet detect unhandled enum members.
   case TS_CONFIG_NULL:
   case TS_CONFIG_LAST_ENTRY:
@@ -8591,6 +8594,8 @@ TSHttpTxnConfigFind(const char *name, int length, TSOverridableConfigKey *conf,
     case 't':
       if (!strncmp(name, "proxy.config.http.keep_alive_no_activity_timeout_out", length))
         cnf = TS_CONFIG_HTTP_KEEP_ALIVE_NO_ACTIVITY_TIMEOUT_OUT;
+      else if (!strncmp(name, "proxy.config.http.uncacheable_requests_bypass_parent", length))
+        cnf = TS_CONFIG_HTTP_UNCACHEABLE_REQUESTS_BYPASS_PARENT;
       break;
     }
     break;
diff --git a/proxy/InkAPITest.cc b/proxy/InkAPITest.cc
index 4445e47..d3b5716 100644
--- a/proxy/InkAPITest.cc
+++ b/proxy/InkAPITest.cc
@@ -7353,6 +7353,7 @@ const char *SDK_Overridable_Configs[TS_CONFIG_LAST_ENTRY] = {
   "proxy.config.http.origin_max_connections_queue",
   "proxy.config.websocket.no_activity_timeout",
   "proxy.config.websocket.active_timeout",
+  "proxy.config.http.uncacheable_requests_bypass_parent",
 };
 
 REGRESSION_TEST(SDK_API_OVERRIDABLE_CONFIGS)(RegressionTest *test, int /* atype ATS_UNUSED */, int *pstatus)
diff --git a/proxy/http/HttpConfig.cc b/proxy/http/HttpConfig.cc
index 0891c95..c599a9e 100644
--- a/proxy/http/HttpConfig.cc
+++ b/proxy/http/HttpConfig.cc
@@ -891,7 +891,7 @@ HttpConfig::startup()
   // Wank me.
   HttpEstablishStaticConfigByte(c.disable_ssl_parenting, "proxy.local.http.parent_proxy.disable_connect_tunneling");
   HttpEstablishStaticConfigByte(c.no_dns_forward_to_parent, "proxy.config.http.no_dns_just_forward_to_parent");
-  HttpEstablishStaticConfigByte(c.uncacheable_requests_bypass_parent, "proxy.config.http.uncacheable_requests_bypass_parent");
+  HttpEstablishStaticConfigByte(c.oride.uncacheable_requests_bypass_parent, "proxy.config.http.uncacheable_requests_bypass_parent");
   HttpEstablishStaticConfigByte(c.oride.doc_in_cache_skip_dns, "proxy.config.http.doc_in_cache_skip_dns");
 
   HttpEstablishStaticConfigByte(c.no_origin_server_dns, "proxy.config.http.no_origin_server_dns");
@@ -1143,7 +1143,7 @@ HttpConfig::reconfigure()
   params->proxy_hostname = ats_strdup(m_master.proxy_hostname);
   params->proxy_hostname_len = (params->proxy_hostname) ? strlen(params->proxy_hostname) : 0;
   params->no_dns_forward_to_parent = INT_TO_BOOL(m_master.no_dns_forward_to_parent);
-  params->uncacheable_requests_bypass_parent = INT_TO_BOOL(m_master.uncacheable_requests_bypass_parent);
+  params->oride.uncacheable_requests_bypass_parent = INT_TO_BOOL(m_master.oride.uncacheable_requests_bypass_parent);
   params->no_origin_server_dns = INT_TO_BOOL(m_master.no_origin_server_dns);
   params->use_client_target_addr = m_master.use_client_target_addr;
   params->use_client_source_port = INT_TO_BOOL(m_master.use_client_source_port);
diff --git a/proxy/http/HttpConfig.h b/proxy/http/HttpConfig.h
index 58de48f..81d1efb 100644
--- a/proxy/http/HttpConfig.h
+++ b/proxy/http/HttpConfig.h
@@ -371,6 +371,7 @@ struct OverridableHttpConfigParams {
       server_session_sharing_match(TS_SERVER_SESSION_SHARING_MATCH_BOTH),
       auth_server_session_private(1),
       fwd_proxy_auth_to_parent(0),
+      uncacheable_requests_bypass_parent(1),
       insert_age_in_response(1),
       anonymize_remove_from(0),
       anonymize_remove_referer(0),
@@ -489,6 +490,7 @@ struct OverridableHttpConfigParams {
   //  MgmtByte share_server_sessions;
   MgmtByte auth_server_session_private;
   MgmtByte fwd_proxy_auth_to_parent;
+  MgmtByte uncacheable_requests_bypass_parent;
 
   MgmtByte insert_age_in_response;
 
@@ -714,7 +716,6 @@ public:
 
   MgmtByte enable_url_expandomatic;
   MgmtByte no_dns_forward_to_parent;
-  MgmtByte uncacheable_requests_bypass_parent;
   MgmtByte no_origin_server_dns;
   MgmtByte use_client_target_addr;
   MgmtByte use_client_source_port;
diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index 541d3d1..6de9c8d 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -257,7 +257,7 @@ find_server_and_update_current_info(HttpTransact::State *s)
       DebugTxn("http_trans", "request not cacheable, so bypass parent");
       s->parent_result.result = PARENT_DIRECT;
     }
-  } else if (s->http_config_param->uncacheable_requests_bypass_parent && s->http_config_param->no_dns_forward_to_parent == 0 &&
+  } else if (s->txn_conf->uncacheable_requests_bypass_parent && s->http_config_param->no_dns_forward_to_parent == 0 &&
              !HttpTransact::is_request_cache_lookupable(s)) {
     // request not lookupable and cacheable, so bypass parent if the parent is not an origin server.
     // Note that the configuration of the proxy as well as the request

-- 
To stop receiving notification emails like this one, please contact
"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>.