Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/doc/admin-guide/files/records.config.en.rst b/doc/admin-guide/files/records.config.en.rst
- index 3580d2d19..3979533ec 100644
- --- a/doc/admin-guide/files/records.config.en.rst
- +++ b/doc/admin-guide/files/records.config.en.rst
- @@ -1869,6 +1869,7 @@ Cache Control
- .. ts:cv:: CONFIG proxy.config.http.cache.enable_default_vary_headers INT 0
- :reloadable:
- + :overridable:
- Enables (``1``) or disables (``0``) caching of alternate versions of HTTP objects that do not contain the ``Vary`` header.
- @@ -1931,6 +1932,7 @@ Cache Control
- .. ts:cv:: CONFIG proxy.config.http.cache.ignore_accept_mismatch INT 2
- :reloadable:
- + :overridable:
- When enabled with a value of ``1``, Traffic Server serves documents from cache with a
- ``Content-Type:`` header even if it does not match the ``Accept:`` header of the
- @@ -1947,6 +1949,7 @@ Cache Control
- .. ts:cv:: CONFIG proxy.config.http.cache.ignore_accept_language_mismatch INT 2
- :reloadable:
- + :overridable:
- When enabled with a value of ``1``, Traffic Server serves documents from cache with a
- ``Content-Language:`` header even if it does not match the ``Accept-Language:``
- @@ -1963,6 +1966,7 @@ Cache Control
- .. ts:cv:: CONFIG proxy.config.http.cache.ignore_accept_encoding_mismatch INT 2
- :reloadable:
- + :overridable:
- When enabled with a value of ``1``, Traffic Server serves documents from cache with a
- ``Content-Encoding:`` header even if it does not match the ``Accept-Encoding:``
- @@ -1979,6 +1983,7 @@ Cache Control
- .. ts:cv:: CONFIG proxy.config.http.cache.ignore_accept_charset_mismatch INT 2
- :reloadable:
- + :overridable:
- When enabled with a value of ``1``, Traffic Server serves documents from cache with a
- ``Content-Type:`` header even if it does not match the ``Accept-Charset:`` header
- @@ -2204,6 +2209,7 @@ Dynamic Content & Content Negotiation
- .. ts:cv:: CONFIG proxy.config.http.cache.vary_default_text STRING NULL
- :reloadable:
- + :overridable:
- The header on which Traffic Server varies for text documents.
- @@ -2212,11 +2218,13 @@ all the different user-agent versions of documents it encounters.
- .. ts:cv:: CONFIG proxy.config.http.cache.vary_default_images STRING NULL
- :reloadable:
- + :overridable:
- The header on which Traffic Server varies for images.
- .. ts:cv:: CONFIG proxy.config.http.cache.vary_default_other STRING NULL
- :reloadable:
- + :overridable:
- The header on which Traffic Server varies for anything other than text and images.
- diff --git a/iocore/cache/Cache.cc b/iocore/cache/Cache.cc
- index b4752ad5e..93745e577 100644
- --- a/iocore/cache/Cache.cc
- +++ b/iocore/cache/Cache.cc
- @@ -255,12 +255,12 @@ cache_stats_bytes_used_cb(const char *name, RecDataT data_type, RecData *data, R
- #ifdef CLUSTER_CACHE
- static Action *
- open_read_internal(int opcode, Continuation *cont, MIOBuffer *buf, const HttpCacheKey *key, CacheHTTPHdr *request,
- - CacheLookupHttpConfig *params, time_t pin_in_cache, CacheFragType frag_type)
- + OverridableHttpConfigParams *params, time_t pin_in_cache, CacheFragType frag_type)
- {
- ClusterMachine *m = cluster_machine_at_depth(cache_hash(key->hash));
- if (m) {
- - return Cluster_read(m, opcode, cont, buf, request, params, &key->hash, pin_in_cache, frag_type, key->hostname, key->hostlen);
- + return Cluster_read(m, opcode, cont, buf, request, &key->hash, pin_in_cache, frag_type, key->hostname, key->hostlen);
- } else {
- if ((opcode == CACHE_OPEN_READ_LONG) || (opcode == CACHE_OPEN_READ_BUFFER_LONG)) {
- return caches[frag_type]->open_read(cont, &key->hash, request, params, frag_type, key->hostname, key->hostlen);
- @@ -1136,7 +1136,7 @@ CacheProcessor::open_read(Continuation *cont, const CacheKey *key, bool cluster_
- hkey.hostname = hostname;
- hkey.hostlen = hostlen;
- return open_read_internal(CACHE_OPEN_READ, cont, (MIOBuffer *)nullptr, &hkey, (CacheHTTPHdr *)nullptr,
- - (CacheLookupHttpConfig *)nullptr, 0, frag_type);
- + (OverridableHttpConfigParams *)nullptr, 0, frag_type);
- }
- #endif
- return caches[frag_type]->open_read(cont, key, frag_type, hostname, hostlen);
- @@ -3294,7 +3294,7 @@ ink_cache_init(ModuleVersion v)
- //----------------------------------------------------------------------------
- Action *
- CacheProcessor::open_read(Continuation *cont, const HttpCacheKey *key, bool cluster_cache_local, CacheHTTPHdr *request,
- - CacheLookupHttpConfig *params, time_t pin_in_cache, CacheFragType type)
- + OverridableHttpConfigParams *params, time_t pin_in_cache, CacheFragType type)
- {
- #ifdef CLUSTER_CACHE
- if (cache_clustering_enabled > 0 && !cluster_cache_local) {
- diff --git a/iocore/cache/CacheRead.cc b/iocore/cache/CacheRead.cc
- index ec3cf3d40..7f9094a64 100644
- --- a/iocore/cache/CacheRead.cc
- +++ b/iocore/cache/CacheRead.cc
- @@ -92,8 +92,8 @@ Lcallreturn:
- #ifdef HTTP_CACHE
- Action *
- -Cache::open_read(Continuation *cont, const CacheKey *key, CacheHTTPHdr *request, CacheLookupHttpConfig *params, CacheFragType type,
- - const char *hostname, int host_len)
- +Cache::open_read(Continuation *cont, const CacheKey *key, CacheHTTPHdr *request, OverridableHttpConfigParams *params,
- + CacheFragType type, const char *hostname, int host_len)
- {
- if (!CacheProcessor::IsCacheReady(type)) {
- cont->handleEvent(CACHE_EVENT_OPEN_READ_FAILED, (void *)-ECACHE_NOT_READY);
- diff --git a/iocore/cache/I_Cache.h b/iocore/cache/I_Cache.h
- index 39a110189..76fad29c0 100644
- --- a/iocore/cache/I_Cache.h
- +++ b/iocore/cache/I_Cache.h
- @@ -54,7 +54,7 @@ enum { RAM_HIT_COMPRESS_NONE = 1, RAM_HIT_COMPRESS_FASTLZ, RAM_HIT_COMPRESS_LIBZ
- struct CacheVC;
- struct CacheDisk;
- #ifdef HTTP_CACHE
- -class CacheLookupHttpConfig;
- +struct OverridableHttpConfigParams;
- class URL;
- class HTTPHdr;
- class HTTPInfo;
- @@ -94,7 +94,7 @@ struct CacheProcessor : public Processor {
- Action *lookup(Continuation *cont, const HttpCacheKey *key, bool cluster_cache_local, bool local_only = false,
- CacheFragType frag_type = CACHE_FRAG_TYPE_HTTP);
- inkcoreapi Action *open_read(Continuation *cont, const HttpCacheKey *key, bool cluster_cache_local, CacheHTTPHdr *request,
- - CacheLookupHttpConfig *params, time_t pin_in_cache = (time_t)0,
- + OverridableHttpConfigParams *params, time_t pin_in_cache = (time_t)0,
- CacheFragType frag_type = CACHE_FRAG_TYPE_HTTP);
- Action *open_write(Continuation *cont, int expected_size, const HttpCacheKey *key, bool cluster_cache_local,
- CacheHTTPHdr *request, CacheHTTPInfo *old_info, time_t pin_in_cache = (time_t)0,
- diff --git a/iocore/cache/P_CacheInternal.h b/iocore/cache/P_CacheInternal.h
- index d8bc466de..09ed81e40 100644
- --- a/iocore/cache/P_CacheInternal.h
- +++ b/iocore/cache/P_CacheInternal.h
- @@ -447,7 +447,7 @@ struct CacheVC : public CacheVConnection {
- CacheHTTPInfo *info;
- CacheHTTPInfoVector *write_vector;
- #ifdef HTTP_CACHE
- - CacheLookupHttpConfig *params;
- + OverridableHttpConfigParams *params;
- #endif
- int header_len; // for communicating with agg_copy
- int frag_len; // for communicating with agg_copy
- @@ -988,7 +988,7 @@ struct Cache {
- Action *scan(Continuation *cont, const char *hostname = 0, int host_len = 0, int KB_per_second = 2500);
- #ifdef HTTP_CACHE
- - Action *open_read(Continuation *cont, const CacheKey *key, CacheHTTPHdr *request, CacheLookupHttpConfig *params,
- + Action *open_read(Continuation *cont, const CacheKey *key, CacheHTTPHdr *request, OverridableHttpConfigParams *params,
- CacheFragType type, const char *hostname, int host_len);
- Action *open_write(Continuation *cont, const CacheKey *key, CacheHTTPInfo *old_info, time_t pin_in_cache = (time_t)0,
- const CacheKey *key1 = nullptr, CacheFragType type = CACHE_FRAG_TYPE_HTTP, const char *hostname = 0,
- diff --git a/iocore/cache/P_CacheTest.h b/iocore/cache/P_CacheTest.h
- index 9e291e868..196b09384 100644
- --- a/iocore/cache/P_CacheTest.h
- +++ b/iocore/cache/P_CacheTest.h
- @@ -76,7 +76,6 @@ struct CacheTestSM : public RegressionSM {
- MIOBuffer *buffer;
- IOBufferReader *buffer_reader;
- #ifdef HTTP_CACHE
- - CacheLookupHttpConfig params;
- CacheHTTPInfo info;
- char urlstr[1024];
- #endif
- diff --git a/iocore/cluster/ClusterCache.cc b/iocore/cluster/ClusterCache.cc
- index 68abf241d..e50d302d6 100644
- --- a/iocore/cluster/ClusterCache.cc
- +++ b/iocore/cluster/ClusterCache.cc
- @@ -1156,15 +1156,8 @@ cache_op_ClusterFunction(ClusterHandler *ch, void *data, int len)
- moi_len -= res;
- p += res;
- ink_assert(moi_len > 0);
- - // Unmarshal CacheLookupHttpConfig
- - c->ic_params = new (CacheLookupHttpConfigAllocator.alloc()) CacheLookupHttpConfig();
- - res = c->ic_params->unmarshal(&c->ic_arena, (const char *)p, moi_len);
- - ink_assert(res > 0);
- -
- - moi_len -= res;
- - p += res;
- - CacheKey key(msg->url_md5);
- + c->http_config_params = HttpConfig::acquire();
- char *hostname = nullptr;
- int host_len = 0;
- @@ -1182,8 +1175,11 @@ cache_op_ClusterFunction(ClusterHandler *ch, void *data, int len)
- memcpy(c->ic_hostname->data(), hostname, host_len);
- }
- + // This is technically not correct, since we're not treating these properly as overridable. But,
- + // this is dead code (mostly), and they weren't overridable before.
- + CacheKey key(msg->url_md5);
- Cache *call_cache = caches[c->frag_type];
- - Action *a = call_cache->open_read(c, &key, &c->ic_request, c->ic_params, c->frag_type, hostname, host_len);
- + Action *a = call_cache->open_read(c, &key, &c->ic_request, &c->http_config_params->oride, c->frag_type, hostname, host_len);
- // Get rid of purify warnings since 'c' can be freed by open_read.
- if (a != ACTION_RESULT_DONE) {
- c->cache_action = a;
- diff --git a/iocore/cluster/P_ClusterCacheInternal.h b/iocore/cluster/P_ClusterCacheInternal.h
- index 88975c3f6..9b6cce90e 100644
- --- a/iocore/cluster/P_ClusterCacheInternal.h
- +++ b/iocore/cluster/P_ClusterCacheInternal.h
- @@ -161,7 +161,7 @@ struct CacheContinuation : public Continuation {
- Arena ic_arena;
- CacheHTTPHdr ic_request;
- CacheHTTPHdr ic_response;
- - CacheLookupHttpConfig *ic_params;
- + HttpConfigParams *http_config_params;
- CacheHTTPInfo ic_old_info;
- CacheHTTPInfo ic_new_info;
- Ptr<IOBufferData> ic_hostname;
- @@ -250,11 +250,7 @@ struct CacheContinuation : public Continuation {
- if (cache_vc_info.valid()) {
- cache_vc_info.destroy();
- }
- - // Deallocate unmarshaled data
- - if (ic_params) {
- - delete ic_params;
- - ic_params = 0;
- - }
- +
- if (ic_request.valid()) {
- ic_request.clear();
- }
- @@ -267,6 +263,12 @@ struct CacheContinuation : public Continuation {
- if (ic_new_info.valid()) {
- ic_new_info.destroy();
- }
- +
- + if (http_config_params) {
- + HttpConfig::release(http_config_params);
- + http_config_params = 0;
- + }
- +
- ic_arena.reset();
- freeMsgBuffer();
- @@ -316,7 +318,7 @@ struct CacheContinuation : public Continuation {
- ic_arena(),
- ic_request(),
- ic_response(),
- - ic_params(0),
- + http_config_params(nullptr),
- ic_old_info(),
- ic_new_info(),
- ic_hostname_len(0),
- diff --git a/iocore/cluster/P_ClusterInline.h b/iocore/cluster/P_ClusterInline.h
- index 27230dd99..162056886 100644
- --- a/iocore/cluster/P_ClusterInline.h
- +++ b/iocore/cluster/P_ClusterInline.h
- @@ -60,10 +60,8 @@ Cluster_lookup(Continuation *cont, const CacheKey *key, CacheFragType frag_type,
- inline Action *
- Cluster_read(ClusterMachine *owner_machine, int opcode, Continuation *cont, MIOBuffer *buf, CacheHTTPHdr *request,
- - CacheLookupHttpConfig *params, const CacheKey *key, time_t pin_in_cache, CacheFragType frag_type, const char *hostname,
- - int hostlen)
- + const CacheKey *key, time_t pin_in_cache, CacheFragType frag_type, const char *hostname, int hostlen)
- {
- - (void)params;
- if (clusterProcessor.disable_remote_cluster_ops(owner_machine)) {
- Action a;
- a = cont;
- @@ -85,7 +83,6 @@ Cluster_read(ClusterMachine *owner_machine, int opcode, Continuation *cont, MIOB
- flen = op_to_sizeof_fixedlen_msg(opcode);
- len += request->m_heap->marshal_length();
- - len += params->marshal_length();
- len += hostlen;
- if ((flen + len) > DEFAULT_MAX_BUFFER_SIZE) // Bound marshalled data
- @@ -103,9 +100,6 @@ Cluster_read(ClusterMachine *owner_machine, int opcode, Continuation *cont, MIOB
- }
- data += res;
- cur_len -= res;
- - if ((res = params->marshal(data, cur_len)) < 0)
- - goto err_exit;
- - data += res;
- memcpy(data, hostname, hostlen);
- CacheOpArgs_General readArgs;
- diff --git a/lib/ts/apidefs.h.in b/lib/ts/apidefs.h.in
- index 14d305365..73ea3a4d1 100644
- --- a/lib/ts/apidefs.h.in
- +++ b/lib/ts/apidefs.h.in
- @@ -748,6 +748,14 @@ typedef enum {
- TS_CONFIG_SSL_CERT_FILENAME,
- TS_CONFIG_SSL_CERT_FILEPATH,
- TS_CONFIG_PARENT_FAILURES_UPDATE_HOSTDB,
- + TS_CONFIG_HTTP_CACHE_ENABLE_DEFAULT_VARY_HEADER,
- + TS_CONFIG_HTTP_CACHE_VARY_DEFAULT_TEXT,
- + TS_CONFIG_HTTP_CACHE_VARY_DEFAULT_IMAGES,
- + TS_CONFIG_HTTP_CACHE_VARY_DEFAULT_OTHER,
- + TS_CONFIG_HTTP_CACHE_IGNORE_ACCEPT_MISMATCH,
- + TS_CONFIG_HTTP_CACHE_IGNORE_ACCEPT_LANGUAGE_MISMATCH,
- + TS_CONFIG_HTTP_CACHE_IGNORE_ACCEPT_ENCODING_MISMATCH,
- + TS_CONFIG_HTTP_CACHE_IGNORE_ACCEPT_CHARSET_MISMATCH,
- 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 591a88a48..cd8b26f8b 100644
- --- a/plugins/experimental/ts_lua/ts_lua_http_config.c
- +++ b/plugins/experimental/ts_lua/ts_lua_http_config.c
- @@ -119,12 +119,20 @@ typedef enum {
- TS_LUA_CONFIG_HTTP_UNCACHEABLE_REQUESTS_BYPASS_PARENT = TS_CONFIG_HTTP_UNCACHEABLE_REQUESTS_BYPASS_PARENT,
- TS_LUA_CONFIG_HTTP_PARENT_PROXY_TOTAL_CONNECT_ATTEMPTS = TS_CONFIG_HTTP_PARENT_PROXY_TOTAL_CONNECT_ATTEMPTS,
- TS_LUA_CONFIG_HTTP_TRANSACTION_ACTIVE_TIMEOUT_IN = TS_CONFIG_HTTP_TRANSACTION_ACTIVE_TIMEOUT_IN,
- - TS_LUA_CONFIG_LAST_ENTRY = TS_CONFIG_LAST_ENTRY,
- TS_LUA_CONFIG_SRV_ENABLED = TS_CONFIG_SRV_ENABLED,
- TS_LUA_CONFIG_HTTP_FORWARD_CONNECT_METHOD = TS_CONFIG_HTTP_FORWARD_CONNECT_METHOD,
- TS_LUA_CONFIG_SSL_CERT_FILENAME = TS_CONFIG_SSL_CERT_FILENAME,
- TS_LUA_CONFIG_SSL_CERT_FILEPATH = TS_CONFIG_SSL_CERT_FILEPATH,
- TS_LUA_CONFIG_PARENT_FAILURES_UPDATE_HOSTDB = TS_CONFIG_PARENT_FAILURES_UPDATE_HOSTDB,
- + TS_LUA_CONFIG_HTTP_CACHE_ENABLE_DEFAULT_VARY_HEADER = TS_CONFIG_HTTP_CACHE_ENABLE_DEFAULT_VARY_HEADER,
- + TS_LUA_CONFIG_HTTP_CACHE_VARY_DEFAULT_TEXT = TS_CONFIG_HTTP_CACHE_VARY_DEFAULT_TEXT,
- + TS_LUA_CONFIG_HTTP_CACHE_VARY_DEFAULT_IMAGES = TS_CONFIG_HTTP_CACHE_VARY_DEFAULT_IMAGES,
- + TS_LUA_CONFIG_HTTP_CACHE_VARY_DEFAULT_OTHER = TS_CONFIG_HTTP_CACHE_VARY_DEFAULT_OTHER,
- + TS_LUA_CONFIG_HTTP_CACHE_IGNORE_ACCEPT_MISMATCH = TS_CONFIG_HTTP_CACHE_IGNORE_ACCEPT_MISMATCH,
- + TS_LUA_CONFIG_HTTP_CACHE_IGNORE_ACCEPT_LANGUAGE_MISMATCH = TS_CONFIG_HTTP_CACHE_IGNORE_ACCEPT_LANGUAGE_MISMATCH,
- + TS_LUA_CONFIG_HTTP_CACHE_IGNORE_ACCEPT_ENCODING_MISMATCH = TS_CONFIG_HTTP_CACHE_IGNORE_ACCEPT_ENCODING_MISMATCH,
- + TS_LUA_CONFIG_HTTP_CACHE_IGNORE_ACCEPT_CHARSET_MISMATCH = TS_CONFIG_HTTP_CACHE_IGNORE_ACCEPT_CHARSET_MISMATCH,
- + TS_LUA_CONFIG_LAST_ENTRY = TS_CONFIG_LAST_ENTRY,
- } TSLuaOverridableConfigKey;
- typedef enum {
- @@ -240,6 +248,14 @@ ts_lua_var_item ts_lua_http_config_vars[] = {
- TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_SSL_CERT_FILENAME),
- TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_SSL_CERT_FILEPATH),
- TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_PARENT_FAILURES_UPDATE_HOSTDB),
- + TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_CACHE_ENABLE_DEFAULT_VARY_HEADER),
- + TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_CACHE_VARY_DEFAULT_TEXT),
- + TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_CACHE_VARY_DEFAULT_IMAGES),
- + TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_CACHE_VARY_DEFAULT_OTHER),
- + TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_CACHE_IGNORE_ACCEPT_MISMATCH),
- + TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_CACHE_IGNORE_ACCEPT_LANGUAGE_MISMATCH),
- + TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_CACHE_IGNORE_ACCEPT_ENCODING_MISMATCH),
- + TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_CACHE_IGNORE_ACCEPT_CHARSET_MISMATCH),
- TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_LAST_ENTRY),
- };
- diff --git a/proxy/ICP.cc b/proxy/ICP.cc
- index 1a1b04ffb..287149567 100644
- --- a/proxy/ICP.cc
- +++ b/proxy/ICP.cc
- @@ -43,7 +43,6 @@
- #include "BaseManager.h"
- #include "HdrUtils.h"
- -extern CacheLookupHttpConfig global_cache_lookup_config;
- HTTPHdr gclient_request;
- //****************************************************************************
- @@ -312,11 +311,13 @@ ICPPeerReadCont::init(ICPProcessor *ICPpr, Peer *p, int lookup_local)
- _object_read = nullptr;
- _cache_req_hdr_heap_handle = nullptr;
- _cache_resp_hdr_heap_handle = nullptr;
- + _http_config_params = HttpConfig::acquire();
- mutex = new_ProxyMutex();
- }
- ICPPeerReadCont::~ICPPeerReadCont()
- {
- + HttpConfig::release(_http_config_params);
- reset(1); // Full reset
- }
- @@ -472,7 +473,9 @@ ICPPeerReadCont::ICPPeerQueryCont(int /* event ATS_UNUSED */, Event * /* e ATS_U
- // Note: _cache_lookup_local is ignored in this case, since
- // cache clustering is not used with stale lookup.
- //////////////////////////////////////////////////////////////
- - a = cacheProcessor.open_read(this, &key, false, &gclient_request, &global_cache_lookup_config, (time_t)0);
- +
- + // ToDo: This is maybe not 100% correct, since this is not using the txnp (but the global overridable copy)
- + a = cacheProcessor.open_read(this, &key, false, &gclient_request, &_http_config_params->oride, (time_t)0);
- } else {
- a = cacheProcessor.lookup(this, &key, false, _state->_cache_lookup_local);
- }
- diff --git a/proxy/ICP.h b/proxy/ICP.h
- index a7fe97862..530c24ada 100644
- --- a/proxy/ICP.h
- +++ b/proxy/ICP.h
- @@ -1166,6 +1166,8 @@ public:
- HTTPInfo *_object_read;
- HdrHeapSDKHandle *_cache_req_hdr_heap_handle;
- HdrHeapSDKHandle *_cache_resp_hdr_heap_handle;
- + // HTTP Config
- + HttpConfigParams *_http_config_params;
- private:
- // Class data
- diff --git a/proxy/InkAPI.cc b/proxy/InkAPI.cc
- index 0d157d5ba..7a176255f 100644
- --- a/proxy/InkAPI.cc
- +++ b/proxy/InkAPI.cc
- @@ -8110,6 +8110,30 @@ _conf_to_memberp(TSOverridableConfigKey conf, OverridableHttpConfigParams *overr
- case TS_CONFIG_PARENT_FAILURES_UPDATE_HOSTDB:
- ret = _memberp_to_generic(&overridableHttpConfig->parent_failures_update_hostdb, typep);
- break;
- + case TS_CONFIG_HTTP_CACHE_ENABLE_DEFAULT_VARY_HEADER:
- + ret = _memberp_to_generic(&overridableHttpConfig->cache_enable_default_vary_headers, typep);
- + break;
- + case TS_CONFIG_HTTP_CACHE_VARY_DEFAULT_TEXT:
- + ret = _memberp_to_generic(&overridableHttpConfig->cache_vary_default_text, typep);
- + break;
- + case TS_CONFIG_HTTP_CACHE_VARY_DEFAULT_IMAGES:
- + ret = _memberp_to_generic(&overridableHttpConfig->cache_vary_default_images, typep);
- + break;
- + case TS_CONFIG_HTTP_CACHE_VARY_DEFAULT_OTHER:
- + ret = _memberp_to_generic(&overridableHttpConfig->cache_vary_default_other, typep);
- + break;
- + case TS_CONFIG_HTTP_CACHE_IGNORE_ACCEPT_MISMATCH:
- + ret = _memberp_to_generic(&overridableHttpConfig->ignore_accept_mismatch, typep);
- + break;
- + case TS_CONFIG_HTTP_CACHE_IGNORE_ACCEPT_LANGUAGE_MISMATCH:
- + ret = _memberp_to_generic(&overridableHttpConfig->ignore_accept_language_mismatch, typep);
- + break;
- + case TS_CONFIG_HTTP_CACHE_IGNORE_ACCEPT_ENCODING_MISMATCH:
- + ret = _memberp_to_generic(&overridableHttpConfig->ignore_accept_encoding_mismatch, typep);
- + break;
- + case TS_CONFIG_HTTP_CACHE_IGNORE_ACCEPT_CHARSET_MISMATCH:
- + ret = _memberp_to_generic(&overridableHttpConfig->ignore_accept_charset_mismatch, typep);
- + break;
- // This helps avoiding compiler warnings, yet detect unhandled enum members.
- case TS_CONFIG_NULL:
- case TS_CONFIG_LAST_ENTRY:
- @@ -8545,6 +8569,12 @@ TSHttpTxnConfigFind(const char *name, int length, TSOverridableConfigKey *conf,
- cnf = TS_CONFIG_HTTP_FLOW_CONTROL_HIGH_WATER_MARK;
- }
- break;
- + case 't':
- + if (!strncmp(name, "proxy.config.http.cache.vary_default_text", length)) {
- + cnf = TS_CONFIG_HTTP_CACHE_VARY_DEFAULT_TEXT;
- + typ = TS_RECORDDATATYPE_STRING;
- + }
- + break;
- }
- break;
- @@ -8568,6 +8598,9 @@ TSHttpTxnConfigFind(const char *name, int length, TSOverridableConfigKey *conf,
- } else if (!strncmp(name, "proxy.config.http.global_user_agent_header", length)) {
- cnf = TS_CONFIG_HTTP_GLOBAL_USER_AGENT_HEADER;
- typ = TS_RECORDDATATYPE_STRING;
- + } else if (!strncmp(name, "proxy.config.http.cache.vary_default_other", length)) {
- + cnf = TS_CONFIG_HTTP_CACHE_VARY_DEFAULT_OTHER;
- + typ = TS_RECORDDATATYPE_STRING;
- }
- break;
- case 't':
- @@ -8607,6 +8640,12 @@ TSHttpTxnConfigFind(const char *name, int length, TSOverridableConfigKey *conf,
- cnf = TS_CONFIG_HTTP_CACHE_HEURISTIC_LM_FACTOR;
- }
- break;
- + case 's':
- + if (!strncmp(name, "proxy.config.http.cache.vary_default_images", length)) {
- + cnf = TS_CONFIG_HTTP_CACHE_VARY_DEFAULT_IMAGES;
- + typ = TS_RECORDDATATYPE_STRING;
- + }
- + break;
- }
- break;
- @@ -8679,6 +8718,18 @@ TSHttpTxnConfigFind(const char *name, int length, TSOverridableConfigKey *conf,
- cnf = TS_CONFIG_HTTP_ORIGIN_MAX_CONNECTIONS_QUEUE;
- }
- break;
- + case 'h':
- + if (0 == strncmp(name, "proxy.config.http.server_session_sharing.match", length)) {
- + cnf = TS_CONFIG_HTTP_SERVER_SESSION_SHARING_MATCH;
- + } else if (!strncmp(name, "proxy.config.http.cache.ignore_accept_mismatch", length)) {
- + cnf = TS_CONFIG_HTTP_CACHE_IGNORE_ACCEPT_MISMATCH;
- + }
- + break;
- + case 'n':
- + if (!strncmp(name, "proxy.config.http.cache.open_write_fail_action", length)) {
- + cnf = TS_CONFIG_HTTP_CACHE_OPEN_WRITE_FAIL_ACTION;
- + }
- + break;
- case 'r':
- if (!strncmp(name, "proxy.config.http.insert_squid_x_forwarded_for", length)) {
- cnf = TS_CONFIG_HTTP_INSERT_SQUID_X_FORWARDED_FOR;
- @@ -8696,16 +8747,6 @@ TSHttpTxnConfigFind(const char *name, int length, TSOverridableConfigKey *conf,
- cnf = TS_CONFIG_HTTP_FORWARD_PROXY_AUTH_TO_PARENT;
- }
- break;
- - case 'h':
- - if (0 == strncmp(name, "proxy.config.http.server_session_sharing.match", length)) {
- - cnf = TS_CONFIG_HTTP_SERVER_SESSION_SHARING_MATCH;
- - }
- - break;
- - case 'n':
- - if (!strncmp(name, "proxy.config.http.cache.open_write_fail_action", length)) {
- - cnf = TS_CONFIG_HTTP_CACHE_OPEN_WRITE_FAIL_ACTION;
- - }
- - break;
- }
- break;
- @@ -8791,6 +8832,11 @@ TSHttpTxnConfigFind(const char *name, int length, TSOverridableConfigKey *conf,
- cnf = TS_CONFIG_HTTP_POST_CHECK_CONTENT_LENGTH_ENABLED;
- }
- break;
- + case 's':
- + if (!strncmp(name, "proxy.config.http.cache.enable_default_vary_headers", length)) {
- + cnf = TS_CONFIG_HTTP_CACHE_ENABLE_DEFAULT_VARY_HEADER;
- + }
- + break;
- }
- break;
- @@ -8837,6 +8883,20 @@ TSHttpTxnConfigFind(const char *name, int length, TSOverridableConfigKey *conf,
- }
- break;
- + case 54:
- + if (!strncmp(name, "proxy.config.http.cache.ignore_accept_charset_mismatch", length)) {
- + cnf = TS_CONFIG_HTTP_CACHE_IGNORE_ACCEPT_CHARSET_MISMATCH;
- + }
- + break;
- +
- + case 55:
- + if (!strncmp(name, "proxy.config.http.cache.ignore_accept_language_mismatch", length)) {
- + cnf = TS_CONFIG_HTTP_CACHE_IGNORE_ACCEPT_LANGUAGE_MISMATCH;
- + } else if (!strncmp(name, "proxy.config.http.cache.ignore_accept_encoding_mismatch", length)) {
- + cnf = TS_CONFIG_HTTP_CACHE_IGNORE_ACCEPT_ENCODING_MISMATCH;
- + }
- + break;
- +
- case 58:
- if (!strncmp(name, "proxy.config.http.connect_attempts_max_retries_dead_server", length)) {
- cnf = TS_CONFIG_HTTP_CONNECT_ATTEMPTS_MAX_RETRIES_DEAD_SERVER;
- diff --git a/proxy/InkAPITest.cc b/proxy/InkAPITest.cc
- index 6721f0169..a47ea3e3c 100644
- --- a/proxy/InkAPITest.cc
- +++ b/proxy/InkAPITest.cc
- @@ -7623,6 +7623,14 @@ const char *SDK_Overridable_Configs[TS_CONFIG_LAST_ENTRY] = {
- "proxy.config.ssl.client.cert.filename",
- "proxy.config.ssl.client.cert.path",
- "proxy.config.http.parent_proxy.mark_down_hostdb",
- + "proxy.config.http.cache.enable_default_vary_headers",
- + "proxy.config.http.cache.vary_default_text",
- + "proxy.config.http.cache.vary_default_images",
- + "proxy.config.http.cache.vary_default_other",
- + "proxy.config.http.cache.ignore_accept_mismatch",
- + "proxy.config.http.cache.ignore_accept_language_mismatch",
- + "proxy.config.http.cache.ignore_accept_encoding_mismatch",
- + "proxy.config.http.cache.ignore_accept_charset_mismatch",
- };
- REGRESSION_TEST(SDK_API_OVERRIDABLE_CONFIGS)(RegressionTest *test, int /* atype ATS_UNUSED */, int *pstatus)
- diff --git a/proxy/Prefetch.cc b/proxy/Prefetch.cc
- index 399821615..966b2d933 100644
- --- a/proxy/Prefetch.cc
- +++ b/proxy/Prefetch.cc
- @@ -1446,12 +1446,8 @@ PrefetchBlaster::handleEvent(int event, void *data)
- // Here, we need to decide if we need to prefetch based on whether it
- // is in the cache or not.
- -
- - // if (cache_lookup_necessary) do:
- - initCacheLookupConfig();
- -
- Cache::generate_key(&key, request->url_get()); // XXX choose a cache generation number ...
- - cacheProcessor.open_read(this, &key, false, request, &cache_lookup_config, 0);
- + cacheProcessor.open_read(this, &key, false, request, &http_config_params->oride, 0);
- break;
- }
- @@ -1815,21 +1811,6 @@ PrefetchBlaster::invokeBlaster()
- return 0;
- }
- -void
- -PrefetchBlaster::initCacheLookupConfig()
- -{
- - // The look up parameters are intialized in the same as it is done
- - // in HttpSM::init(). Any changes there should come in here.
- - HttpConfigParams *http_config_params = HttpConfig::acquire();
- - cache_lookup_config.cache_global_user_agent_header = http_config_params->oride.global_user_agent_header ? true : false;
- - cache_lookup_config.cache_enable_default_vary_headers = http_config_params->cache_enable_default_vary_headers ? true : false;
- - cache_lookup_config.cache_vary_default_text = http_config_params->cache_vary_default_text;
- - cache_lookup_config.cache_vary_default_images = http_config_params->cache_vary_default_images;
- - cache_lookup_config.cache_vary_default_other = http_config_params->cache_vary_default_other;
- -
- - HttpConfig::release(http_config_params);
- -}
- -
- static int
- config_read_proto(TSPrefetchBlastData &blast, const char *str)
- {
- diff --git a/proxy/Prefetch.h b/proxy/Prefetch.h
- index 91d9b0698..ae5aa02a0 100644
- --- a/proxy/Prefetch.h
- +++ b/proxy/Prefetch.h
- @@ -303,8 +303,12 @@ public:
- serverVC(0),
- n_pkts_sent(0),
- seq_no(0),
- - io_block(0){};
- - ~PrefetchBlaster(){};
- + io_block(0)
- + {
- + http_config_params = HttpConfig::acquire();
- + };
- +
- + ~PrefetchBlaster() { HttpConfig::release(http_config_params); };
- int init(PrefetchUrlEntry *entry, HTTPHdr *request, PrefetchTransform *p_trans);
- @@ -314,7 +318,6 @@ public:
- int httpClient(int event, void *data);
- int invokeBlaster();
- - void initCacheLookupConfig();
- void handleCookieHeaders(HTTPHdr *req_hdr, HTTPHdr *resp_hdr, const char *domain_start, const char *domain_end,
- const char *host_start, int host_len, bool no_dot);
- @@ -334,8 +337,7 @@ public:
- VConnection *serverVC;
- TSPrefetchBlastData data_blast;
- -
- - CacheLookupHttpConfig cache_lookup_config;
- + HttpConfigParams *http_config_params;
- // udp related:
- uint32_t n_pkts_sent;
- diff --git a/proxy/http/HttpCacheSM.cc b/proxy/http/HttpCacheSM.cc
- index 7ad75a526..74cdfca74 100644
- --- a/proxy/http/HttpCacheSM.cc
- +++ b/proxy/http/HttpCacheSM.cc
- @@ -75,7 +75,7 @@ HttpCacheSM::HttpCacheSM()
- open_write_cb(false),
- open_read_tries(0),
- read_request_hdr(nullptr),
- - read_config(nullptr),
- + http_params(nullptr),
- read_pin_in_cache(0),
- retry_write(true),
- open_write_tries(0),
- @@ -251,7 +251,7 @@ HttpCacheSM::do_cache_open_read(const HttpCacheKey &key)
- // Initialising read-while-write-inprogress flag
- this->readwhilewrite_inprogress = false;
- Action *action_handle = cacheProcessor.open_read(this, &key, master_sm->t_state.cache_control.cluster_cache_local,
- - this->read_request_hdr, this->read_config, this->read_pin_in_cache);
- + this->read_request_hdr, this->http_params, this->read_pin_in_cache);
- if (action_handle != ACTION_RESULT_DONE) {
- pending_action = action_handle;
- @@ -269,14 +269,14 @@ HttpCacheSM::do_cache_open_read(const HttpCacheKey &key)
- }
- Action *
- -HttpCacheSM::open_read(const HttpCacheKey *key, URL *url, HTTPHdr *hdr, CacheLookupHttpConfig *params, time_t pin_in_cache)
- +HttpCacheSM::open_read(const HttpCacheKey *key, URL *url, HTTPHdr *hdr, OverridableHttpConfigParams *params, time_t pin_in_cache)
- {
- Action *act_return;
- cache_key = *key;
- lookup_url = url;
- read_request_hdr = hdr;
- - read_config = params;
- + http_params = params;
- read_pin_in_cache = pin_in_cache;
- ink_assert(pending_action == nullptr);
- SET_HANDLER(&HttpCacheSM::state_cache_open_read);
- diff --git a/proxy/http/HttpCacheSM.h b/proxy/http/HttpCacheSM.h
- index cf2702c0a..4037d7848 100644
- --- a/proxy/http/HttpCacheSM.h
- +++ b/proxy/http/HttpCacheSM.h
- @@ -41,7 +41,6 @@
- class HttpSM;
- class HttpCacheSM;
- -class CacheLookupHttpConfig;
- struct HttpCacheAction : public Action {
- HttpCacheAction();
- @@ -67,7 +66,7 @@ public:
- captive_action.init(this);
- }
- - Action *open_read(const HttpCacheKey *key, URL *url, HTTPHdr *hdr, CacheLookupHttpConfig *params, time_t pin_in_cache);
- + Action *open_read(const HttpCacheKey *key, URL *url, HTTPHdr *hdr, OverridableHttpConfigParams *params, time_t pin_in_cache);
- Action *open_write(const HttpCacheKey *key, URL *url, HTTPHdr *request, CacheHTTPInfo *old_info, time_t pin_in_cache, bool retry,
- bool allow_multiple);
- @@ -198,7 +197,7 @@ private:
- // Open read parameters
- int open_read_tries;
- HTTPHdr *read_request_hdr;
- - CacheLookupHttpConfig *read_config;
- + OverridableHttpConfigParams *http_params;
- time_t read_pin_in_cache;
- // Open write parameters
- diff --git a/proxy/http/HttpConfig.cc b/proxy/http/HttpConfig.cc
- index a452d199e..60fa3fc42 100644
- --- a/proxy/http/HttpConfig.cc
- +++ b/proxy/http/HttpConfig.cc
- @@ -1021,9 +1021,9 @@ HttpConfig::startup()
- HttpEstablishStaticConfigLongLong(c.oride.freshness_fuzz_min_time, "proxy.config.http.cache.fuzz.min_time");
- HttpEstablishStaticConfigFloat(c.oride.freshness_fuzz_prob, "proxy.config.http.cache.fuzz.probability");
- - HttpEstablishStaticConfigStringAlloc(c.cache_vary_default_text, "proxy.config.http.cache.vary_default_text");
- - HttpEstablishStaticConfigStringAlloc(c.cache_vary_default_images, "proxy.config.http.cache.vary_default_images");
- - HttpEstablishStaticConfigStringAlloc(c.cache_vary_default_other, "proxy.config.http.cache.vary_default_other");
- + HttpEstablishStaticConfigStringAlloc(c.oride.cache_vary_default_text, "proxy.config.http.cache.vary_default_text");
- + HttpEstablishStaticConfigStringAlloc(c.oride.cache_vary_default_images, "proxy.config.http.cache.vary_default_images");
- + HttpEstablishStaticConfigStringAlloc(c.oride.cache_vary_default_other, "proxy.config.http.cache.vary_default_other");
- // open read failure retries
- HttpEstablishStaticConfigLongLong(c.oride.max_cache_open_read_retries, "proxy.config.http.cache.max_open_read_retries");
- @@ -1043,13 +1043,13 @@ HttpConfig::startup()
- HttpEstablishStaticConfigByte(c.oride.cache_ignore_auth, "proxy.config.http.cache.ignore_authentication");
- HttpEstablishStaticConfigByte(c.oride.cache_urls_that_look_dynamic, "proxy.config.http.cache.cache_urls_that_look_dynamic");
- - HttpEstablishStaticConfigByte(c.cache_enable_default_vary_headers, "proxy.config.http.cache.enable_default_vary_headers");
- + HttpEstablishStaticConfigByte(c.oride.cache_enable_default_vary_headers, "proxy.config.http.cache.enable_default_vary_headers");
- HttpEstablishStaticConfigByte(c.cache_post_method, "proxy.config.http.cache.post_method");
- - HttpEstablishStaticConfigByte(c.ignore_accept_mismatch, "proxy.config.http.cache.ignore_accept_mismatch");
- - HttpEstablishStaticConfigByte(c.ignore_accept_language_mismatch, "proxy.config.http.cache.ignore_accept_language_mismatch");
- - HttpEstablishStaticConfigByte(c.ignore_accept_encoding_mismatch, "proxy.config.http.cache.ignore_accept_encoding_mismatch");
- - HttpEstablishStaticConfigByte(c.ignore_accept_charset_mismatch, "proxy.config.http.cache.ignore_accept_charset_mismatch");
- + HttpEstablishStaticConfigByte(c.oride.ignore_accept_mismatch, "proxy.config.http.cache.ignore_accept_mismatch");
- + HttpEstablishStaticConfigByte(c.oride.ignore_accept_language_mismatch, "proxy.config.http.cache.ignore_accept_language_mismatch");
- + HttpEstablishStaticConfigByte(c.oride.ignore_accept_encoding_mismatch, "proxy.config.http.cache.ignore_accept_encoding_mismatch");
- + HttpEstablishStaticConfigByte(c.oride.ignore_accept_charset_mismatch, "proxy.config.http.cache.ignore_accept_charset_mismatch");
- HttpEstablishStaticConfigByte(c.send_100_continue_response, "proxy.config.http.send_100_continue_response");
- HttpEstablishStaticConfigByte(c.disallow_post_100_continue, "proxy.config.http.disallow_post_100_continue");
- @@ -1309,9 +1309,9 @@ HttpConfig::reconfigure()
- params->oride.freshness_fuzz_min_time = m_master.oride.freshness_fuzz_min_time;
- params->oride.freshness_fuzz_prob = m_master.oride.freshness_fuzz_prob;
- - params->cache_vary_default_text = ats_strdup(m_master.cache_vary_default_text);
- - params->cache_vary_default_images = ats_strdup(m_master.cache_vary_default_images);
- - params->cache_vary_default_other = ats_strdup(m_master.cache_vary_default_other);
- + params->oride.cache_vary_default_text = ats_strdup(m_master.oride.cache_vary_default_text);
- + params->oride.cache_vary_default_images = ats_strdup(m_master.oride.cache_vary_default_images);
- + params->oride.cache_vary_default_other = ats_strdup(m_master.oride.cache_vary_default_other);
- params->oride.srv_enabled = m_master.oride.srv_enabled;
- @@ -1323,22 +1323,22 @@ HttpConfig::reconfigure()
- // open write failure retries
- params->oride.max_cache_open_write_retries = m_master.oride.max_cache_open_write_retries;
- - params->oride.cache_http = INT_TO_BOOL(m_master.oride.cache_http);
- - params->oride.cache_cluster_cache_local = INT_TO_BOOL(m_master.oride.cache_cluster_cache_local);
- - 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->oride.cache_responses_to_cookies = m_master.oride.cache_responses_to_cookies;
- - params->oride.cache_ignore_auth = INT_TO_BOOL(m_master.oride.cache_ignore_auth);
- - params->oride.cache_urls_that_look_dynamic = INT_TO_BOOL(m_master.oride.cache_urls_that_look_dynamic);
- - params->cache_enable_default_vary_headers = INT_TO_BOOL(m_master.cache_enable_default_vary_headers);
- - params->cache_post_method = INT_TO_BOOL(m_master.cache_post_method);
- -
- - params->ignore_accept_mismatch = m_master.ignore_accept_mismatch;
- - params->ignore_accept_language_mismatch = m_master.ignore_accept_language_mismatch;
- - params->ignore_accept_encoding_mismatch = m_master.ignore_accept_encoding_mismatch;
- - params->ignore_accept_charset_mismatch = m_master.ignore_accept_charset_mismatch;
- + params->oride.cache_http = INT_TO_BOOL(m_master.oride.cache_http);
- + params->oride.cache_cluster_cache_local = INT_TO_BOOL(m_master.oride.cache_cluster_cache_local);
- + 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->oride.cache_responses_to_cookies = m_master.oride.cache_responses_to_cookies;
- + params->oride.cache_ignore_auth = INT_TO_BOOL(m_master.oride.cache_ignore_auth);
- + params->oride.cache_urls_that_look_dynamic = INT_TO_BOOL(m_master.oride.cache_urls_that_look_dynamic);
- + params->oride.cache_enable_default_vary_headers = INT_TO_BOOL(m_master.oride.cache_enable_default_vary_headers);
- + params->cache_post_method = INT_TO_BOOL(m_master.cache_post_method);
- +
- + params->oride.ignore_accept_mismatch = m_master.oride.ignore_accept_mismatch;
- + params->oride.ignore_accept_language_mismatch = m_master.oride.ignore_accept_language_mismatch;
- + params->oride.ignore_accept_encoding_mismatch = m_master.oride.ignore_accept_encoding_mismatch;
- + params->oride.ignore_accept_charset_mismatch = m_master.oride.ignore_accept_charset_mismatch;
- params->send_100_continue_response = INT_TO_BOOL(m_master.send_100_continue_response);
- params->disallow_post_100_continue = INT_TO_BOOL(m_master.disallow_post_100_continue);
- diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
- index 6ad2c9689..96077b65c 100644
- --- a/proxy/http/HttpSM.cc
- +++ b/proxy/http/HttpSM.cc
- @@ -394,20 +394,6 @@ HttpSM::init()
- // entire struct if nothing is going to change it.
- t_state.txn_conf = &t_state.http_config_param->oride;
- - // 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.txn_conf->global_user_agent_header ? true : false;
- - t_state.cache_info.config.ignore_accept_mismatch = t_state.http_config_param->ignore_accept_mismatch;
- - t_state.cache_info.config.ignore_accept_language_mismatch = t_state.http_config_param->ignore_accept_language_mismatch;
- - t_state.cache_info.config.ignore_accept_encoding_mismatch = t_state.http_config_param->ignore_accept_encoding_mismatch;
- - t_state.cache_info.config.ignore_accept_charset_mismatch = t_state.http_config_param->ignore_accept_charset_mismatch;
- - 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;
- -
- t_state.init();
- // Added to skip dns if the document is in cache. DNS will be forced if there is a ip based ACL in
- @@ -4580,7 +4566,7 @@ HttpSM::do_cache_lookup_and_read()
- Cache::generate_key(&key, c_url, t_state.txn_conf->cache_generation_number);
- Action *cache_action_handle =
- - cache_sm.open_read(&key, c_url, &t_state.hdr_info.client_request, &(t_state.cache_info.config),
- + cache_sm.open_read(&key, c_url, &t_state.hdr_info.client_request, t_state.txn_conf,
- (time_t)((t_state.cache_control.pin_in_cache_for < 0) ? 0 : t_state.cache_control.pin_in_cache_for));
- //
- // pin_in_cache value is an open_write parameter.
- diff --git a/proxy/http/HttpTransact.h b/proxy/http/HttpTransact.h
- index 6d451dd0d..1d47619a1 100644
- --- a/proxy/http/HttpTransact.h
- +++ b/proxy/http/HttpTransact.h
- @@ -598,7 +598,6 @@ public:
- HTTPInfo *second_object_read;
- HTTPInfo object_store;
- HTTPInfo transform_store;
- - CacheLookupHttpConfig config;
- CacheDirectives directives;
- int open_read_retries;
- int open_write_retries;
- @@ -620,7 +619,6 @@ public:
- second_object_read(NULL),
- object_store(),
- transform_store(),
- - config(),
- directives(),
- open_read_retries(0),
- open_write_retries(0),
- diff --git a/proxy/http/HttpTransactCache.cc b/proxy/http/HttpTransactCache.cc
- index c6a801c7a..be47b7889 100644
- --- a/proxy/http/HttpTransactCache.cc
- +++ b/proxy/http/HttpTransactCache.cc
- @@ -31,10 +31,6 @@
- #include "HttpCompat.h"
- #include "ts/InkErrno.h"
- -ClassAllocator<CacheLookupHttpConfig> CacheLookupHttpConfigAllocator("CacheLookupHttpConfigAllocator");
- -
- -CacheLookupHttpConfig global_cache_lookup_config;
- -
- /**
- Find the pointer and length of an etag, after stripping off any leading
- "W/" prefix, and surrounding double quotes.
- @@ -168,7 +164,7 @@ is_empty(char *s)
- */
- int
- HttpTransactCache::SelectFromAlternates(CacheHTTPInfoVector *cache_vector, HTTPHdr *client_request,
- - CacheLookupHttpConfig *http_config_params)
- + OverridableHttpConfigParams *http_config_params)
- {
- time_t current_age, best_age = CacheHighAgeWatermark;
- time_t t_now = 0;
- @@ -188,10 +184,9 @@ HttpTransactCache::SelectFromAlternates(CacheHTTPInfoVector *cache_vector, HTTPH
- fprintf(stderr, "[alts] There are %d alternates for this request header.\n", alt_count);
- RELEASE_PRINT_LOCK()
- }
- - // used by ICP to bypass this function
- - if (http_config_params == &global_cache_lookup_config) {
- - return 0;
- - }
- +
- + // ToDo: Need a way to detect if it's ICP here or not, and then "return 0;". That's what the old
- + // code did, in a very convoluted way ...
- if (!client_request->valid()) {
- return 0;
- @@ -299,7 +294,7 @@ HttpTransactCache::SelectFromAlternates(CacheHTTPInfoVector *cache_vector, HTTPH
- */
- float
- -HttpTransactCache::calculate_quality_of_match(CacheLookupHttpConfig *http_config_param, HTTPHdr *client_request,
- +HttpTransactCache::calculate_quality_of_match(OverridableHttpConfigParams *http_config_param, HTTPHdr *client_request,
- HTTPHdr *obj_client_request, HTTPHdr *obj_origin_server_response)
- {
- // For PURGE requests, any alternate is good really.
- @@ -1144,8 +1139,8 @@ language_wildcard:
- */
- Variability_t
- -HttpTransactCache::CalcVariability(CacheLookupHttpConfig *http_config_params, HTTPHdr *client_request, HTTPHdr *obj_client_request,
- - HTTPHdr *obj_origin_server_response)
- +HttpTransactCache::CalcVariability(OverridableHttpConfigParams *http_config_params, HTTPHdr *client_request,
- + HTTPHdr *obj_client_request, HTTPHdr *obj_origin_server_response)
- {
- ink_assert(http_config_params != nullptr);
- ink_assert(client_request != nullptr);
- @@ -1223,7 +1218,7 @@ HttpTransactCache::CalcVariability(CacheLookupHttpConfig *http_config_params, HT
- // Special case: if 'proxy.config.http.global_user_agent_header' set //
- // we should ignore Vary: User-Agent. //
- ////////////////////////////////////////////////////////////////////////////////////////
- - if (http_config_params->cache_global_user_agent_header && !strcasecmp((char *)field->str, "User-Agent")) {
- + if (http_config_params->global_user_agent_header && !strcasecmp((char *)field->str, "User-Agent")) {
- continue;
- }
- @@ -1467,95 +1462,3 @@ HttpTransactCache::match_response_to_request_conditionals(HTTPHdr *request, HTTP
- return response->status_get();
- }
- -
- -/*---------------------------------------------------
- - * class CacheLookupHttpConfig
- - *---------------------------------------------------*/
- -int
- -CacheLookupHttpConfig::marshal_length()
- -{
- - int len = (int)sizeof(int32_t);
- - len += (cache_vary_default_text ? strlen(cache_vary_default_text) + 1 : 1);
- - len += (cache_vary_default_images ? strlen(cache_vary_default_images) + 1 : 1);
- - len += (cache_vary_default_other ? strlen(cache_vary_default_other) + 1 : 1);
- - return len;
- -}
- -
- -int
- -CacheLookupHttpConfig::marshal(char *buf, int length)
- -{
- - int32_t i32_tmp;
- - char *p = buf;
- - int len;
- -
- - if ((length -= sizeof(int32_t)) < 0) {
- - return -1;
- - }
- -
- - i32_tmp = (int32_t)cache_enable_default_vary_headers;
- - memcpy(p, &i32_tmp, sizeof(int32_t));
- - p += sizeof(int32_t);
- -
- - len = (cache_vary_default_text ? strlen(cache_vary_default_text) + 1 : 1);
- - if ((length -= len) < 0) {
- - return -1;
- - }
- - ink_strlcpy(p, (cache_vary_default_text ? cache_vary_default_text : ""), length);
- - p += len;
- -
- - len = (cache_vary_default_images ? strlen(cache_vary_default_images) + 1 : 1);
- - if ((length -= len) < 0) {
- - return -1;
- - }
- - ink_strlcpy(p, (cache_vary_default_images ? cache_vary_default_images : ""), length);
- - p += len;
- -
- - len = (cache_vary_default_other ? strlen(cache_vary_default_other) + 1 : 1);
- - if ((length -= len) < 0) {
- - return -1;
- - }
- - ink_strlcpy(p, (cache_vary_default_other ? cache_vary_default_other : ""), length);
- - p += len;
- -
- - return (p - buf);
- -}
- -
- -int
- -CacheLookupHttpConfig::unmarshal(Arena *arena, const char *buf, int buflen)
- -{
- - const char *p = buf;
- - int length = buflen;
- - int len;
- - int32_t i32_tmp;
- -
- - if ((length -= sizeof(int32_t)) < 0) {
- - return -1;
- - }
- -
- - memcpy(&i32_tmp, p, sizeof(int32_t));
- - cache_enable_default_vary_headers = (bool)i32_tmp;
- - p += sizeof(int32_t);
- -
- - len = strlen(p) + 1;
- - if ((length -= len) < 0) {
- - return -1;
- - }
- - cache_vary_default_text = arena->str_store(((len == 2) ? "" : p), len - 1);
- - p += len;
- -
- - len = strlen(p) + 1;
- - if ((length -= len) < 0) {
- - return -1;
- - }
- - cache_vary_default_images = arena->str_store(((len == 2) ? "" : p), len - 1);
- - p += len;
- -
- - len = strlen(p) + 1;
- - if ((length -= len) < 0) {
- - return -1;
- - }
- - cache_vary_default_other = arena->str_store(((len == 2) ? "" : p), len - 1);
- - p += len;
- -
- - return (p - buf);
- -}
- diff --git a/proxy/http/HttpTransactCache.h b/proxy/http/HttpTransactCache.h
- index 974a8874d..b3e7cb29e 100644
- --- a/proxy/http/HttpTransactCache.h
- +++ b/proxy/http/HttpTransactCache.h
- @@ -32,64 +32,13 @@
- #define _HttpTransactCache_h_
- #include "ts/ink_platform.h"
- +#include "HttpConfig.h"
- // This is needed since txn_conf->cache_guaranteed_max_lifetime is currently not
- // readily available in the cache. ToDo: We should fix this with TS-1919
- static const time_t CacheHighAgeWatermark = UINT_MAX;
- -
- struct CacheHTTPInfoVector;
- -class CacheLookupHttpConfig
- -{
- -public:
- - bool cache_global_user_agent_header; // 'global' user agent flag (don't need to marshal/unmarshal)
- - bool cache_enable_default_vary_headers;
- - unsigned ignore_accept_mismatch;
- - unsigned ignore_accept_language_mismatch;
- - unsigned ignore_accept_encoding_mismatch;
- - unsigned ignore_accept_charset_mismatch;
- - char *cache_vary_default_text;
- - char *cache_vary_default_images;
- - char *cache_vary_default_other;
- -
- - inkcoreapi int marshal_length();
- - inkcoreapi int marshal(char *buf, int length);
- - int unmarshal(Arena *arena, const char *buf, int length);
- -
- - CacheLookupHttpConfig()
- - : cache_global_user_agent_header(false),
- - cache_enable_default_vary_headers(false),
- - ignore_accept_mismatch(0),
- - ignore_accept_language_mismatch(0),
- - ignore_accept_encoding_mismatch(0),
- - ignore_accept_charset_mismatch(0),
- - cache_vary_default_text(NULL),
- - cache_vary_default_images(NULL),
- - cache_vary_default_other(NULL)
- - {
- - }
- -
- - void *operator new(size_t size, void *mem);
- - void operator delete(void *mem);
- -};
- -
- -extern ClassAllocator<CacheLookupHttpConfig> CacheLookupHttpConfigAllocator;
- -// this is a global CacheLookupHttpConfig used to bypass SelectFromAlternates
- -extern CacheLookupHttpConfig global_cache_lookup_config;
- -
- -inline void *
- -CacheLookupHttpConfig::operator new(size_t size, void *mem)
- -{
- - (void)size;
- - return mem;
- -}
- -
- -inline void
- -CacheLookupHttpConfig::operator delete(void *mem)
- -{
- - CacheLookupHttpConfigAllocator.free((CacheLookupHttpConfig *)mem);
- -}
- -
- enum Variability_t {
- VARIABILITY_NONE = 0,
- VARIABILITY_SOME,
- @@ -109,11 +58,10 @@ public:
- /////////////////////////////////
- static int SelectFromAlternates(CacheHTTPInfoVector *cache_vector_data, HTTPHdr *client_request,
- - CacheLookupHttpConfig *cache_lookup_http_config_params);
- + OverridableHttpConfigParams *cache_lookup_http_config_params);
- - static float calculate_quality_of_match(CacheLookupHttpConfig *http_config_params, HTTPHdr *client_request, // in
- - HTTPHdr *obj_client_request, // in
- - HTTPHdr *obj_origin_server_response); // in
- + static float calculate_quality_of_match(OverridableHttpConfigParams *http_config_params, HTTPHdr *client_request,
- + HTTPHdr *obj_client_request, HTTPHdr *obj_origin_server_response);
- static float calculate_quality_of_accept_match(MIMEField *accept_field, MIMEField *content_field);
- @@ -131,10 +79,8 @@ public:
- // variability & server negotiation routines //
- ///////////////////////////////////////////////
- - static Variability_t CalcVariability(CacheLookupHttpConfig *http_config_params, HTTPHdr *client_request, // in
- - HTTPHdr *obj_client_request, // in
- - HTTPHdr *obj_origin_server_response // in
- - );
- + static Variability_t CalcVariability(OverridableHttpConfigParams *http_config_params, HTTPHdr *client_request,
- + HTTPHdr *obj_client_request, HTTPHdr *obj_origin_server_response);
- static HTTPStatus match_response_to_request_conditionals(HTTPHdr *ua_request, HTTPHdr *c_response,
- ink_time_t response_received_time);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement