trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zw...@apache.org
Subject git commit: TS-1919 Backing this change out, since it's been -1'd.
Date Fri, 03 Jan 2014 17:36:39 GMT
Updated Branches:
  refs/heads/5.0.x a44a12ab3 -> db67432fc


TS-1919 Backing this change out, since it's been -1'd.

git revert did not handle this nicely, since the trees have
diverged so much. Instead, I simply made 5.0.x identical to
current "master".


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

Branch: refs/heads/5.0.x
Commit: db67432fce4bc324856c17038269f327a9128efa
Parents: a44a12a
Author: Leif Hedstrom <zwoop@apache.org>
Authored: Fri Jan 3 10:34:36 2014 -0700
Committer: Leif Hedstrom <zwoop@apache.org>
Committed: Fri Jan 3 10:34:36 2014 -0700

----------------------------------------------------------------------
 CHANGES                                 |   7 +-
 iocore/cache/Cache.cc                   |   8 +-
 iocore/cache/CacheRead.cc               |  11 ++-
 iocore/cache/I_Cache.h                  |  15 ++--
 iocore/cache/P_CacheInternal.h          |  46 +++++++-----
 iocore/cache/P_CacheTest.h              |   1 +
 iocore/cluster/ClusterCache.cc          |  26 ++++---
 iocore/cluster/P_ClusterCacheInternal.h |  15 ++--
 iocore/cluster/P_ClusterInline.h        |  15 +++-
 proxy/ICP.cc                            |   3 +-
 proxy/Prefetch.cc                       |  19 +++--
 proxy/Prefetch.h                        |   2 +-
 proxy/http/HttpCacheSM.cc               |   8 +-
 proxy/http/HttpCacheSM.h                |   9 ++-
 proxy/http/HttpSM.cc                    |  16 +++-
 proxy/http/HttpTransact.h               |   2 +
 proxy/http/HttpTransactCache.cc         | 107 +++++++++++++++++++++++++--
 proxy/http/HttpTransactCache.h          |  61 +++++++++++++--
 18 files changed, 278 insertions(+), 93 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/db67432f/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 75890e1..2a0771c 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,8 +1,5 @@
                                                          -*- coding: utf-8 -*-
-Changes with Apache Traffic Server 5.0.0
-
-  *) [TS-1919] Eliminate CacheLookupHttpConfig. This breaks cluster
-   compatibility, so all cluster nodes should be upgraded simultaneously.
+Changes with Apache Traffic Server 4.2.0
 
   *) [TS-2467] traffic_shell doesn't work with tcl 8.6.
    Author: Ben Aitchison <ben@meh.net.nz>
@@ -63,8 +60,6 @@ Changes with Apache Traffic Server 5.0.0
 
   *) [TS-2432] Fix a race in aio_err_callblk.
 
-Changes with Apache Traffic Server 4.2.0
-
   *) [TS-2251] Simplify LogBuffer reference counting.
 
   *) [TS-2190] Remove cache.log from the cachurl plugin.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/db67432f/iocore/cache/Cache.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/Cache.cc b/iocore/cache/Cache.cc
