Advertisement
Guest User

Untitled

a guest
Apr 11th, 2017
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
LDIF 51.11 KB | None | 0 0
  1. diff --git a/doc/admin-guide/files/records.config.en.rst b/doc/admin-guide/files/records.config.en.rst
  2. index 3580d2d19..3979533ec 100644
  3. --- a/doc/admin-guide/files/records.config.en.rst
  4. +++ b/doc/admin-guide/files/records.config.en.rst
  5. @@ -1869,6 +1869,7 @@ Cache Control
  6.  
  7.  .. ts:cv:: CONFIG proxy.config.http.cache.enable_default_vary_headers INT 0
  8.     :reloadable:
  9. +   :overridable:
  10.  
  11.     Enables (``1``) or disables (``0``) caching of alternate versions of HTTP objects that do not contain the ``Vary`` header.
  12.  
  13. @@ -1931,6 +1932,7 @@ Cache Control
  14.  
  15.  .. ts:cv:: CONFIG proxy.config.http.cache.ignore_accept_mismatch INT 2
  16.     :reloadable:
  17. +   :overridable:
  18.  
  19.     When enabled with a value of ``1``, Traffic Server serves documents from cache with a
  20.     ``Content-Type:`` header even if it does not match the ``Accept:`` header of the
  21. @@ -1947,6 +1949,7 @@ Cache Control
  22.  
  23.  .. ts:cv:: CONFIG proxy.config.http.cache.ignore_accept_language_mismatch INT 2
  24.     :reloadable:
  25. +   :overridable:
  26.  
  27.     When enabled with a value of ``1``, Traffic Server serves documents from cache with a
  28.     ``Content-Language:`` header even if it does not match the ``Accept-Language:``
  29. @@ -1963,6 +1966,7 @@ Cache Control
  30.  
  31.  .. ts:cv:: CONFIG proxy.config.http.cache.ignore_accept_encoding_mismatch INT 2
  32.     :reloadable:
  33. +   :overridable:
  34.  
  35.     When enabled with a value of ``1``, Traffic Server serves documents from cache with a
  36.     ``Content-Encoding:`` header even if it does not match the ``Accept-Encoding:``
  37. @@ -1979,6 +1983,7 @@ Cache Control
  38.  
  39.  .. ts:cv:: CONFIG proxy.config.http.cache.ignore_accept_charset_mismatch INT 2
  40.     :reloadable:
  41. +   :overridable:
  42.  
  43.     When enabled with a value of ``1``, Traffic Server serves documents from cache with a
  44.     ``Content-Type:`` header even if it does not match the ``Accept-Charset:`` header
  45. @@ -2204,6 +2209,7 @@ Dynamic Content & Content Negotiation
  46.  
  47.  .. ts:cv:: CONFIG proxy.config.http.cache.vary_default_text STRING NULL
  48.     :reloadable:
  49. +   :overridable:
  50.  
  51.     The header on which Traffic Server varies for text documents.
  52.  
  53. @@ -2212,11 +2218,13 @@ all the different user-agent versions of documents it encounters.
  54.  
  55.  .. ts:cv:: CONFIG proxy.config.http.cache.vary_default_images STRING NULL
  56.     :reloadable:
  57. +   :overridable:
  58.  
  59.     The header on which Traffic Server varies for images.
  60.  
  61.  .. ts:cv:: CONFIG proxy.config.http.cache.vary_default_other STRING NULL
  62.     :reloadable:
  63. +   :overridable:
  64.  
  65.     The header on which Traffic Server varies for anything other than text and images.
  66.  
  67. diff --git a/iocore/cache/Cache.cc b/iocore/cache/Cache.cc
  68. index b4752ad5e..93745e577 100644
  69. --- a/iocore/cache/Cache.cc
  70. +++ b/iocore/cache/Cache.cc
  71. @@ -255,12 +255,12 @@ cache_stats_bytes_used_cb(const char *name, RecDataT data_type, RecData *data, R
  72.  #ifdef CLUSTER_CACHE
  73.  static Action *
  74.  open_read_internal(int opcode, Continuation *cont, MIOBuffer *buf, const HttpCacheKey *key, CacheHTTPHdr *request,
  75. -                   CacheLookupHttpConfig *params, time_t pin_in_cache, CacheFragType frag_type)
  76. +                   OverridableHttpConfigParams *params, time_t pin_in_cache, CacheFragType frag_type)
  77.  {
  78.    ClusterMachine *m = cluster_machine_at_depth(cache_hash(key->hash));
  79.  
  80.    if (m) {
  81. -    return Cluster_read(m, opcode, cont, buf, request, params, &key->hash, pin_in_cache, frag_type, key->hostname, key->hostlen);
  82. +    return Cluster_read(m, opcode, cont, buf, request, &key->hash, pin_in_cache, frag_type, key->hostname, key->hostlen);
  83.    } else {
  84.      if ((opcode == CACHE_OPEN_READ_LONG) || (opcode == CACHE_OPEN_READ_BUFFER_LONG)) {
  85.        return caches[frag_type]->open_read(cont, &key->hash, request, params, frag_type, key->hostname, key->hostlen);
  86. @@ -1136,7 +1136,7 @@ CacheProcessor::open_read(Continuation *cont, const CacheKey *key, bool cluster_
  87.      hkey.hostname = hostname;
  88.      hkey.hostlen  = hostlen;
  89.      return open_read_internal(CACHE_OPEN_READ, cont, (MIOBuffer *)nullptr, &hkey, (CacheHTTPHdr *)nullptr,
  90. -                              (CacheLookupHttpConfig *)nullptr, 0, frag_type);
  91. +                              (OverridableHttpConfigParams *)nullptr, 0, frag_type);
  92.    }
  93.  #endif
  94.    return caches[frag_type]->open_read(cont, key, frag_type, hostname, hostlen);
  95. @@ -3294,7 +3294,7 @@ ink_cache_init(ModuleVersion v)
  96.  //----------------------------------------------------------------------------
  97.  Action *
  98.  CacheProcessor::open_read(Continuation *cont, const HttpCacheKey *key, bool cluster_cache_local, CacheHTTPHdr *request,
  99. -                          CacheLookupHttpConfig *params, time_t pin_in_cache, CacheFragType type)
  100. +                          OverridableHttpConfigParams *params, time_t pin_in_cache, CacheFragType type)
  101.  {
  102.  #ifdef CLUSTER_CACHE
  103.    if (cache_clustering_enabled > 0 && !cluster_cache_local) {
  104. diff --git a/iocore/cache/CacheRead.cc b/iocore/cache/CacheRead.cc
  105. index ec3cf3d40..7f9094a64 100644
  106. --- a/iocore/cache/CacheRead.cc
  107. +++ b/iocore/cache/CacheRead.cc
  108. @@ -92,8 +92,8 @@ Lcallreturn:
  109.  
  110.  #ifdef HTTP_CACHE
  111.  Action *
  112. -Cache::open_read(Continuation *cont, const CacheKey *key, CacheHTTPHdr *request, CacheLookupHttpConfig *params, CacheFragType type,
  113. -                 const char *hostname, int host_len)
  114. +Cache::open_read(Continuation *cont, const CacheKey *key, CacheHTTPHdr *request, OverridableHttpConfigParams *params,
  115. +                 CacheFragType type, const char *hostname, int host_len)
  116.  {
  117.    if (!CacheProcessor::IsCacheReady(type)) {
  118.      cont->handleEvent(CACHE_EVENT_OPEN_READ_FAILED, (void *)-ECACHE_NOT_READY);
  119. diff --git a/iocore/cache/I_Cache.h b/iocore/cache/I_Cache.h
  120. index 39a110189..76fad29c0 100644
  121. --- a/iocore/cache/I_Cache.h
  122. +++ b/iocore/cache/I_Cache.h
  123. @@ -54,7 +54,7 @@ enum { RAM_HIT_COMPRESS_NONE = 1, RAM_HIT_COMPRESS_FASTLZ, RAM_HIT_COMPRESS_LIBZ
  124.  struct CacheVC;
  125.  struct CacheDisk;
  126.  #ifdef HTTP_CACHE
  127. -class CacheLookupHttpConfig;
  128. +struct OverridableHttpConfigParams;
  129.  class URL;
  130.  class HTTPHdr;
  131.  class HTTPInfo;
  132. @@ -94,7 +94,7 @@ struct CacheProcessor : public Processor {
  133.    Action *lookup(Continuation *cont, const HttpCacheKey *key, bool cluster_cache_local, bool local_only = false,
  134.                   CacheFragType frag_type = CACHE_FRAG_TYPE_HTTP);
  135.    inkcoreapi Action *open_read(Continuation *cont, const HttpCacheKey *key, bool cluster_cache_local, CacheHTTPHdr *request,
  136. -                               CacheLookupHttpConfig *params, time_t pin_in_cache = (time_t)0,
  137. +                               OverridableHttpConfigParams *params, time_t pin_in_cache = (time_t)0,
  138.                                 CacheFragType frag_type = CACHE_FRAG_TYPE_HTTP);
  139.    Action *open_write(Continuation *cont, int expected_size, const HttpCacheKey *key, bool cluster_cache_local,
  140.                       CacheHTTPHdr *request, CacheHTTPInfo *old_info, time_t pin_in_cache = (time_t)0,
  141. diff --git a/iocore/cache/P_CacheInternal.h b/iocore/cache/P_CacheInternal.h
  142. index d8bc466de..09ed81e40 100644
  143. --- a/iocore/cache/P_CacheInternal.h
  144. +++ b/iocore/cache/P_CacheInternal.h
  145. @@ -447,7 +447,7 @@ struct CacheVC : public CacheVConnection {
  146.    CacheHTTPInfo *info;
  147.    CacheHTTPInfoVector *write_vector;
  148.  #ifdef HTTP_CACHE
  149. -  CacheLookupHttpConfig *params;
  150. +  OverridableHttpConfigParams *params;
  151.  #endif
  152.    int header_len;        // for communicating with agg_copy
  153.    int frag_len;          // for communicating with agg_copy
  154. @@ -988,7 +988,7 @@ struct Cache {
  155.    Action *scan(Continuation *cont, const char *hostname = 0, int host_len = 0, int KB_per_second = 2500);
  156.  
  157.  #ifdef HTTP_CACHE
  158. -  Action *open_read(Continuation *cont, const CacheKey *key, CacheHTTPHdr *request, CacheLookupHttpConfig *params,
  159. +  Action *open_read(Continuation *cont, const CacheKey *key, CacheHTTPHdr *request, OverridableHttpConfigParams *params,
  160.                      CacheFragType type, const char *hostname, int host_len);
  161.    Action *open_write(Continuation *cont, const CacheKey *key, CacheHTTPInfo *old_info, time_t pin_in_cache = (time_t)0,
  162.                       const CacheKey *key1 = nullptr, CacheFragType type = CACHE_FRAG_TYPE_HTTP, const char *hostname = 0,
  163. diff --git a/iocore/cache/P_CacheTest.h b/iocore/cache/P_CacheTest.h
  164. index 9e291e868..196b09384 100644
  165. --- a/iocore/cache/P_CacheTest.h
  166. +++ b/iocore/cache/P_CacheTest.h
  167. @@ -76,7 +76,6 @@ struct CacheTestSM : public RegressionSM {
  168.    MIOBuffer *buffer;
  169.    IOBufferReader *buffer_reader;
  170.  #ifdef HTTP_CACHE
  171. -  CacheLookupHttpConfig params;
  172.    CacheHTTPInfo info;
  173.    char urlstr[1024];
  174.  #endif
  175. diff --git a/iocore/cluster/ClusterCache.cc b/iocore/cluster/ClusterCache.cc
  176. index 68abf241d..e50d302d6 100644
  177. --- a/iocore/cluster/ClusterCache.cc
  178. +++ b/iocore/cluster/ClusterCache.cc
  179. @@ -1156,15 +1156,8 @@ cache_op_ClusterFunction(ClusterHandler *ch, void *data, int len)
  180.      moi_len -= res;
  181.      p += res;
  182.      ink_assert(moi_len > 0);
  183. -    // Unmarshal CacheLookupHttpConfig
  184. -    c->ic_params = new (CacheLookupHttpConfigAllocator.alloc()) CacheLookupHttpConfig();
  185. -    res          = c->ic_params->unmarshal(&c->ic_arena, (const char *)p, moi_len);
  186. -    ink_assert(res > 0);
  187. -
  188. -    moi_len -= res;
  189. -    p += res;
  190.  
  191. -    CacheKey key(msg->url_md5);
  192. +    c->http_config_params = HttpConfig::acquire();
  193.  
  194.      char *hostname = nullptr;
  195.      int host_len   = 0;
  196. @@ -1182,8 +1175,11 @@ cache_op_ClusterFunction(ClusterHandler *ch, void *data, int len)
  197.        memcpy(c->ic_hostname->data(), hostname, host_len);
  198.      }
  199.  
  200. +    // This is technically not correct, since we're not treating these properly as overridable. But,
  201. +    // this is dead code (mostly), and they weren't overridable before.
  202. +    CacheKey key(msg->url_md5);
  203.      Cache *call_cache = caches[c->frag_type];
  204. -    Action *a         = call_cache->open_read(c, &key, &c->ic_request, c->ic_params, c->frag_type, hostname, host_len);
  205. +    Action *a = call_cache->open_read(c, &key, &c->ic_request, &c->http_config_params->oride, c->frag_type, hostname, host_len);
  206.      // Get rid of purify warnings since 'c' can be freed by open_read.
  207.      if (a != ACTION_RESULT_DONE) {
  208.        c->cache_action = a;
  209. diff --git a/iocore/cluster/P_ClusterCacheInternal.h b/iocore/cluster/P_ClusterCacheInternal.h
  210. index 88975c3f6..9b6cce90e 100644
  211. --- a/iocore/cluster/P_ClusterCacheInternal.h
  212. +++ b/iocore/cluster/P_ClusterCacheInternal.h
  213. @@ -161,7 +161,7 @@ struct CacheContinuation : public Continuation {
  214.    Arena ic_arena;
  215.    CacheHTTPHdr ic_request;
  216.    CacheHTTPHdr ic_response;
  217. -  CacheLookupHttpConfig *ic_params;
  218. +  HttpConfigParams *http_config_params;
  219.    CacheHTTPInfo ic_old_info;
  220.    CacheHTTPInfo ic_new_info;
  221.    Ptr<IOBufferData> ic_hostname;
  222. @@ -250,11 +250,7 @@ struct CacheContinuation : public Continuation {
  223.      if (cache_vc_info.valid()) {
  224.        cache_vc_info.destroy();
  225.      }
  226. -    // Deallocate unmarshaled data
  227. -    if (ic_params) {
  228. -      delete ic_params;
  229. -      ic_params = 0;
  230. -    }
  231. +
  232.      if (ic_request.valid()) {
  233.        ic_request.clear();
  234.      }
  235. @@ -267,6 +263,12 @@ struct CacheContinuation : public Continuation {
  236.      if (ic_new_info.valid()) {
  237.        ic_new_info.destroy();
  238.      }
  239. +
  240. +    if (http_config_params) {
  241. +      HttpConfig::release(http_config_params);
  242. +      http_config_params = 0;
  243. +    }
  244. +
  245.      ic_arena.reset();
  246.      freeMsgBuffer();
  247.  
  248. @@ -316,7 +318,7 @@ struct CacheContinuation : public Continuation {
  249.        ic_arena(),
  250.        ic_request(),
  251.        ic_response(),
  252. -      ic_params(0),
  253. +      http_config_params(nullptr),
  254.        ic_old_info(),
  255.        ic_new_info(),
  256.        ic_hostname_len(0),
  257. diff --git a/iocore/cluster/P_ClusterInline.h b/iocore/cluster/P_ClusterInline.h
  258. index 27230dd99..162056886 100644
  259. --- a/iocore/cluster/P_ClusterInline.h
  260. +++ b/iocore/cluster/P_ClusterInline.h
  261. @@ -60,10 +60,8 @@ Cluster_lookup(Continuation *cont, const CacheKey *key, CacheFragType frag_type,
  262.  
  263.  inline Action *
  264.  Cluster_read(ClusterMachine *owner_machine, int opcode, Continuation *cont, MIOBuffer *buf, CacheHTTPHdr *request,
  265. -             CacheLookupHttpConfig *params, const CacheKey *key, time_t pin_in_cache, CacheFragType frag_type, const char *hostname,
  266. -             int hostlen)
  267. +             const CacheKey *key, time_t pin_in_cache, CacheFragType frag_type, const char *hostname, int hostlen)
  268.  {
  269. -  (void)params;
  270.    if (clusterProcessor.disable_remote_cluster_ops(owner_machine)) {
  271.      Action a;
  272.      a = cont;
  273. @@ -85,7 +83,6 @@ Cluster_read(ClusterMachine *owner_machine, int opcode, Continuation *cont, MIOB
  274.        flen = op_to_sizeof_fixedlen_msg(opcode);
  275.  
  276.        len += request->m_heap->marshal_length();
  277. -      len += params->marshal_length();
  278.        len += hostlen;
  279.  
  280.        if ((flen + len) > DEFAULT_MAX_BUFFER_SIZE) // Bound marshalled data
  281. @@ -103,9 +100,6 @@ Cluster_read(ClusterMachine *owner_machine, int opcode, Continuation *cont, MIOB
  282.        }
  283.        data += res;
  284.        cur_len -= res;
  285. -      if ((res = params->marshal(data, cur_len)) < 0)
  286. -        goto err_exit;
  287. -      data += res;
  288.        memcpy(data, hostname, hostlen);
  289.  
  290.        CacheOpArgs_General readArgs;
  291. diff --git a/lib/ts/apidefs.h.in b/lib/ts/apidefs.h.in
  292. index 14d305365..73ea3a4d1 100644
  293. --- a/lib/ts/apidefs.h.in
  294. +++ b/lib/ts/apidefs.h.in
  295. @@ -748,6 +748,14 @@ typedef enum {
  296.    TS_CONFIG_SSL_CERT_FILENAME,
  297.    TS_CONFIG_SSL_CERT_FILEPATH,
  298.    TS_CONFIG_PARENT_FAILURES_UPDATE_HOSTDB,
  299. +  TS_CONFIG_HTTP_CACHE_ENABLE_DEFAULT_VARY_HEADER,
  300. +  TS_CONFIG_HTTP_CACHE_VARY_DEFAULT_TEXT,
  301. +  TS_CONFIG_HTTP_CACHE_VARY_DEFAULT_IMAGES,
  302. +  TS_CONFIG_HTTP_CACHE_VARY_DEFAULT_OTHER,
  303. +  TS_CONFIG_HTTP_CACHE_IGNORE_ACCEPT_MISMATCH,
  304. +  TS_CONFIG_HTTP_CACHE_IGNORE_ACCEPT_LANGUAGE_MISMATCH,
  305. +  TS_CONFIG_HTTP_CACHE_IGNORE_ACCEPT_ENCODING_MISMATCH,
  306. +  TS_CONFIG_HTTP_CACHE_IGNORE_ACCEPT_CHARSET_MISMATCH,
  307.    TS_CONFIG_LAST_ENTRY
  308.  } TSOverridableConfigKey;
  309.  
  310. diff --git a/plugins/experimental/ts_lua/ts_lua_http_config.c b/plugins/experimental/ts_lua/ts_lua_http_config.c
  311. index 591a88a48..cd8b26f8b 100644
  312. --- a/plugins/experimental/ts_lua/ts_lua_http_config.c
  313. +++ b/plugins/experimental/ts_lua/ts_lua_http_config.c
  314. @@ -119,12 +119,20 @@ typedef enum {
  315.    TS_LUA_CONFIG_HTTP_UNCACHEABLE_REQUESTS_BYPASS_PARENT       = TS_CONFIG_HTTP_UNCACHEABLE_REQUESTS_BYPASS_PARENT,
  316.    TS_LUA_CONFIG_HTTP_PARENT_PROXY_TOTAL_CONNECT_ATTEMPTS      = TS_CONFIG_HTTP_PARENT_PROXY_TOTAL_CONNECT_ATTEMPTS,
  317.    TS_LUA_CONFIG_HTTP_TRANSACTION_ACTIVE_TIMEOUT_IN            = TS_CONFIG_HTTP_TRANSACTION_ACTIVE_TIMEOUT_IN,
  318. -  TS_LUA_CONFIG_LAST_ENTRY                                    = TS_CONFIG_LAST_ENTRY,
  319.    TS_LUA_CONFIG_SRV_ENABLED                                   = TS_CONFIG_SRV_ENABLED,
  320.    TS_LUA_CONFIG_HTTP_FORWARD_CONNECT_METHOD                   = TS_CONFIG_HTTP_FORWARD_CONNECT_METHOD,
  321.    TS_LUA_CONFIG_SSL_CERT_FILENAME                             = TS_CONFIG_SSL_CERT_FILENAME,
  322.    TS_LUA_CONFIG_SSL_CERT_FILEPATH                             = TS_CONFIG_SSL_CERT_FILEPATH,
  323.    TS_LUA_CONFIG_PARENT_FAILURES_UPDATE_HOSTDB                 = TS_CONFIG_PARENT_FAILURES_UPDATE_HOSTDB,
  324. +  TS_LUA_CONFIG_HTTP_CACHE_ENABLE_DEFAULT_VARY_HEADER         = TS_CONFIG_HTTP_CACHE_ENABLE_DEFAULT_VARY_HEADER,
  325. +  TS_LUA_CONFIG_HTTP_CACHE_VARY_DEFAULT_TEXT                  = TS_CONFIG_HTTP_CACHE_VARY_DEFAULT_TEXT,
  326. +  TS_LUA_CONFIG_HTTP_CACHE_VARY_DEFAULT_IMAGES                = TS_CONFIG_HTTP_CACHE_VARY_DEFAULT_IMAGES,
  327. +  TS_LUA_CONFIG_HTTP_CACHE_VARY_DEFAULT_OTHER                 = TS_CONFIG_HTTP_CACHE_VARY_DEFAULT_OTHER,
  328. +  TS_LUA_CONFIG_HTTP_CACHE_IGNORE_ACCEPT_MISMATCH             = TS_CONFIG_HTTP_CACHE_IGNORE_ACCEPT_MISMATCH,
  329. +  TS_LUA_CONFIG_HTTP_CACHE_IGNORE_ACCEPT_LANGUAGE_MISMATCH    = TS_CONFIG_HTTP_CACHE_IGNORE_ACCEPT_LANGUAGE_MISMATCH,
  330. +  TS_LUA_CONFIG_HTTP_CACHE_IGNORE_ACCEPT_ENCODING_MISMATCH    = TS_CONFIG_HTTP_CACHE_IGNORE_ACCEPT_ENCODING_MISMATCH,
  331. +  TS_LUA_CONFIG_HTTP_CACHE_IGNORE_ACCEPT_CHARSET_MISMATCH     = TS_CONFIG_HTTP_CACHE_IGNORE_ACCEPT_CHARSET_MISMATCH,
  332. +  TS_LUA_CONFIG_LAST_ENTRY                                    = TS_CONFIG_LAST_ENTRY,
  333.  } TSLuaOverridableConfigKey;
  334.  
  335.  typedef enum {
  336. @@ -240,6 +248,14 @@ ts_lua_var_item ts_lua_http_config_vars[] = {
  337.    TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_SSL_CERT_FILENAME),
  338.    TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_SSL_CERT_FILEPATH),
  339.    TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_PARENT_FAILURES_UPDATE_HOSTDB),
  340. +  TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_CACHE_ENABLE_DEFAULT_VARY_HEADER),
  341. +  TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_CACHE_VARY_DEFAULT_TEXT),
  342. +  TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_CACHE_VARY_DEFAULT_IMAGES),
  343. +  TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_CACHE_VARY_DEFAULT_OTHER),
  344. +  TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_CACHE_IGNORE_ACCEPT_MISMATCH),
  345. +  TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_CACHE_IGNORE_ACCEPT_LANGUAGE_MISMATCH),
  346. +  TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_CACHE_IGNORE_ACCEPT_ENCODING_MISMATCH),
  347. +  TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_CACHE_IGNORE_ACCEPT_CHARSET_MISMATCH),
  348.    TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_LAST_ENTRY),
  349.  };
  350.  
  351. diff --git a/proxy/ICP.cc b/proxy/ICP.cc
  352. index 1a1b04ffb..287149567 100644
  353. --- a/proxy/ICP.cc
  354. +++ b/proxy/ICP.cc
  355. @@ -43,7 +43,6 @@
  356.  #include "BaseManager.h"
  357.  #include "HdrUtils.h"
  358.  
  359. -extern CacheLookupHttpConfig global_cache_lookup_config;
  360.  HTTPHdr gclient_request;
  361.  
  362.  //****************************************************************************
  363. @@ -312,11 +311,13 @@ ICPPeerReadCont::init(ICPProcessor *ICPpr, Peer *p, int lookup_local)
  364.    _object_read                = nullptr;
  365.    _cache_req_hdr_heap_handle  = nullptr;
  366.    _cache_resp_hdr_heap_handle = nullptr;
  367. +  _http_config_params         = HttpConfig::acquire();
  368.    mutex                       = new_ProxyMutex();
  369.  }
  370.  
  371.  ICPPeerReadCont::~ICPPeerReadCont()
  372.  {
  373. +  HttpConfig::release(_http_config_params);
  374.    reset(1); // Full reset
  375.  }
  376.  
  377. @@ -472,7 +473,9 @@ ICPPeerReadCont::ICPPeerQueryCont(int /* event ATS_UNUSED */, Event * /* e ATS_U
  378.        // Note: _cache_lookup_local is ignored in this case, since
  379.        //       cache clustering is not used with stale lookup.
  380.        //////////////////////////////////////////////////////////////
  381. -      a = cacheProcessor.open_read(this, &key, false, &gclient_request, &global_cache_lookup_config, (time_t)0);
  382. +
  383. +      // ToDo: This is maybe not 100% correct, since this is not using the txnp (but the global overridable copy)
  384. +      a = cacheProcessor.open_read(this, &key, false, &gclient_request, &_http_config_params->oride, (time_t)0);
  385.      } else {
  386.        a = cacheProcessor.lookup(this, &key, false, _state->_cache_lookup_local);
  387.      }
  388. diff --git a/proxy/ICP.h b/proxy/ICP.h
  389. index a7fe97862..530c24ada 100644
  390. --- a/proxy/ICP.h
  391. +++ b/proxy/ICP.h
  392. @@ -1166,6 +1166,8 @@ public:
  393.    HTTPInfo *_object_read;
  394.    HdrHeapSDKHandle *_cache_req_hdr_heap_handle;
  395.    HdrHeapSDKHandle *_cache_resp_hdr_heap_handle;
  396. +  // HTTP Config
  397. +  HttpConfigParams *_http_config_params;
  398.  
  399.  private:
  400.    // Class data
  401. diff --git a/proxy/InkAPI.cc b/proxy/InkAPI.cc
  402. index 0d157d5ba..7a176255f 100644
  403. --- a/proxy/InkAPI.cc
  404. +++ b/proxy/InkAPI.cc
  405. @@ -8110,6 +8110,30 @@ _conf_to_memberp(TSOverridableConfigKey conf, OverridableHttpConfigParams *overr
  406.    case TS_CONFIG_PARENT_FAILURES_UPDATE_HOSTDB:
  407.      ret = _memberp_to_generic(&overridableHttpConfig->parent_failures_update_hostdb, typep);
  408.      break;
  409. +  case TS_CONFIG_HTTP_CACHE_ENABLE_DEFAULT_VARY_HEADER:
  410. +    ret = _memberp_to_generic(&overridableHttpConfig->cache_enable_default_vary_headers, typep);
  411. +    break;
  412. +  case TS_CONFIG_HTTP_CACHE_VARY_DEFAULT_TEXT:
  413. +    ret = _memberp_to_generic(&overridableHttpConfig->cache_vary_default_text, typep);
  414. +    break;
  415. +  case TS_CONFIG_HTTP_CACHE_VARY_DEFAULT_IMAGES:
  416. +    ret = _memberp_to_generic(&overridableHttpConfig->cache_vary_default_images, typep);
  417. +    break;
  418. +  case TS_CONFIG_HTTP_CACHE_VARY_DEFAULT_OTHER:
  419. +    ret = _memberp_to_generic(&overridableHttpConfig->cache_vary_default_other, typep);
  420. +    break;
  421. +  case TS_CONFIG_HTTP_CACHE_IGNORE_ACCEPT_MISMATCH:
  422. +    ret = _memberp_to_generic(&overridableHttpConfig->ignore_accept_mismatch, typep);
  423. +    break;
  424. +  case TS_CONFIG_HTTP_CACHE_IGNORE_ACCEPT_LANGUAGE_MISMATCH:
  425. +    ret = _memberp_to_generic(&overridableHttpConfig->ignore_accept_language_mismatch, typep);
  426. +    break;
  427. +  case TS_CONFIG_HTTP_CACHE_IGNORE_ACCEPT_ENCODING_MISMATCH:
  428. +    ret = _memberp_to_generic(&overridableHttpConfig->ignore_accept_encoding_mismatch, typep);
  429. +    break;
  430. +  case TS_CONFIG_HTTP_CACHE_IGNORE_ACCEPT_CHARSET_MISMATCH:
  431. +    ret = _memberp_to_generic(&overridableHttpConfig->ignore_accept_charset_mismatch, typep);
  432. +    break;
  433.    // This helps avoiding compiler warnings, yet detect unhandled enum members.
  434.    case TS_CONFIG_NULL:
  435.    case TS_CONFIG_LAST_ENTRY:
  436. @@ -8545,6 +8569,12 @@ TSHttpTxnConfigFind(const char *name, int length, TSOverridableConfigKey *conf,
  437.          cnf = TS_CONFIG_HTTP_FLOW_CONTROL_HIGH_WATER_MARK;
  438.        }
  439.        break;
  440. +    case 't':
  441. +      if (!strncmp(name, "proxy.config.http.cache.vary_default_text", length)) {
  442. +        cnf = TS_CONFIG_HTTP_CACHE_VARY_DEFAULT_TEXT;
  443. +        typ = TS_RECORDDATATYPE_STRING;
  444. +      }
  445. +      break;
  446.      }
  447.      break;
  448.  
  449. @@ -8568,6 +8598,9 @@ TSHttpTxnConfigFind(const char *name, int length, TSOverridableConfigKey *conf,
  450.        } else if (!strncmp(name, "proxy.config.http.global_user_agent_header", length)) {
  451.          cnf = TS_CONFIG_HTTP_GLOBAL_USER_AGENT_HEADER;
  452.          typ = TS_RECORDDATATYPE_STRING;
  453. +      } else if (!strncmp(name, "proxy.config.http.cache.vary_default_other", length)) {
  454. +        cnf = TS_CONFIG_HTTP_CACHE_VARY_DEFAULT_OTHER;
  455. +        typ = TS_RECORDDATATYPE_STRING;
  456.        }
  457.        break;
  458.      case 't':
  459. @@ -8607,6 +8640,12 @@ TSHttpTxnConfigFind(const char *name, int length, TSOverridableConfigKey *conf,
  460.          cnf = TS_CONFIG_HTTP_CACHE_HEURISTIC_LM_FACTOR;
  461.        }
  462.        break;
  463. +    case 's':
  464. +      if (!strncmp(name, "proxy.config.http.cache.vary_default_images", length)) {
  465. +        cnf = TS_CONFIG_HTTP_CACHE_VARY_DEFAULT_IMAGES;
  466. +        typ = TS_RECORDDATATYPE_STRING;
  467. +      }
  468. +      break;
  469.      }
  470.      break;
  471.  
  472. @@ -8679,6 +8718,18 @@ TSHttpTxnConfigFind(const char *name, int length, TSOverridableConfigKey *conf,
  473.          cnf = TS_CONFIG_HTTP_ORIGIN_MAX_CONNECTIONS_QUEUE;
  474.        }
  475.        break;
  476. +    case 'h':
  477. +      if (0 == strncmp(name, "proxy.config.http.server_session_sharing.match", length)) {
  478. +        cnf = TS_CONFIG_HTTP_SERVER_SESSION_SHARING_MATCH;
  479. +      } else if (!strncmp(name, "proxy.config.http.cache.ignore_accept_mismatch", length)) {
  480. +        cnf = TS_CONFIG_HTTP_CACHE_IGNORE_ACCEPT_MISMATCH;
  481. +      }
  482. +      break;
  483. +    case 'n':
  484. +      if (!strncmp(name, "proxy.config.http.cache.open_write_fail_action", length)) {
  485. +        cnf = TS_CONFIG_HTTP_CACHE_OPEN_WRITE_FAIL_ACTION;
  486. +      }
  487. +      break;
  488.      case 'r':
  489.        if (!strncmp(name, "proxy.config.http.insert_squid_x_forwarded_for", length)) {
  490.          cnf = TS_CONFIG_HTTP_INSERT_SQUID_X_FORWARDED_FOR;
  491. @@ -8696,16 +8747,6 @@ TSHttpTxnConfigFind(const char *name, int length, TSOverridableConfigKey *conf,
  492.          cnf = TS_CONFIG_HTTP_FORWARD_PROXY_AUTH_TO_PARENT;
  493.        }
  494.        break;
  495. -    case 'h':
  496. -      if (0 == strncmp(name, "proxy.config.http.server_session_sharing.match", length)) {
  497. -        cnf = TS_CONFIG_HTTP_SERVER_SESSION_SHARING_MATCH;
  498. -      }
  499. -      break;
  500. -    case 'n':
  501. -      if (!strncmp(name, "proxy.config.http.cache.open_write_fail_action", length)) {
  502. -        cnf = TS_CONFIG_HTTP_CACHE_OPEN_WRITE_FAIL_ACTION;
  503. -      }
  504. -      break;
  505.      }
  506.      break;
  507.  
  508. @@ -8791,6 +8832,11 @@ TSHttpTxnConfigFind(const char *name, int length, TSOverridableConfigKey *conf,
  509.          cnf = TS_CONFIG_HTTP_POST_CHECK_CONTENT_LENGTH_ENABLED;
  510.        }
  511.        break;
  512. +    case 's':
  513. +      if (!strncmp(name, "proxy.config.http.cache.enable_default_vary_headers", length)) {
  514. +        cnf = TS_CONFIG_HTTP_CACHE_ENABLE_DEFAULT_VARY_HEADER;
  515. +      }
  516. +      break;
  517.      }
  518.      break;
  519.  
  520. @@ -8837,6 +8883,20 @@ TSHttpTxnConfigFind(const char *name, int length, TSOverridableConfigKey *conf,
  521.      }
  522.      break;
  523.  
  524. +  case 54:
  525. +    if (!strncmp(name, "proxy.config.http.cache.ignore_accept_charset_mismatch", length)) {
  526. +      cnf = TS_CONFIG_HTTP_CACHE_IGNORE_ACCEPT_CHARSET_MISMATCH;
  527. +    }
  528. +    break;
  529. +
  530. +  case 55:
  531. +    if (!strncmp(name, "proxy.config.http.cache.ignore_accept_language_mismatch", length)) {
  532. +      cnf = TS_CONFIG_HTTP_CACHE_IGNORE_ACCEPT_LANGUAGE_MISMATCH;
  533. +    } else if (!strncmp(name, "proxy.config.http.cache.ignore_accept_encoding_mismatch", length)) {
  534. +      cnf = TS_CONFIG_HTTP_CACHE_IGNORE_ACCEPT_ENCODING_MISMATCH;
  535. +    }
  536. +    break;
  537. +
  538.    case 58:
  539.      if (!strncmp(name, "proxy.config.http.connect_attempts_max_retries_dead_server", length)) {
  540.        cnf = TS_CONFIG_HTTP_CONNECT_ATTEMPTS_MAX_RETRIES_DEAD_SERVER;
  541. diff --git a/proxy/InkAPITest.cc b/proxy/InkAPITest.cc
  542. index 6721f0169..a47ea3e3c 100644
  543. --- a/proxy/InkAPITest.cc
  544. +++ b/proxy/InkAPITest.cc
  545. @@ -7623,6 +7623,14 @@ const char *SDK_Overridable_Configs[TS_CONFIG_LAST_ENTRY] = {
  546.    "proxy.config.ssl.client.cert.filename",
  547.    "proxy.config.ssl.client.cert.path",
  548.    "proxy.config.http.parent_proxy.mark_down_hostdb",
  549. +  "proxy.config.http.cache.enable_default_vary_headers",
  550. +  "proxy.config.http.cache.vary_default_text",
  551. +  "proxy.config.http.cache.vary_default_images",
  552. +  "proxy.config.http.cache.vary_default_other",
  553. +  "proxy.config.http.cache.ignore_accept_mismatch",
  554. +  "proxy.config.http.cache.ignore_accept_language_mismatch",
  555. +  "proxy.config.http.cache.ignore_accept_encoding_mismatch",
  556. +  "proxy.config.http.cache.ignore_accept_charset_mismatch",
  557.  };
  558.  
  559.  REGRESSION_TEST(SDK_API_OVERRIDABLE_CONFIGS)(RegressionTest *test, int /* atype ATS_UNUSED */, int *pstatus)
  560. diff --git a/proxy/Prefetch.cc b/proxy/Prefetch.cc
  561. index 399821615..966b2d933 100644
  562. --- a/proxy/Prefetch.cc
  563. +++ b/proxy/Prefetch.cc
  564. @@ -1446,12 +1446,8 @@ PrefetchBlaster::handleEvent(int event, void *data)
  565.  
  566.      // Here, we need to decide if we need to prefetch based on whether it
  567.      // is in the cache or not.
  568. -
  569. -    // if (cache_lookup_necessary) do:
  570. -    initCacheLookupConfig();
  571. -
  572.      Cache::generate_key(&key, request->url_get()); // XXX choose a cache generation number ...
  573. -    cacheProcessor.open_read(this, &key, false, request, &cache_lookup_config, 0);
  574. +    cacheProcessor.open_read(this, &key, false, request, &http_config_params->oride, 0);
  575.  
  576.      break;
  577.    }
  578. @@ -1815,21 +1811,6 @@ PrefetchBlaster::invokeBlaster()
  579.    return 0;
  580.  }
  581.  
  582. -void
  583. -PrefetchBlaster::initCacheLookupConfig()
  584. -{
  585. -  // The look up parameters are intialized in the same as it is done
  586. -  // in HttpSM::init(). Any changes there should come in here.
  587. -  HttpConfigParams *http_config_params                  = HttpConfig::acquire();
  588. -  cache_lookup_config.cache_global_user_agent_header    = http_config_params->oride.global_user_agent_header ? true : false;
  589. -  cache_lookup_config.cache_enable_default_vary_headers = http_config_params->cache_enable_default_vary_headers ? true : false;
  590. -  cache_lookup_config.cache_vary_default_text           = http_config_params->cache_vary_default_text;
  591. -  cache_lookup_config.cache_vary_default_images         = http_config_params->cache_vary_default_images;
  592. -  cache_lookup_config.cache_vary_default_other          = http_config_params->cache_vary_default_other;
  593. -
  594. -  HttpConfig::release(http_config_params);
  595. -}
  596. -
  597.  static int
  598.  config_read_proto(TSPrefetchBlastData &blast, const char *str)
  599.  {
  600. diff --git a/proxy/Prefetch.h b/proxy/Prefetch.h
  601. index 91d9b0698..ae5aa02a0 100644
  602. --- a/proxy/Prefetch.h
  603. +++ b/proxy/Prefetch.h
  604. @@ -303,8 +303,12 @@ public:
  605.        serverVC(0),
  606.        n_pkts_sent(0),
  607.        seq_no(0),
  608. -      io_block(0){};
  609. -  ~PrefetchBlaster(){};
  610. +      io_block(0)
  611. +  {
  612. +    http_config_params = HttpConfig::acquire();
  613. +  };
  614. +
  615. +  ~PrefetchBlaster() { HttpConfig::release(http_config_params); };
  616.  
  617.    int init(PrefetchUrlEntry *entry, HTTPHdr *request, PrefetchTransform *p_trans);
  618.  
  619. @@ -314,7 +318,6 @@ public:
  620.    int httpClient(int event, void *data);
  621.  
  622.    int invokeBlaster();
  623. -  void initCacheLookupConfig();
  624.  
  625.    void handleCookieHeaders(HTTPHdr *req_hdr, HTTPHdr *resp_hdr, const char *domain_start, const char *domain_end,
  626.                             const char *host_start, int host_len, bool no_dot);
  627. @@ -334,8 +337,7 @@ public:
  628.    VConnection *serverVC;
  629.  
  630.    TSPrefetchBlastData data_blast;
  631. -
  632. -  CacheLookupHttpConfig cache_lookup_config;
  633. +  HttpConfigParams *http_config_params;
  634.  
  635.    // udp related:
  636.    uint32_t n_pkts_sent;
  637. diff --git a/proxy/http/HttpCacheSM.cc b/proxy/http/HttpCacheSM.cc
  638. index 7ad75a526..74cdfca74 100644
  639. --- a/proxy/http/HttpCacheSM.cc
  640. +++ b/proxy/http/HttpCacheSM.cc
  641. @@ -75,7 +75,7 @@ HttpCacheSM::HttpCacheSM()
  642.      open_write_cb(false),
  643.      open_read_tries(0),
  644.      read_request_hdr(nullptr),
  645. -    read_config(nullptr),
  646. +    http_params(nullptr),
  647.      read_pin_in_cache(0),
  648.      retry_write(true),
  649.      open_write_tries(0),
  650. @@ -251,7 +251,7 @@ HttpCacheSM::do_cache_open_read(const HttpCacheKey &key)
  651.    // Initialising read-while-write-inprogress flag
  652.    this->readwhilewrite_inprogress = false;
  653.    Action *action_handle           = cacheProcessor.open_read(this, &key, master_sm->t_state.cache_control.cluster_cache_local,
  654. -                                                   this->read_request_hdr, this->read_config, this->read_pin_in_cache);
  655. +                                                   this->read_request_hdr, this->http_params, this->read_pin_in_cache);
  656.  
  657.    if (action_handle != ACTION_RESULT_DONE) {
  658.      pending_action = action_handle;
  659. @@ -269,14 +269,14 @@ HttpCacheSM::do_cache_open_read(const HttpCacheKey &key)
  660.  }
  661.  
  662.  Action *
  663. -HttpCacheSM::open_read(const HttpCacheKey *key, URL *url, HTTPHdr *hdr, CacheLookupHttpConfig *params, time_t pin_in_cache)
  664. +HttpCacheSM::open_read(const HttpCacheKey *key, URL *url, HTTPHdr *hdr, OverridableHttpConfigParams *params, time_t pin_in_cache)
  665.  {
  666.    Action *act_return;
  667.  
  668.    cache_key         = *key;
  669.    lookup_url        = url;
  670.    read_request_hdr  = hdr;
  671. -  read_config       = params;
  672. +  http_params       = params;
  673.    read_pin_in_cache = pin_in_cache;
  674.    ink_assert(pending_action == nullptr);
  675.    SET_HANDLER(&HttpCacheSM::state_cache_open_read);
  676. diff --git a/proxy/http/HttpCacheSM.h b/proxy/http/HttpCacheSM.h
  677. index cf2702c0a..4037d7848 100644
  678. --- a/proxy/http/HttpCacheSM.h
  679. +++ b/proxy/http/HttpCacheSM.h
  680. @@ -41,7 +41,6 @@
  681.  
  682.  class HttpSM;
  683.  class HttpCacheSM;
  684. -class CacheLookupHttpConfig;
  685.  
  686.  struct HttpCacheAction : public Action {
  687.    HttpCacheAction();
  688. @@ -67,7 +66,7 @@ public:
  689.      captive_action.init(this);
  690.    }
  691.  
  692. -  Action *open_read(const HttpCacheKey *key, URL *url, HTTPHdr *hdr, CacheLookupHttpConfig *params, time_t pin_in_cache);
  693. +  Action *open_read(const HttpCacheKey *key, URL *url, HTTPHdr *hdr, OverridableHttpConfigParams *params, time_t pin_in_cache);
  694.  
  695.    Action *open_write(const HttpCacheKey *key, URL *url, HTTPHdr *request, CacheHTTPInfo *old_info, time_t pin_in_cache, bool retry,
  696.                       bool allow_multiple);
  697. @@ -198,7 +197,7 @@ private:
  698.    // Open read parameters
  699.    int open_read_tries;
  700.    HTTPHdr *read_request_hdr;
  701. -  CacheLookupHttpConfig *read_config;
  702. +  OverridableHttpConfigParams *http_params;
  703.    time_t read_pin_in_cache;
  704.  
  705.    // Open write parameters
  706. diff --git a/proxy/http/HttpConfig.cc b/proxy/http/HttpConfig.cc
  707. index a452d199e..60fa3fc42 100644
  708. --- a/proxy/http/HttpConfig.cc
  709. +++ b/proxy/http/HttpConfig.cc
  710. @@ -1021,9 +1021,9 @@ HttpConfig::startup()
  711.    HttpEstablishStaticConfigLongLong(c.oride.freshness_fuzz_min_time, "proxy.config.http.cache.fuzz.min_time");
  712.    HttpEstablishStaticConfigFloat(c.oride.freshness_fuzz_prob, "proxy.config.http.cache.fuzz.probability");
  713.  
  714. -  HttpEstablishStaticConfigStringAlloc(c.cache_vary_default_text, "proxy.config.http.cache.vary_default_text");
  715. -  HttpEstablishStaticConfigStringAlloc(c.cache_vary_default_images, "proxy.config.http.cache.vary_default_images");
  716. -  HttpEstablishStaticConfigStringAlloc(c.cache_vary_default_other, "proxy.config.http.cache.vary_default_other");
  717. +  HttpEstablishStaticConfigStringAlloc(c.oride.cache_vary_default_text, "proxy.config.http.cache.vary_default_text");
  718. +  HttpEstablishStaticConfigStringAlloc(c.oride.cache_vary_default_images, "proxy.config.http.cache.vary_default_images");
  719. +  HttpEstablishStaticConfigStringAlloc(c.oride.cache_vary_default_other, "proxy.config.http.cache.vary_default_other");
  720.  
  721.    // open read failure retries
  722.    HttpEstablishStaticConfigLongLong(c.oride.max_cache_open_read_retries, "proxy.config.http.cache.max_open_read_retries");
  723. @@ -1043,13 +1043,13 @@ HttpConfig::startup()
  724.  
  725.    HttpEstablishStaticConfigByte(c.oride.cache_ignore_auth, "proxy.config.http.cache.ignore_authentication");
  726.    HttpEstablishStaticConfigByte(c.oride.cache_urls_that_look_dynamic, "proxy.config.http.cache.cache_urls_that_look_dynamic");
  727. -  HttpEstablishStaticConfigByte(c.cache_enable_default_vary_headers, "proxy.config.http.cache.enable_default_vary_headers");
  728. +  HttpEstablishStaticConfigByte(c.oride.cache_enable_default_vary_headers, "proxy.config.http.cache.enable_default_vary_headers");
  729.    HttpEstablishStaticConfigByte(c.cache_post_method, "proxy.config.http.cache.post_method");
  730.  
  731. -  HttpEstablishStaticConfigByte(c.ignore_accept_mismatch, "proxy.config.http.cache.ignore_accept_mismatch");
  732. -  HttpEstablishStaticConfigByte(c.ignore_accept_language_mismatch, "proxy.config.http.cache.ignore_accept_language_mismatch");
  733. -  HttpEstablishStaticConfigByte(c.ignore_accept_encoding_mismatch, "proxy.config.http.cache.ignore_accept_encoding_mismatch");
  734. -  HttpEstablishStaticConfigByte(c.ignore_accept_charset_mismatch, "proxy.config.http.cache.ignore_accept_charset_mismatch");
  735. +  HttpEstablishStaticConfigByte(c.oride.ignore_accept_mismatch, "proxy.config.http.cache.ignore_accept_mismatch");
  736. +  HttpEstablishStaticConfigByte(c.oride.ignore_accept_language_mismatch, "proxy.config.http.cache.ignore_accept_language_mismatch");
  737. +  HttpEstablishStaticConfigByte(c.oride.ignore_accept_encoding_mismatch, "proxy.config.http.cache.ignore_accept_encoding_mismatch");
  738. +  HttpEstablishStaticConfigByte(c.oride.ignore_accept_charset_mismatch, "proxy.config.http.cache.ignore_accept_charset_mismatch");
  739.  
  740.    HttpEstablishStaticConfigByte(c.send_100_continue_response, "proxy.config.http.send_100_continue_response");
  741.    HttpEstablishStaticConfigByte(c.disallow_post_100_continue, "proxy.config.http.disallow_post_100_continue");
  742. @@ -1309,9 +1309,9 @@ HttpConfig::reconfigure()
  743.    params->oride.freshness_fuzz_min_time = m_master.oride.freshness_fuzz_min_time;
  744.    params->oride.freshness_fuzz_prob     = m_master.oride.freshness_fuzz_prob;
  745.  
  746. -  params->cache_vary_default_text   = ats_strdup(m_master.cache_vary_default_text);
  747. -  params->cache_vary_default_images = ats_strdup(m_master.cache_vary_default_images);
  748. -  params->cache_vary_default_other  = ats_strdup(m_master.cache_vary_default_other);
  749. +  params->oride.cache_vary_default_text   = ats_strdup(m_master.oride.cache_vary_default_text);
  750. +  params->oride.cache_vary_default_images = ats_strdup(m_master.oride.cache_vary_default_images);
  751. +  params->oride.cache_vary_default_other  = ats_strdup(m_master.oride.cache_vary_default_other);
  752.  
  753.    params->oride.srv_enabled = m_master.oride.srv_enabled;
  754.  
  755. @@ -1323,22 +1323,22 @@ HttpConfig::reconfigure()
  756.    // open write failure retries
  757.    params->oride.max_cache_open_write_retries = m_master.oride.max_cache_open_write_retries;
  758.  
  759. -  params->oride.cache_http                     = INT_TO_BOOL(m_master.oride.cache_http);
  760. -  params->oride.cache_cluster_cache_local      = INT_TO_BOOL(m_master.oride.cache_cluster_cache_local);
  761. -  params->oride.cache_ignore_client_no_cache   = INT_TO_BOOL(m_master.oride.cache_ignore_client_no_cache);
  762. -  params->oride.cache_ignore_client_cc_max_age = INT_TO_BOOL(m_master.oride.cache_ignore_client_cc_max_age);
  763. -  params->oride.cache_ims_on_client_no_cache   = INT_TO_BOOL(m_master.oride.cache_ims_on_client_no_cache);
  764. -  params->oride.cache_ignore_server_no_cache   = INT_TO_BOOL(m_master.oride.cache_ignore_server_no_cache);
  765. -  params->oride.cache_responses_to_cookies     = m_master.oride.cache_responses_to_cookies;
  766. -  params->oride.cache_ignore_auth              = INT_TO_BOOL(m_master.oride.cache_ignore_auth);
  767. -  params->oride.cache_urls_that_look_dynamic   = INT_TO_BOOL(m_master.oride.cache_urls_that_look_dynamic);
  768. -  params->cache_enable_default_vary_headers    = INT_TO_BOOL(m_master.cache_enable_default_vary_headers);
  769. -  params->cache_post_method                    = INT_TO_BOOL(m_master.cache_post_method);
  770. -
  771. -  params->ignore_accept_mismatch          = m_master.ignore_accept_mismatch;
  772. -  params->ignore_accept_language_mismatch = m_master.ignore_accept_language_mismatch;
  773. -  params->ignore_accept_encoding_mismatch = m_master.ignore_accept_encoding_mismatch;
  774. -  params->ignore_accept_charset_mismatch  = m_master.ignore_accept_charset_mismatch;
  775. +  params->oride.cache_http                        = INT_TO_BOOL(m_master.oride.cache_http);
  776. +  params->oride.cache_cluster_cache_local         = INT_TO_BOOL(m_master.oride.cache_cluster_cache_local);
  777. +  params->oride.cache_ignore_client_no_cache      = INT_TO_BOOL(m_master.oride.cache_ignore_client_no_cache);
  778. +  params->oride.cache_ignore_client_cc_max_age    = INT_TO_BOOL(m_master.oride.cache_ignore_client_cc_max_age);
  779. +  params->oride.cache_ims_on_client_no_cache      = INT_TO_BOOL(m_master.oride.cache_ims_on_client_no_cache);
  780. +  params->oride.cache_ignore_server_no_cache      = INT_TO_BOOL(m_master.oride.cache_ignore_server_no_cache);
  781. +  params->oride.cache_responses_to_cookies        = m_master.oride.cache_responses_to_cookies;
  782. +  params->oride.cache_ignore_auth                 = INT_TO_BOOL(m_master.oride.cache_ignore_auth);
  783. +  params->oride.cache_urls_that_look_dynamic      = INT_TO_BOOL(m_master.oride.cache_urls_that_look_dynamic);
  784. +  params->oride.cache_enable_default_vary_headers = INT_TO_BOOL(m_master.oride.cache_enable_default_vary_headers);
  785. +  params->cache_post_method                       = INT_TO_BOOL(m_master.cache_post_method);
  786. +
  787. +  params->oride.ignore_accept_mismatch          = m_master.oride.ignore_accept_mismatch;
  788. +  params->oride.ignore_accept_language_mismatch = m_master.oride.ignore_accept_language_mismatch;
  789. +  params->oride.ignore_accept_encoding_mismatch = m_master.oride.ignore_accept_encoding_mismatch;
  790. +  params->oride.ignore_accept_charset_mismatch  = m_master.oride.ignore_accept_charset_mismatch;
  791.  
  792.    params->send_100_continue_response = INT_TO_BOOL(m_master.send_100_continue_response);
  793.    params->disallow_post_100_continue = INT_TO_BOOL(m_master.disallow_post_100_continue);
  794. diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
  795. index 6ad2c9689..96077b65c 100644
  796. --- a/proxy/http/HttpSM.cc
  797. +++ b/proxy/http/HttpSM.cc
  798. @@ -394,20 +394,6 @@ HttpSM::init()
  799.    // entire struct if nothing is going to change it.
  800.    t_state.txn_conf = &t_state.http_config_param->oride;
  801.  
  802. -  // update the cache info config structure so that
  803. -  // selection from alternates happens correctly.
  804. -  t_state.cache_info.config.cache_global_user_agent_header  = t_state.txn_conf->global_user_agent_header ? true : false;
  805. -  t_state.cache_info.config.ignore_accept_mismatch          = t_state.http_config_param->ignore_accept_mismatch;
  806. -  t_state.cache_info.config.ignore_accept_language_mismatch = t_state.http_config_param->ignore_accept_language_mismatch;
  807. -  t_state.cache_info.config.ignore_accept_encoding_mismatch = t_state.http_config_param->ignore_accept_encoding_mismatch;
  808. -  t_state.cache_info.config.ignore_accept_charset_mismatch  = t_state.http_config_param->ignore_accept_charset_mismatch;
  809. -  t_state.cache_info.config.cache_enable_default_vary_headers =
  810. -    t_state.http_config_param->cache_enable_default_vary_headers ? true : false;
  811. -
  812. -  t_state.cache_info.config.cache_vary_default_text   = t_state.http_config_param->cache_vary_default_text;
  813. -  t_state.cache_info.config.cache_vary_default_images = t_state.http_config_param->cache_vary_default_images;
  814. -  t_state.cache_info.config.cache_vary_default_other  = t_state.http_config_param->cache_vary_default_other;
  815. -
  816.    t_state.init();
  817.  
  818.    // Added to skip dns if the document is in cache. DNS will be forced if there is a ip based ACL in
  819. @@ -4580,7 +4566,7 @@ HttpSM::do_cache_lookup_and_read()
  820.    Cache::generate_key(&key, c_url, t_state.txn_conf->cache_generation_number);
  821.  
  822.    Action *cache_action_handle =
  823. -    cache_sm.open_read(&key, c_url, &t_state.hdr_info.client_request, &(t_state.cache_info.config),
  824. +    cache_sm.open_read(&key, c_url, &t_state.hdr_info.client_request, t_state.txn_conf,
  825.                         (time_t)((t_state.cache_control.pin_in_cache_for < 0) ? 0 : t_state.cache_control.pin_in_cache_for));
  826.    //
  827.    // pin_in_cache value is an open_write parameter.
  828. diff --git a/proxy/http/HttpTransact.h b/proxy/http/HttpTransact.h
  829. index 6d451dd0d..1d47619a1 100644
  830. --- a/proxy/http/HttpTransact.h
  831. +++ b/proxy/http/HttpTransact.h
  832. @@ -598,7 +598,6 @@ public:
  833.      HTTPInfo *second_object_read;
  834.      HTTPInfo object_store;
  835.      HTTPInfo transform_store;
  836. -    CacheLookupHttpConfig config;
  837.      CacheDirectives directives;
  838.      int open_read_retries;
  839.      int open_write_retries;
  840. @@ -620,7 +619,6 @@ public:
  841.          second_object_read(NULL),
  842.          object_store(),
  843.          transform_store(),
  844. -        config(),
  845.          directives(),
  846.          open_read_retries(0),
  847.          open_write_retries(0),
  848. diff --git a/proxy/http/HttpTransactCache.cc b/proxy/http/HttpTransactCache.cc
  849. index c6a801c7a..be47b7889 100644
  850. --- a/proxy/http/HttpTransactCache.cc
  851. +++ b/proxy/http/HttpTransactCache.cc
  852. @@ -31,10 +31,6 @@
  853.  #include "HttpCompat.h"
  854.  #include "ts/InkErrno.h"
  855.  
  856. -ClassAllocator<CacheLookupHttpConfig> CacheLookupHttpConfigAllocator("CacheLookupHttpConfigAllocator");
  857. -
  858. -CacheLookupHttpConfig global_cache_lookup_config;
  859. -
  860.  /**
  861.    Find the pointer and length of an etag, after stripping off any leading
  862.    "W/" prefix, and surrounding double quotes.
  863. @@ -168,7 +164,7 @@ is_empty(char *s)
  864.  */
  865.  int
  866.  HttpTransactCache::SelectFromAlternates(CacheHTTPInfoVector *cache_vector, HTTPHdr *client_request,
  867. -                                        CacheLookupHttpConfig *http_config_params)
  868. +                                        OverridableHttpConfigParams *http_config_params)
  869.  {
  870.    time_t current_age, best_age = CacheHighAgeWatermark;
  871.    time_t t_now         = 0;
  872. @@ -188,10 +184,9 @@ HttpTransactCache::SelectFromAlternates(CacheHTTPInfoVector *cache_vector, HTTPH
  873.      fprintf(stderr, "[alts] There are %d alternates for this request header.\n", alt_count);
  874.      RELEASE_PRINT_LOCK()
  875.    }
  876. -  // used by ICP to bypass this function
  877. -  if (http_config_params == &global_cache_lookup_config) {
  878. -    return 0;
  879. -  }
  880. +
  881. +  // ToDo: Need a way to detect if it's ICP here or not, and then "return 0;". That's what the old
  882. +  // code did, in a very convoluted way ...
  883.  
  884.    if (!client_request->valid()) {
  885.      return 0;
  886. @@ -299,7 +294,7 @@ HttpTransactCache::SelectFromAlternates(CacheHTTPInfoVector *cache_vector, HTTPH
  887.  
  888.  */
  889.  float
  890. -HttpTransactCache::calculate_quality_of_match(CacheLookupHttpConfig *http_config_param, HTTPHdr *client_request,
  891. +HttpTransactCache::calculate_quality_of_match(OverridableHttpConfigParams *http_config_param, HTTPHdr *client_request,
  892.                                                HTTPHdr *obj_client_request, HTTPHdr *obj_origin_server_response)
  893.  {
  894.    // For PURGE requests, any alternate is good really.
  895. @@ -1144,8 +1139,8 @@ language_wildcard:
  896.  
  897.  */
  898.  Variability_t
  899. -HttpTransactCache::CalcVariability(CacheLookupHttpConfig *http_config_params, HTTPHdr *client_request, HTTPHdr *obj_client_request,
  900. -                                   HTTPHdr *obj_origin_server_response)
  901. +HttpTransactCache::CalcVariability(OverridableHttpConfigParams *http_config_params, HTTPHdr *client_request,
  902. +                                   HTTPHdr *obj_client_request, HTTPHdr *obj_origin_server_response)
  903.  {
  904.    ink_assert(http_config_params != nullptr);
  905.    ink_assert(client_request != nullptr);
  906. @@ -1223,7 +1218,7 @@ HttpTransactCache::CalcVariability(CacheLookupHttpConfig *http_config_params, HT
  907.        // Special case: if 'proxy.config.http.global_user_agent_header' set                  //
  908.        // we should ignore Vary: User-Agent.                                                 //
  909.        ////////////////////////////////////////////////////////////////////////////////////////
  910. -      if (http_config_params->cache_global_user_agent_header && !strcasecmp((char *)field->str, "User-Agent")) {
  911. +      if (http_config_params->global_user_agent_header && !strcasecmp((char *)field->str, "User-Agent")) {
  912.          continue;
  913.        }
  914.  
  915. @@ -1467,95 +1462,3 @@ HttpTransactCache::match_response_to_request_conditionals(HTTPHdr *request, HTTP
  916.  
  917.    return response->status_get();
  918.  }
  919. -
  920. -/*---------------------------------------------------
  921. - *        class CacheLookupHttpConfig
  922. - *---------------------------------------------------*/
  923. -int
  924. -CacheLookupHttpConfig::marshal_length()
  925. -{
  926. -  int len = (int)sizeof(int32_t);
  927. -  len += (cache_vary_default_text ? strlen(cache_vary_default_text) + 1 : 1);
  928. -  len += (cache_vary_default_images ? strlen(cache_vary_default_images) + 1 : 1);
  929. -  len += (cache_vary_default_other ? strlen(cache_vary_default_other) + 1 : 1);
  930. -  return len;
  931. -}
  932. -
  933. -int
  934. -CacheLookupHttpConfig::marshal(char *buf, int length)
  935. -{
  936. -  int32_t i32_tmp;
  937. -  char *p = buf;
  938. -  int len;
  939. -
  940. -  if ((length -= sizeof(int32_t)) < 0) {
  941. -    return -1;
  942. -  }
  943. -
  944. -  i32_tmp = (int32_t)cache_enable_default_vary_headers;
  945. -  memcpy(p, &i32_tmp, sizeof(int32_t));
  946. -  p += sizeof(int32_t);
  947. -
  948. -  len = (cache_vary_default_text ? strlen(cache_vary_default_text) + 1 : 1);
  949. -  if ((length -= len) < 0) {
  950. -    return -1;
  951. -  }
  952. -  ink_strlcpy(p, (cache_vary_default_text ? cache_vary_default_text : ""), length);
  953. -  p += len;
  954. -
  955. -  len = (cache_vary_default_images ? strlen(cache_vary_default_images) + 1 : 1);
  956. -  if ((length -= len) < 0) {
  957. -    return -1;
  958. -  }
  959. -  ink_strlcpy(p, (cache_vary_default_images ? cache_vary_default_images : ""), length);
  960. -  p += len;
  961. -
  962. -  len = (cache_vary_default_other ? strlen(cache_vary_default_other) + 1 : 1);
  963. -  if ((length -= len) < 0) {
  964. -    return -1;
  965. -  }
  966. -  ink_strlcpy(p, (cache_vary_default_other ? cache_vary_default_other : ""), length);
  967. -  p += len;
  968. -
  969. -  return (p - buf);
  970. -}
  971. -
  972. -int
  973. -CacheLookupHttpConfig::unmarshal(Arena *arena, const char *buf, int buflen)
  974. -{
  975. -  const char *p = buf;
  976. -  int length    = buflen;
  977. -  int len;
  978. -  int32_t i32_tmp;
  979. -
  980. -  if ((length -= sizeof(int32_t)) < 0) {
  981. -    return -1;
  982. -  }
  983. -
  984. -  memcpy(&i32_tmp, p, sizeof(int32_t));
  985. -  cache_enable_default_vary_headers = (bool)i32_tmp;
  986. -  p += sizeof(int32_t);
  987. -
  988. -  len = strlen(p) + 1;
  989. -  if ((length -= len) < 0) {
  990. -    return -1;
  991. -  }
  992. -  cache_vary_default_text = arena->str_store(((len == 2) ? "" : p), len - 1);
  993. -  p += len;
  994. -
  995. -  len = strlen(p) + 1;
  996. -  if ((length -= len) < 0) {
  997. -    return -1;
  998. -  }
  999. -  cache_vary_default_images = arena->str_store(((len == 2) ? "" : p), len - 1);
  1000. -  p += len;
  1001. -
  1002. -  len = strlen(p) + 1;
  1003. -  if ((length -= len) < 0) {
  1004. -    return -1;
  1005. -  }
  1006. -  cache_vary_default_other = arena->str_store(((len == 2) ? "" : p), len - 1);
  1007. -  p += len;
  1008. -
  1009. -  return (p - buf);
  1010. -}
  1011. diff --git a/proxy/http/HttpTransactCache.h b/proxy/http/HttpTransactCache.h
  1012. index 974a8874d..b3e7cb29e 100644
  1013. --- a/proxy/http/HttpTransactCache.h
  1014. +++ b/proxy/http/HttpTransactCache.h
  1015. @@ -32,64 +32,13 @@
  1016.  #define _HttpTransactCache_h_
  1017.  
  1018.  #include "ts/ink_platform.h"
  1019. +#include "HttpConfig.h"
  1020.  
  1021.  // This is needed since txn_conf->cache_guaranteed_max_lifetime is currently not
  1022.  // readily available in the cache. ToDo: We should fix this with TS-1919
  1023.  static const time_t CacheHighAgeWatermark = UINT_MAX;
  1024. -
  1025.  struct CacheHTTPInfoVector;
  1026.  
  1027. -class CacheLookupHttpConfig
  1028. -{
  1029. -public:
  1030. -  bool cache_global_user_agent_header; // 'global' user agent flag (don't need to marshal/unmarshal)
  1031. -  bool cache_enable_default_vary_headers;
  1032. -  unsigned ignore_accept_mismatch;
  1033. -  unsigned ignore_accept_language_mismatch;
  1034. -  unsigned ignore_accept_encoding_mismatch;
  1035. -  unsigned ignore_accept_charset_mismatch;
  1036. -  char *cache_vary_default_text;
  1037. -  char *cache_vary_default_images;
  1038. -  char *cache_vary_default_other;
  1039. -
  1040. -  inkcoreapi int marshal_length();
  1041. -  inkcoreapi int marshal(char *buf, int length);
  1042. -  int unmarshal(Arena *arena, const char *buf, int length);
  1043. -
  1044. -  CacheLookupHttpConfig()
  1045. -    : cache_global_user_agent_header(false),
  1046. -      cache_enable_default_vary_headers(false),
  1047. -      ignore_accept_mismatch(0),
  1048. -      ignore_accept_language_mismatch(0),
  1049. -      ignore_accept_encoding_mismatch(0),
  1050. -      ignore_accept_charset_mismatch(0),
  1051. -      cache_vary_default_text(NULL),
  1052. -      cache_vary_default_images(NULL),
  1053. -      cache_vary_default_other(NULL)
  1054. -  {
  1055. -  }
  1056. -
  1057. -  void *operator new(size_t size, void *mem);
  1058. -  void operator delete(void *mem);
  1059. -};
  1060. -
  1061. -extern ClassAllocator<CacheLookupHttpConfig> CacheLookupHttpConfigAllocator;
  1062. -// this is a global CacheLookupHttpConfig used to bypass SelectFromAlternates
  1063. -extern CacheLookupHttpConfig global_cache_lookup_config;
  1064. -
  1065. -inline void *
  1066. -CacheLookupHttpConfig::operator new(size_t size, void *mem)
  1067. -{
  1068. -  (void)size;
  1069. -  return mem;
  1070. -}
  1071. -
  1072. -inline void
  1073. -CacheLookupHttpConfig::operator delete(void *mem)
  1074. -{
  1075. -  CacheLookupHttpConfigAllocator.free((CacheLookupHttpConfig *)mem);
  1076. -}
  1077. -
  1078.  enum Variability_t {
  1079.    VARIABILITY_NONE = 0,
  1080.    VARIABILITY_SOME,
  1081. @@ -109,11 +58,10 @@ public:
  1082.    /////////////////////////////////
  1083.  
  1084.    static int SelectFromAlternates(CacheHTTPInfoVector *cache_vector_data, HTTPHdr *client_request,
  1085. -                                  CacheLookupHttpConfig *cache_lookup_http_config_params);
  1086. +                                  OverridableHttpConfigParams *cache_lookup_http_config_params);
  1087.  
  1088. -  static float calculate_quality_of_match(CacheLookupHttpConfig *http_config_params, HTTPHdr *client_request, // in
  1089. -                                          HTTPHdr *obj_client_request,                                        // in
  1090. -                                          HTTPHdr *obj_origin_server_response);                               // in
  1091. +  static float calculate_quality_of_match(OverridableHttpConfigParams *http_config_params, HTTPHdr *client_request,
  1092. +                                          HTTPHdr *obj_client_request, HTTPHdr *obj_origin_server_response);
  1093.  
  1094.    static float calculate_quality_of_accept_match(MIMEField *accept_field, MIMEField *content_field);
  1095.  
  1096. @@ -131,10 +79,8 @@ public:
  1097.    // variability & server negotiation routines //
  1098.    ///////////////////////////////////////////////
  1099.  
  1100. -  static Variability_t CalcVariability(CacheLookupHttpConfig *http_config_params, HTTPHdr *client_request, // in
  1101. -                                       HTTPHdr *obj_client_request,                                        // in
  1102. -                                       HTTPHdr *obj_origin_server_response                                 // in
  1103. -                                       );
  1104. +  static Variability_t CalcVariability(OverridableHttpConfigParams *http_config_params, HTTPHdr *client_request,
  1105. +                                       HTTPHdr *obj_client_request, HTTPHdr *obj_origin_server_response);
  1106.  
  1107.    static HTTPStatus match_response_to_request_conditionals(HTTPHdr *ua_request, HTTPHdr *c_response,
  1108.                                                             ink_time_t response_received_time);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement