Repository: trafficserver Updated Branches: refs/heads/master 428c3d581 -> c0fba0a6c
TS-2029 Eliminate CacheHttpHdr argument from Cache::generate_key() Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/c0fba0a6 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/c0fba0a6 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/c0fba0a6 Branch: refs/heads/master Commit: c0fba0a6c1b86f173b0e48d0f41713ae4906422c Parents: 428c3d5 Author: Leif Hedstrom <[email protected]> Authored: Mon May 19 10:05:34 2014 -0600 Committer: Leif Hedstrom <[email protected]> Committed: Tue May 20 11:36:29 2014 -0600 ---------------------------------------------------------------------- CHANGES | 2 ++ iocore/cache/Cache.cc | 4 ++-- iocore/cache/P_CacheInternal.h | 45 +++-------------------------------- iocore/cluster/P_ClusterInline.h | 2 +- proxy/Update.cc | 12 ++++------ 5 files changed, 13 insertions(+), 52 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c0fba0a6/CHANGES ---------------------------------------------------------------------- diff --git a/CHANGES b/CHANGES index 7c9bfc5..81a0cdb 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,8 @@ -*- coding: utf-8 -*- Changes with Apache Traffic Server 5.0.0 + *) [TS-2029] Eliminate CacheHttpHdr argument from Cache::generate_key(). + *) [TS-2821] Added configuration for max concurrent streams for SPDY. *) [TS-2558] Remove check for inbound transparency vs. SSL. http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c0fba0a6/iocore/cache/Cache.cc ---------------------------------------------------------------------- diff --git a/iocore/cache/Cache.cc b/iocore/cache/Cache.cc index a8013c0..e5ae121 100644 --- a/iocore/cache/Cache.cc +++ b/iocore/cache/Cache.cc @@ -3449,13 +3449,13 @@ CacheProcessor::open_write(Continuation *cont, int expected_size, URL *url, bool #ifdef CLUSTER_CACHE if (cache_clustering_enabled > 0 && !cluster_cache_local) { INK_MD5 url_md5; - Cache::generate_key(&url_md5, url, request); + Cache::generate_key(&url_md5, url); ClusterMachine *m = cluster_machine_at_depth(cache_hash(url_md5)); if (m) { // Do remote open_write() INK_MD5 url_only_md5; - Cache::generate_key(&url_only_md5, url, 0); + Cache::generate_key(&url_only_md5, url); return Cluster_write(cont, expected_size, (MIOBuffer *) 0, m, &url_only_md5, type, false, pin_in_cache, CACHE_OPEN_WRITE_LONG, http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c0fba0a6/iocore/cache/P_CacheInternal.h ---------------------------------------------------------------------- diff --git a/iocore/cache/P_CacheInternal.h b/iocore/cache/P_CacheInternal.h index f9a5845..3b8987e 100644 --- a/iocore/cache/P_CacheInternal.h +++ b/iocore/cache/P_CacheInternal.h @@ -1045,7 +1045,7 @@ struct Cache Action *open_write(Continuation *cont, URL *url, CacheHTTPHdr *request, CacheHTTPInfo *old_info, time_t pin_in_cache = (time_t) 0, CacheFragType type = CACHE_FRAG_TYPE_HTTP); - static void generate_key(INK_MD5 *md5, URL *url, CacheHTTPHdr *request); + static void generate_key(INK_MD5 *md5, URL *url); #endif Action *link(Continuation *cont, CacheKey *from, CacheKey *to, CacheFragType type, char *hostname, int host_len); @@ -1080,47 +1080,8 @@ Cache::open_read(Continuation *cont, CacheURL *url, CacheHTTPHdr *request, } TS_INLINE void -Cache::generate_key(INK_MD5 *md5, URL *url, CacheHTTPHdr */* request ATS_UNUSED */) +Cache::generate_key(INK_MD5 *md5, URL *url) { -#ifdef BROKEN_HACK_FOR_VARY_ON_UA - // We probably should make this configurable, both enabling it and what - // MIME types we want to treat differently. // Leif - - if (cache_config_vary_on_user_agent && request) { - // If we are varying on user-agent, we only want to do - // this for text content-types since expirence says - // images do not vary. Varying on images decimiates - // the hitrate (INKqa04820) - - // HDR FIX ME - mimeTable needs to be updated to support - // ptr/len pairs - - // Note: if 'proxy.config.http.global_user_agent_header' is set, we - // should ignore 'cache_config_vary_on_user_agent' flag because - // all requests to OS were sent with one so-called 'global user agent' - // header instead of original client's 'user-agent' - - MimeTableEntry *url_mime_type_entry = -// mimeTable.get_entry_path(url->path_get()); - NULL; - - if (url_mime_type_entry && strstr(url_mime_type_entry->mime_type, "text")) { - url->MD5_get(md5); - int ua_len; - const char *value = request->value_get(MIME_FIELD_USER_AGENT, - MIME_LEN_USER_AGENT, &ua_len); - if (value) { - INK_DIGEST_CTX context; - // Mix the user-agent and URL INK_MD5's - ink_code_incr_md5_init(&context); - ink_code_incr_md5_update(&context, value, ua_len); - ink_code_incr_md5_update(&context, (char *) md5, sizeof(INK_MD5)); - ink_code_incr_md5_final((char *) md5, &context); - } - return; - } - } -#endif /* BROKEN_HACK_FOR_VARY_ON_UA */ url->MD5_get(md5); } @@ -1318,7 +1279,7 @@ CacheProcessor::open_read_internal(int opcode, { INK_MD5 url_md5; if ((opcode == CACHE_OPEN_READ_LONG) || (opcode == CACHE_OPEN_READ_BUFFER_LONG)) { - Cache::generate_key(&url_md5, url, request); + Cache::generate_key(&url_md5, url); } else { url_md5 = *key; } http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c0fba0a6/iocore/cluster/P_ClusterInline.h ---------------------------------------------------------------------- diff --git a/iocore/cluster/P_ClusterInline.h b/iocore/cluster/P_ClusterInline.h index 965b79f..b4c1f15 100644 --- a/iocore/cluster/P_ClusterInline.h +++ b/iocore/cluster/P_ClusterInline.h @@ -88,7 +88,7 @@ Cluster_read(ClusterMachine * owner_machine, int opcode, int url_hlen; INK_MD5 url_only_md5; - Cache::generate_key(&url_only_md5, url, 0); + Cache::generate_key(&url_only_md5, url); url_hostname = url->host_get(&url_hlen); len += request->m_heap->marshal_length(); http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c0fba0a6/proxy/Update.cc ---------------------------------------------------------------------- diff --git a/proxy/Update.cc b/proxy/Update.cc index cabfe62..c8c16cd 100644 --- a/proxy/Update.cc +++ b/proxy/Update.cc @@ -1427,8 +1427,8 @@ UpdateSM::HandleSMEvent(int event, Event * /* e ATS_UNUSED */) } INK_MD5 url_md5; - Cache::generate_key(&url_md5, &_EN->_URLhandle, (_EN->_num_request_headers ? _EN->_http_hdr : NULL)); - Cache::generate_key(&url_md5, &_EN->_URLhandle, _EN->_http_hdr); + + Cache::generate_key(&url_md5, &_EN->_URLhandle); ClusterMachine *m = cluster_machine_at_depth(cache_hash(url_md5)); if (m) { // URL hashed to remote node, do nothing. @@ -1672,11 +1672,9 @@ RecursiveHttpGet::RecursiveHttpGetEvent(int event, Event * d) ue = NULL; continue; } - // I think we're generating the cache key just to get - // a hash of the URL. Used to use Cache::generate_key - // that no longer works with vary_on_user_agent - // isn't turned on -// Cache::generate_key(&ue->_url_md5, &ue->_URLhandle, _http_hdr); + // I think we're generating the cache key just to get a hash of the URL. + // Used to use Cache::generate_key that no longer works with vary_on_user_agent + // isn't turned on. ToDo. ue->_URLhandle.MD5_get(&ue->_url_md5); if (_CL->HashAdd(ue)) {