index e3cf044..711b7c9 100644
--- a/iocore/cache/Cache.cc
+++ b/iocore/cache/Cache.cc
@@ -3413,15 +3413,15 @@ ink_cache_init(ModuleVersion v)
 //----------------------------------------------------------------------------
 Action *
 CacheProcessor::open_read(Continuation *cont, URL *url, bool cluster_cache_local, CacheHTTPHdr
*request,
-                          void *context, time_t pin_in_cache, CacheFragType type)
+                          CacheLookupHttpConfig *params, time_t pin_in_cache, CacheFragType
type)
 {
 #ifdef CLUSTER_CACHE
   if (cache_clustering_enabled > 0 && !cluster_cache_local) {
-    return open_read_internal(CACHE_OPEN_READ_LONG, cont, (MIOBuffer *) 0, url, request,
context,
-                              (CacheKey *) 0, pin_in_cache, type, (char *) 0, 0);
+    return open_read_internal(CACHE_OPEN_READ_LONG, cont, (MIOBuffer *) 0,
+                              url, request, params, (CacheKey *) 0, pin_in_cache, type, (char
*) 0, 0);
   }
 #endif
-  return caches[type]->open_read(cont, url, request, context, type);
+  return caches[type]->open_read(cont, url, request, params, type);
 }
 
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/db67432f/iocore/cache/CacheRead.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/CacheRead.cc b/iocore/cache/CacheRead.cc
index e155304..5e8c6ac 100644
--- a/iocore/cache/CacheRead.cc
+++ b/iocore/cache/CacheRead.cc
@@ -90,7 +90,7 @@ Lcallreturn:
 #ifdef HTTP_CACHE
 Action *
 Cache::open_read(Continuation * cont, CacheKey * key, CacheHTTPHdr * request,
-                 void * context, CacheFragType type, char *hostname, int host_len)
+                 CacheLookupHttpConfig * params, CacheFragType type, char *hostname, int
host_len)
 {
 
   if (!CacheProcessor::IsCacheReady(type)) {
@@ -116,7 +116,7 @@ Cache::open_read(Continuation * cont, CacheKey * key, CacheHTTPHdr * request,
       CACHE_INCREMENT_DYN_STAT(c->base_stat + CACHE_STAT_ACTIVE);
       c->request.copy_shallow(request);
       c->frag_type = CACHE_FRAG_TYPE_HTTP;
-      c->context = context;
+      c->params = params;
       c->od = od;
     }
     if (!lock) {
@@ -242,7 +242,7 @@ CacheVC::openReadChooseWriter(int /* event ATS_UNUSED */, Event * /* e
ATS_UNUSE
       return -ECACHE_NO_DOC;
     }
     if (cache_config_select_alternate) {
-      alternate_index = HttpTransactCache::SelectFromAlternates(&vector, &request,
static_cast<HttpConfigParams*>(context));
+      alternate_index = HttpTransactCache::SelectFromAlternates(&vector, &request,
params);
       if (alternate_index < 0)
         return -ECACHE_ALT_MISS;
     } else
@@ -967,8 +967,7 @@ CacheVC::openReadVecWrite(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED
*/
       dir_overwrite(&first_key, vol, &dir, &od->first_dir);
       if (od->move_resident_alt)
         dir_insert(&od->single_doc_key, vol, &od->single_doc_dir);
-
-      int alt_ndx = HttpTransactCache::SelectFromAlternates(write_vector, &request, static_cast<HttpConfigParams*>(context));
+      int alt_ndx = HttpTransactCache::SelectFromAlternates(write_vector, &request, params);
       vol->close_write(this);
       if (alt_ndx >= 0) {
         vector.clear();
@@ -1074,7 +1073,7 @@ CacheVC::openReadStartHead(int event, Event * e)
         goto Ldone;
       }
       if (cache_config_select_alternate) {
-        alternate_index = HttpTransactCache::SelectFromAlternates(&vector, &request,
static_cast<HttpConfigParams*>(context));
+        alternate_index = HttpTransactCache::SelectFromAlternates(&vector, &request,
params);
         if (alternate_index < 0) {
           err = ECACHE_ALT_MISS;
           goto Ldone;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/db67432f/iocore/cache/I_Cache.h
----------------------------------------------------------------------
diff --git a/iocore/cache/I_Cache.h b/iocore/cache/I_Cache.h
index 63707e1..b89357f 100644
--- a/iocore/cache/I_Cache.h
+++ b/iocore/cache/I_Cache.h
@@ -53,6 +53,7 @@
 
 struct CacheVC;
 #ifdef HTTP_CACHE
+class CacheLookupHttpConfig;
 class URL;
 class HTTPHdr;
 class HTTPInfo;
@@ -106,10 +107,14 @@ struct CacheProcessor:public Processor
 #ifdef HTTP_CACHE
   Action *lookup(Continuation *cont, URL *url, bool cluster_cache_local, bool local_only
= false,
                  CacheFragType frag_type = CACHE_FRAG_TYPE_HTTP);
-  inkcoreapi Action *open_read(Continuation *cont, URL *url, bool cluster_cache_local, CacheHTTPHdr
*request,
-                               void *context, time_t pin_in_cache = (time_t) 0, CacheFragType
frag_type = CACHE_FRAG_TYPE_HTTP);
-  Action *open_read_buffer(Continuation *cont, MIOBuffer *buf, URL *url, CacheHTTPHdr *request,
-                           void *context, CacheFragType frag_type = CACHE_FRAG_TYPE_HTTP);
+  inkcoreapi Action *open_read(Continuation *cont, URL *url,
+                               bool cluster_cache_local,
+                               CacheHTTPHdr *request,
+                               CacheLookupHttpConfig *params,
+                               time_t pin_in_cache = (time_t) 0, CacheFragType frag_type
= CACHE_FRAG_TYPE_HTTP);
+  Action *open_read_buffer(Continuation *cont, MIOBuffer *buf, URL *url,
+                           CacheHTTPHdr *request,
+                           CacheLookupHttpConfig *params, CacheFragType frag_type = CACHE_FRAG_TYPE_HTTP);
   Action *open_write(Continuation *cont, int expected_size, URL *url, bool cluster_cache_local,
                      CacheHTTPHdr *request, CacheHTTPInfo *old_info,
                      time_t pin_in_cache = (time_t) 0, CacheFragType frag_type = CACHE_FRAG_TYPE_HTTP);
@@ -119,7 +124,7 @@ struct CacheProcessor:public Processor
   Action *remove(Continuation *cont, URL *url, bool cluster_cache_local, CacheFragType frag_type
= CACHE_FRAG_TYPE_HTTP);
 
   Action *open_read_internal(int, Continuation *, MIOBuffer *, CacheURL *,
-                             CacheHTTPHdr *, void *,
+                             CacheHTTPHdr *, CacheLookupHttpConfig *,
                              CacheKey *, time_t, CacheFragType type, char *hostname, int
host_len);
 #endif
   Action *link(Continuation *cont, CacheKey *from, CacheKey *to, bool cluster_cache_local,

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/db67432f/iocore/cache/P_CacheInternal.h
----------------------------------------------------------------------
diff --git a/iocore/cache/P_CacheInternal.h b/iocore/cache/P_CacheInternal.h
index 06bfdf4..f9a5845 100644
--- a/iocore/cache/P_CacheInternal.h
+++ b/iocore/cache/P_CacheInternal.h
@@ -424,7 +424,7 @@ struct CacheVC: public CacheVConnection
   CacheHTTPInfo *info;
   CacheHTTPInfoVector *write_vector;
 #ifdef HTTP_CACHE
-  void *context;
+  CacheLookupHttpConfig *params;
 #endif
   int header_len;       // for communicating with agg_copy
   int frag_len;         // for communicating with agg_copy
@@ -1035,9 +1035,9 @@ struct Cache
   Action *lookup(Continuation *cont, URL *url, CacheFragType type);
   inkcoreapi Action *open_read(Continuation *cont, CacheKey *key,
                                CacheHTTPHdr *request,
-                               void *context, CacheFragType type, char *hostname, int host_len);
+                               CacheLookupHttpConfig *params, CacheFragType type, char *hostname,
int host_len);
   Action *open_read(Continuation *cont, URL *url, CacheHTTPHdr *request,
-                    void *context, CacheFragType type);
+                    CacheLookupHttpConfig *params, CacheFragType type);
   Action *open_write(Continuation *cont, CacheKey *key,
                      CacheHTTPInfo *old_info, time_t pin_in_cache = (time_t) 0,
                      CacheKey *key1 = NULL,
@@ -1069,13 +1069,14 @@ inkcoreapi extern Cache *caches[NUM_CACHE_FRAG_TYPES];
 
 #ifdef HTTP_CACHE
 TS_INLINE Action *
-Cache::open_read(Continuation *cont, CacheURL *url, CacheHTTPHdr *request, void *context,
CacheFragType type)
+Cache::open_read(Continuation *cont, CacheURL *url, CacheHTTPHdr *request,
+                 CacheLookupHttpConfig *params, CacheFragType type)
 {
   INK_MD5 md5;
   int len;
   url->MD5_get(&md5);
   const char *hostname = url->host_get(&len);
-  return open_read(cont, &md5, request, context, type, (char *) hostname, len);
+  return open_read(cont, &md5, request, params, type, (char *) hostname, len);
 }
 
 TS_INLINE void
@@ -1178,8 +1179,9 @@ CacheProcessor::open_read(Continuation *cont, CacheKey *key, bool cluster_cache_
 {
 #ifdef CLUSTER_CACHE
   if (cache_clustering_enabled > 0 && !cluster_cache_local) {
-    return open_read_internal(CACHE_OPEN_READ, cont, (MIOBuffer *) 0, (CacheURL *) 0, (CacheHTTPHdr
*) 0,
-                              (void *) 0, key, 0, frag_type, hostname, host_len);
+    return open_read_internal(CACHE_OPEN_READ, cont, (MIOBuffer *) 0,
+                              (CacheURL *) 0, (CacheHTTPHdr *) 0,
+                              (CacheLookupHttpConfig *) 0, key, 0, frag_type, hostname, host_len);
   }
 #endif
   return caches[frag_type]->open_read(cont, key, frag_type, hostname, host_len);
@@ -1191,8 +1193,9 @@ CacheProcessor::open_read_buffer(Continuation *cont, MIOBuffer *buf
ATS_UNUSED,
 {
 #ifdef CLUSTER_CACHE
   if (cache_clustering_enabled > 0) {
-    return open_read_internal(CACHE_OPEN_READ_BUFFER, cont, buf, (CacheURL *) 0, (CacheHTTPHdr
*) 0,
-                              (void*) 0, key, 0, frag_type, hostname, host_len);
+    return open_read_internal(CACHE_OPEN_READ_BUFFER, cont, buf,
+                              (CacheURL *) 0, (CacheHTTPHdr *) 0,
+                              (CacheLookupHttpConfig *) 0, key, 0, frag_type, hostname, host_len);
   }
 #endif
   return caches[frag_type]->open_read(cont, key, frag_type, hostname, host_len);
@@ -1273,17 +1276,17 @@ CacheProcessor::lookup(Continuation *cont, URL *url, bool cluster_cache_local,
b
 }
 
 TS_INLINE Action *
-CacheProcessor::open_read_buffer(Continuation *cont, MIOBuffer *buf, URL *url, CacheHTTPHdr
*request,
-                                 void *context, CacheFragType type)
+CacheProcessor::open_read_buffer(Continuation *cont, MIOBuffer *buf,
+                                 URL *url, CacheHTTPHdr *request, CacheLookupHttpConfig *params,
CacheFragType type)
 {
   (void) buf;
 #ifdef CLUSTER_CACHE
   if (cache_clustering_enabled > 0) {
-    return open_read_internal(CACHE_OPEN_READ_BUFFER_LONG, cont, buf, url, request, context,
(CacheKey *) 0,
-                              0, type, (char *) 0, 0);
+    return open_read_internal(CACHE_OPEN_READ_BUFFER_LONG, cont, buf, url,
+                              request, params, (CacheKey *) 0, 0, type, (char *) 0, 0);
   }
 #endif
-  return caches[type]->open_read(cont, url, request, context, type);
+  return caches[type]->open_read(cont, url, request, params, type);
 }
 
 TS_INLINE Action *
@@ -1305,9 +1308,13 @@ CacheProcessor::open_write_buffer(Continuation * cont, MIOBuffer *
buf, URL * ur
 
 #ifdef CLUSTER_CACHE
 TS_INLINE Action *
-CacheProcessor::open_read_internal(int opcode, Continuation *cont, MIOBuffer *buf, CacheURL
*url, CacheHTTPHdr *request,
-                                   void *context, CacheKey *key, time_t pin_in_cache, CacheFragType
frag_type, char *hostname,
-                                   int host_len)
+CacheProcessor::open_read_internal(int opcode,
+                                   Continuation *cont, MIOBuffer *buf,
+                                   CacheURL *url,
+                                   CacheHTTPHdr *request,
+                                   CacheLookupHttpConfig *params,
+                                   CacheKey *key,
+                                   time_t pin_in_cache, CacheFragType frag_type, char *hostname,
int host_len)
 {
   INK_MD5 url_md5;
   if ((opcode == CACHE_OPEN_READ_LONG) || (opcode == CACHE_OPEN_READ_BUFFER_LONG)) {
@@ -1318,11 +1325,12 @@ CacheProcessor::open_read_internal(int opcode, Continuation *cont,
MIOBuffer *bu
   ClusterMachine *m = cluster_machine_at_depth(cache_hash(url_md5));
 
   if (m) {
-    return Cluster_read(m, opcode, cont, buf, url, request, key, pin_in_cache, frag_type,
hostname, host_len);
+    return Cluster_read(m, opcode, cont, buf, url,
+                        request, params, key, pin_in_cache, frag_type, hostname, host_len);
   } else {
     if ((opcode == CACHE_OPEN_READ_LONG)
         || (opcode == CACHE_OPEN_READ_BUFFER_LONG)) {
-      return caches[frag_type]->open_read(cont, &url_md5, request, context, frag_type,
hostname, host_len);
+      return caches[frag_type]->open_read(cont, &url_md5, request, params, frag_type,
hostname, host_len);
     } else {
       return caches[frag_type]->open_read(cont, key, frag_type, hostname, host_len);
     }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/db67432f/iocore/cache/P_CacheTest.h
----------------------------------------------------------------------
diff --git a/iocore/cache/P_CacheTest.h b/iocore/cache/P_CacheTest.h
index 2959ea3..8ef83ca 100644
--- a/iocore/cache/P_CacheTest.h
+++ b/iocore/cache/P_CacheTest.h
@@ -76,6 +76,7 @@ struct CacheTestSM : public RegressionSM {
   MIOBuffer *buffer;
   IOBufferReader *buffer_reader;
 #ifdef HTTP_CACHE
+  CacheLookupHttpConfig params;
   CacheHTTPInfo info;
   char urlstr[1024];
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/db67432f/iocore/cluster/ClusterCache.cc
----------------------------------------------------------------------
diff --git a/iocore/cluster/ClusterCache.cc b/iocore/cluster/ClusterCache.cc
index fc80ef5..8d4b6e5 100644
--- a/iocore/cluster/ClusterCache.cc
+++ b/iocore/cluster/ClusterCache.cc
@@ -1212,6 +1212,14 @@ 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);
 
@@ -1231,10 +1239,9 @@ cache_op_ClusterFunction(ClusterHandler * ch, void *data, int len)
         memcpy(c->ic_hostname->data(), hostname, host_len);
       }
 
-      c->http_config_params = HttpConfig::acquire();
       Cache *call_cache = caches[c->frag_type];
       Action *a = call_cache->open_read(c, &key, &c->ic_request,
-                                        c->http_config_params,
+                                        c->ic_params,
                                         c->frag_type, hostname, host_len);
       // Get rid of purify warnings since 'c' can be freed by open_read.
       if (a != ACTION_RESULT_DONE) {
@@ -1873,21 +1880,22 @@ struct retryDisposeOfDataBuffer:public Continuation
 {
   CacheContinuation *c;
 
-  int handleRetryEvent(int event, Event * e) {
+  int handleRetryEvent(int event, Event * e)
+  {
     if (CacheContinuation::handleDisposeEvent(event, c) == EVENT_DONE) {
       delete this;
-      return EVENT_DONE;
-    } else {
+        return EVENT_DONE;
+    } else
+    {
       e->schedule_in(HRTIME_MSECONDS(10));
       return EVENT_CONT;
     }
   }
-
   retryDisposeOfDataBuffer(CacheContinuation * cont)
-    :  Continuation(new_ProxyMutex()), c(cont) {
-    SET_HANDLER((rtryDisOfDBufHandler) &retryDisposeOfDataBuffer::handleRetryEvent);
+:  Continuation(new_ProxyMutex()), c(cont) {
+    SET_HANDLER((rtryDisOfDBufHandler)
+                & retryDisposeOfDataBuffer::handleRetryEvent);
   }
-
 };
 
 //////////////////////////////////////////////////////////////////

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/db67432f/iocore/cluster/P_ClusterCacheInternal.h
----------------------------------------------------------------------
diff --git a/iocore/cluster/P_ClusterCacheInternal.h b/iocore/cluster/P_ClusterCacheInternal.h
index 907d6f5..8b62d44 100644
--- a/iocore/cluster/P_ClusterCacheInternal.h
+++ b/iocore/cluster/P_ClusterCacheInternal.h
@@ -30,7 +30,6 @@
 #define __P_CLUSTERCACHEINTERNAL_H__
 #include "P_ClusterCache.h"
 #include "I_OneWayTunnel.h"
-#include "HttpConfig.h"
 
 //
 // Compilation Options
@@ -165,10 +164,10 @@ struct CacheContinuation:public Continuation
   Arena ic_arena;
   CacheHTTPHdr ic_request;
   CacheHTTPHdr ic_response;
-  HttpConfigParams *http_config_params;
+  CacheLookupHttpConfig *ic_params;
   CacheHTTPInfo ic_old_info;
   CacheHTTPInfo ic_new_info;
-  Ptr<IOBufferData> ic_hostname;
+    Ptr<IOBufferData> ic_hostname;
   int ic_hostname_len;
 
   // debugging
@@ -247,11 +246,11 @@ struct CacheContinuation:public Continuation
     if (cache_vc_info.valid()) {
       cache_vc_info.destroy();
     }
-    if (http_config_params) {
-      HttpConfig::release(http_config_params);
-      http_config_params = 0;
+    // Deallocate unmarshaled data
+    if (ic_params) {
+      delete ic_params;
+      ic_params = 0;
     }
-
     if (ic_request.valid()) {
       ic_request.clear();
     }
@@ -312,7 +311,7 @@ CacheContinuation():
     lookup_open_write_vc_event(0),
     ic_arena(),
     ic_request(),
-    ic_response(), http_config_params(0), ic_old_info(), ic_new_info(), ic_hostname_len(0),
cache_op_ClusterFunction(0) {
+    ic_response(), ic_params(0), ic_old_info(), ic_new_info(), ic_hostname_len(0), cache_op_ClusterFunction(0)
{
     token.clear();
     SET_HANDLER((CacheContHandler) & CacheContinuation::remoteOpEvent);
   }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/db67432f/iocore/cluster/P_ClusterInline.h
----------------------------------------------------------------------
diff --git a/iocore/cluster/P_ClusterInline.h b/iocore/cluster/P_ClusterInline.h
index 75fa571..c653956 100644
--- a/iocore/cluster/P_ClusterInline.h
+++ b/iocore/cluster/P_ClusterInline.h
@@ -59,10 +59,13 @@ Cluster_lookup(Continuation * cont, CacheKey * key, CacheFragType frag_type,
cha
 }
 
 inline Action *
-Cluster_read(ClusterMachine * owner_machine, int opcode, Continuation * cont, MIOBuffer *
buf, CacheURL * url,
-             CacheHTTPHdr * request, CacheKey * key, time_t pin_in_cache, CacheFragType frag_type,
char *hostname,
-             int host_len)
+Cluster_read(ClusterMachine * owner_machine, int opcode,
+             Continuation * cont, MIOBuffer * buf,
+             CacheURL * url, CacheHTTPHdr * request,
+             CacheLookupHttpConfig * params, CacheKey * key,
+             time_t pin_in_cache, CacheFragType frag_type, char *hostname, int host_len)
 {
+  (void) params;
   if (clusterProcessor.disable_remote_cluster_ops(owner_machine)) {
     Action a;
     a = cont;
@@ -90,6 +93,7 @@ Cluster_read(ClusterMachine * owner_machine, int opcode, Continuation *
cont, MI
       url_hostname = url->host_get(&url_hlen);
 
       len += request->m_heap->marshal_length();
+      len += params->marshal_length();
       len += url_hlen;
 
       if ((flen + len) > DEFAULT_MAX_BUFFER_SIZE)       // Bound marshalled data
@@ -106,7 +110,10 @@ Cluster_read(ClusterMachine * owner_machine, int opcode, Continuation
* cont, MI
       }
       data += res;
       cur_len -= res;
-
+      if ((res = params->marshal(data, cur_len)) < 0)
+        goto err_exit;
+      data += res;
+      cur_len -= res;
       memcpy(data, url_hostname, url_hlen);
 
       CacheOpArgs_General readArgs;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/db67432f/proxy/ICP.cc
----------------------------------------------------------------------
diff --git a/proxy/ICP.cc b/proxy/ICP.cc
index 9450ec4..8124a44 100644
--- a/proxy/ICP.cc
+++ b/proxy/ICP.cc
@@ -43,6 +43,7 @@
 #include "BaseManager.h"
 #include "HdrUtils.h"
 
+extern CacheLookupHttpConfig global_cache_lookup_config;
 HTTPHdr gclient_request;
 
 //****************************************************************************
@@ -480,7 +481,7 @@ ICPPeerReadCont::ICPPeerQueryCont(int /* event ATS_UNUSED */, Event *
/* e ATS_U
       //       cache clustering is not used with stale lookup.
       //////////////////////////////////////////////////////////////
       a = cacheProcessor.open_read(this, &_state->_cachelookupURL, false,
-                                   &gclient_request, NULL, (time_t) 0);
+                                   &gclient_request, &global_cache_lookup_config,
(time_t) 0);
     } else {
       a = cacheProcessor.lookup(this, &_state->_cachelookupURL, false, _state->_cache_lookup_local);
     }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/db67432f/proxy/Prefetch.cc
----------------------------------------------------------------------
diff --git a/proxy/Prefetch.cc b/proxy/Prefetch.cc
index b402504..182e4c3 100644
--- a/proxy/Prefetch.cc
+++ b/proxy/Prefetch.cc
@@ -1131,11 +1131,6 @@ PrefetchBlaster::free()
     delete request;
   }
 
-  if (http_config_params) {
-    HttpConfig::release(http_config_params);
-    http_config_params = 0;
-  }
-
   mutex.clear();
   prefetchBlasterAllocator.free(this);
 }
@@ -1489,7 +1484,7 @@ PrefetchBlaster::handleEvent(int event, void *data)
 
       //if (cache_lookup_necessary) do:
       initCacheLookupConfig();
-      cacheProcessor.open_read(this, request->url_get(), false, request, http_config_params,
0);
+      cacheProcessor.open_read(this, request->url_get(), false, request, &cache_lookup_config,
0);
 
       break;
     }
@@ -1867,7 +1862,17 @@ PrefetchBlaster::invokeBlaster()
 void
 PrefetchBlaster::initCacheLookupConfig()
 {
-  this->http_config_params = HttpConfig::acquire();
+  //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->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

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/db67432f/proxy/Prefetch.h
----------------------------------------------------------------------
diff --git a/proxy/Prefetch.h b/proxy/Prefetch.h
index ec8a9ec..34289fa 100644
--- a/proxy/Prefetch.h
+++ b/proxy/Prefetch.h
@@ -328,7 +328,7 @@ public:
 
   PrefetchBlastData data_blast;
 
-  HttpConfigParams *http_config_params;
+  CacheLookupHttpConfig cache_lookup_config;
 
   //udp related:
   uint32_t n_pkts_sent;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/db67432f/proxy/http/HttpCacheSM.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpCacheSM.cc b/proxy/http/HttpCacheSM.cc
index f5f05e7..7f82dd5 100644
--- a/proxy/http/HttpCacheSM.cc
+++ b/proxy/http/HttpCacheSM.cc
@@ -212,8 +212,8 @@ HttpCacheSM::do_cache_open_read()
   }
   //Initialising read-while-write-inprogress flag
   this->readwhilewrite_inprogress = false;
-  Action *action_handle = cacheProcessor.open_read(this, this->lookup_url, master_sm->t_state.cache_control.cluster_cache_local,
-                                                   this->read_request_hdr, this->read_config,
this->read_pin_in_cache);
+  Action *action_handle = cacheProcessor.open_read(this, this->lookup_url, master_sm->t_state.cache_control.cluster_cache_local,
this->read_request_hdr, this->read_config,
+                                                   this->read_pin_in_cache);
 
   if (action_handle != ACTION_RESULT_DONE) {
     pending_action = action_handle;
@@ -231,13 +231,13 @@ HttpCacheSM::do_cache_open_read()
 }
 
 Action *
-HttpCacheSM::open_read(URL * url, HTTPHdr * hdr, HttpConfigParams *http_config_params, time_t
pin_in_cache)
+HttpCacheSM::open_read(URL * url, HTTPHdr * hdr, CacheLookupHttpConfig * params, time_t pin_in_cache)
 {
   Action *act_return;
 
   lookup_url = url;
   read_request_hdr = hdr;
-  read_config = http_config_params;
+  read_config = params;
   read_pin_in_cache = pin_in_cache;
   ink_assert(pending_action == NULL);
   SET_HANDLER(&HttpCacheSM::state_cache_open_read);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/db67432f/proxy/http/HttpCacheSM.h
----------------------------------------------------------------------
diff --git a/proxy/http/HttpCacheSM.h b/proxy/http/HttpCacheSM.h
index e2af016..a6b40a9 100644
--- a/proxy/http/HttpCacheSM.h
+++ b/proxy/http/HttpCacheSM.h
@@ -42,6 +42,7 @@
 
 class HttpSM;
 class HttpCacheSM;
+class CacheLookupHttpConfig;
 
 struct HttpCacheAction:public Action
 {
@@ -66,10 +67,10 @@ public:
     captive_action.init(this);
   }
 
-  Action *open_read(URL * url, HTTPHdr * hdr, HttpConfigParams * http_config_params, time_t
pin_in_cache);
+  Action *open_read(URL * url, HTTPHdr * hdr, CacheLookupHttpConfig * params, time_t pin_in_cache);
 
-  Action *open_write(URL * url, HTTPHdr * request, CacheHTTPInfo * old_info, time_t pin_in_cache,
bool retry,
-                     bool allow_multiple);
+  Action *open_write(URL * url,
+                     HTTPHdr * request, CacheHTTPInfo * old_info, time_t pin_in_cache, bool
retry, bool allow_multiple);
 
   CacheVConnection *cache_read_vc;
   CacheVConnection *cache_write_vc;
@@ -157,7 +158,7 @@ private:
   // Open read parameters
   int open_read_tries;
   HTTPHdr *read_request_hdr;
-  HttpConfigParams *read_config;
+  CacheLookupHttpConfig *read_config;
   time_t read_pin_in_cache;
 
   // Open write parameters

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/db67432f/proxy/http/HttpSM.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index fbf9dd4..df9dac5 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -405,6 +405,20 @@ HttpSM::init()
   // Simply point to the global config for the time being, no need to copy this
   // 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.http_config_param->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();
   t_state.srv_lookup = hostdb_srv_enabled;
 
@@ -4278,7 +4292,7 @@ HttpSM::do_cache_lookup_and_read()
   DebugSM("http_seq", "[HttpSM::do_cache_lookup_and_read] [%" PRId64 "] Issuing cache lookup
for URL %s",  sm_id, c_url->string_get(&t_state.arena));
   Action *cache_action_handle = cache_sm.open_read(c_url,
                                                    &t_state.hdr_info.client_request,
-                                                   t_state.http_config_param,
+                                                   &(t_state.cache_info.config),
                                                    (time_t) ((t_state.cache_control.pin_in_cache_for
< 0) ?
                                                              0 : t_state.cache_control.pin_in_cache_for));
   //

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/db67432f/proxy/http/HttpTransact.h
----------------------------------------------------------------------
diff --git a/proxy/http/HttpTransact.h b/proxy/http/HttpTransact.h
index 1232aca..ad3152b 100644
--- a/proxy/http/HttpTransact.h
+++ b/proxy/http/HttpTransact.h
@@ -636,6 +636,7 @@ public:
     HTTPInfo *second_object_read;
     HTTPInfo object_store;
     HTTPInfo transform_store;
+    CacheLookupHttpConfig config;
     CacheDirectives directives;
     int open_read_retries;
     int open_write_retries;
@@ -655,6 +656,7 @@ public:
         second_object_read(NULL),
         object_store(),
         transform_store(),
+        config(),
         directives(),
         open_read_retries(0),
         open_write_retries(0),

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/db67432f/proxy/http/HttpTransactCache.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpTransactCache.cc b/proxy/http/HttpTransactCache.cc
index ebde9cc..1b0fc04 100644
--- a/proxy/http/HttpTransactCache.cc
+++ b/proxy/http/HttpTransactCache.cc
@@ -32,6 +32,10 @@
 #include "Error.h"
 #include "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.
@@ -161,22 +165,21 @@ is_empty(char *s)
 
 */
 int
-HttpTransactCache::SelectFromAlternates(CacheHTTPInfoVector * cache_vector, HTTPHdr * client_request,
-                                        HttpConfigParams * http_config_params)
+HttpTransactCache::SelectFromAlternates(CacheHTTPInfoVector * cache_vector,
+                                        HTTPHdr * client_request, CacheLookupHttpConfig *
http_config_params)
 {
   time_t current_age, best_age = NUM_SECONDS_IN_ONE_YEAR;
   time_t t_now = 0;
   int best_index = -1;
   float best_Q = -1.0;
   float unacceptable_Q = 0.0;
-  int alt_count = cache_vector->count();
 
-  // TODO: for ICP we also want to exit here with a return 0, it's what the
-  //  old code implied.
+  int alt_count = cache_vector->count();
   if (alt_count == 0) {
     return -1;
   }
 
+
   Debug("http_match", "[SelectFromAlternates] # alternates = %d", alt_count);
   Debug("http_seq", "[SelectFromAlternates] %d alternates for this cached doc", alt_count);
   if (diags->on("http_alts")) {
@@ -184,6 +187,9 @@ HttpTransactCache::SelectFromAlternates(CacheHTTPInfoVector * cache_vector,
HTTP
       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;
 
   if (!client_request->valid()) {
     return 0;
@@ -290,7 +296,7 @@ HttpTransactCache::SelectFromAlternates(CacheHTTPInfoVector * cache_vector,
HTTP
 
 */
 float
-HttpTransactCache::calculate_quality_of_match(HttpConfigParams * http_config_param,
+HttpTransactCache::calculate_quality_of_match(CacheLookupHttpConfig * http_config_param,
                                               HTTPHdr * client_request,
                                               HTTPHdr * obj_client_request,
                                               HTTPHdr * obj_origin_server_response)
@@ -1153,7 +1159,7 @@ language_wildcard:
 
 */
 Variability_t
-HttpTransactCache::CalcVariability(HttpConfigParams * http_config_params, HTTPHdr * client_request,
+HttpTransactCache::CalcVariability(CacheLookupHttpConfig * http_config_params, HTTPHdr *
client_request,
                                    HTTPHdr * obj_client_request, HTTPHdr * obj_origin_server_response)
 {
   ink_assert(http_config_params != NULL);
@@ -1235,7 +1241,7 @@ HttpTransactCache::CalcVariability(HttpConfigParams * http_config_params,
HTTPHd
       // we should ignore Vary: User-Agent even if 'proxy.config.cache.vary_on_user_agent'
 //
       // is 1. Actually the 'proxy.config.cache.vary_on_user_agent' is useless in such case
//
       ///////////////////////////////////////////////////////////////////////////////////////
-      if (http_config_params->global_user_agent_header &&
+      if (http_config_params->cache_global_user_agent_header &&
           !strcasecmp((char *) field->str, "User-Agent"))
         continue;
 
@@ -1477,3 +1483,88 @@ L1:
 
   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);
+}

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/db67432f/proxy/http/HttpTransactCache.h
----------------------------------------------------------------------
diff --git a/proxy/http/HttpTransactCache.h b/proxy/http/HttpTransactCache.h
index 90c5614..bd6e9bd 100644
--- a/proxy/http/HttpTransactCache.h
+++ b/proxy/http/HttpTransactCache.h
@@ -35,6 +35,54 @@
 
 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,
@@ -49,8 +97,6 @@ enum ContentEncoding
 };
 
 
-struct HttpConfigParams;
-
 class HttpTransactCache
 {
 public:
@@ -59,9 +105,10 @@ public:
   // content negotiation support //
   /////////////////////////////////
 
-  static int SelectFromAlternates(CacheHTTPInfoVector * cache_vector_data, HTTPHdr * client_request,
HttpConfigParams* http_config_params);
+  static int SelectFromAlternates(CacheHTTPInfoVector * cache_vector_data,
+                                  HTTPHdr * client_request, CacheLookupHttpConfig * cache_lookup_http_config_params);
 
-  static float calculate_quality_of_match(HttpConfigParams * http_config_params, HTTPHdr
* client_request, // in
+  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
 
@@ -84,8 +131,10 @@ public:
   // variability & server negotiation routines //
   ///////////////////////////////////////////////
 
-  static Variability_t CalcVariability(HttpConfigParams * http_config_params, HTTPHdr * client_request,
-                                       HTTPHdr * obj_client_request, HTTPHdr * obj_origin_server_response
);
+  static Variability_t CalcVariability(CacheLookupHttpConfig * http_config_params, HTTPHdr
* client_request,    // in
+                                       HTTPHdr * obj_client_request,    // in
+                                       HTTPHdr * obj_origin_server_response     // in
+    );
 
   static HTTPStatus match_response_to_request_conditionals(HTTPHdr * ua_request, HTTPHdr
* c_response);
 


Mime
View raw message