Updated Branches:
  refs/heads/master 09fcb8da4 -> 7ddc44f74

TS-2245 This adds a '2' config state to the ignore mismatch configs

This is completley backwards compatible, but adds a new feature which
allows a much more sane behavior for these configs:

  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

Setting any of these to the value '2' will now ignore the
respective client request header, but *only* if the cached
response does not have a Vary: header.

The old documentation seemed to imply that this would be
the case, but it was never so. Setting any of these to "1"
would simply ignore whatever the Vary: header says.


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

Branch: refs/heads/master
Commit: 70815db3b237d5e572ff9bc0a4df81d64157ba92
Parents: 09fcb8d
Author: Leif Hedstrom <[email protected]>
Authored: Sun Oct 27 15:22:42 2013 -0600
Committer: Leif Hedstrom <[email protected]>
Committed: Tue Nov 5 08:15:51 2013 -0700

----------------------------------------------------------------------
 .../configuration/records.config.en.rst         |  67 +++++++---
 mgmt/RecordsConfig.cc                           |   8 +-
 proxy/http/HttpConfig.cc                        |   8 +-
 proxy/http/HttpSM.cc                            |   8 +-
 proxy/http/HttpTransactCache.cc                 | 127 +++++++++++--------
 proxy/http/HttpTransactCache.h                  |  16 +--
 6 files changed, 140 insertions(+), 94 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/70815db3/doc/reference/configuration/records.config.en.rst
----------------------------------------------------------------------
diff --git a/doc/reference/configuration/records.config.en.rst 
b/doc/reference/configuration/records.config.en.rst
index f1f0c0c..3917048 100644
--- a/doc/reference/configuration/records.config.en.rst
+++ b/doc/reference/configuration/records.config.en.rst
@@ -1061,45 +1061,76 @@ Cache Control
 .. ts:cv:: CONFIG proxy.config.http.cache.ignore_accept_mismatch INT 0
    :reloadable:
 
-   When enabled (``1``), Traffic Server serves documents from cache with a 
``Content-Type:`` header that does not match the ``Accept:``
-   header of the request.
+   When with a value of ``1``, Traffic Server serves documents from cache with 
a
+   ``Content-Type:`` header that does not match the ``Accept:`` header of the
+   request. If set to ``2``, this logic only happens in the absence of a
+   ``Vary`` header in the cached response (which is the recommended and safe 
use).
 
    .. note::
+      This option should only be enabled with ``1`` if you're having
+      problems with caching *and* you origin server doesn't set the ``Vary``
+      header. Alternatively, if the origin is incorrectly setting
+      ``Vary: Accept`` or doesn't respond with ``406 (Not Acceptable)``,
+      you can also enable this configuration with a ``1`.
+     
 
-      This option should only be enabled if you're having
-      problems with caching *and* one of the following is true:
+.. ts:cv:: CONFIG proxy.config.http.cache.ignore_accept_language_mismatch INT 0
+   :reloadable:
 
-      -  Your origin server sets ``Vary: Accept`` when doing content 
negotiation with ``Accept`` *OR*
-      -  The server does not send a ``406 (Not Acceptable)`` response for 
types that it cannot serve.
+   When enabled with a value of ``1``, Traffic Server serves documents from 
cache with a
+   ``Content-Language:`` header that does not match the ``Accept-Language:``
+   header of the request. If set to ``2``, this logic only happens in the 
absence of a
+   ``Vary`` header in the cached response (which is the recommended and safe 
use).
 
-.. ts:cv:: CONFIG proxy.config.http.cache.ignore_accept_language_mismatch INT 0
+   .. note::
+
+      This option should only be enabled with ``1`` if you're having
+      problems with caching *and* you origin server doesn't set the ``Vary``
+      header. Alternatively, if the origin is incorrectly setting
+      ``Vary: Accept-Language`` or doesn't respond with ``406 (Not 
Acceptable)``,
+      you can also enable this configuration with a ``1`.
+
+
+.. ts:cv:: CONFIG proxy.config.http.cache.ignore_accept_encoding_mismatch INT 0
    :reloadable:
 
-   When enabled (``1``), Traffic Server serves documents from cache with a 
``Content-Language:`` header that does not match the
-   ``Accept-Language:`` header of the request.
+   When enabled with a value of ``1``, Traffic Server serves documents from 
cache with a
+   ``Content-Encoding:`` header that does not match the ``Accept-Encoding:``
+   header of the request. If set to ``2``, this logic only happens in the 
absence of a
+   ``Vary`` header in the cached response (which is the recommended and safe 
use).
 
    .. note::
 
-      This option should only be enabled if you're having
-      problems with caching and your origin server is guaranteed to set
-      ``Vary: Accept-Language`` when doing content negotiation with
-      ``Accept-Language``.
+      This option should only be enabled with ``1`` if you're having
+      problems with caching *and* you origin server doesn't set the ``Vary``
+      header. Alternatively, if the origin is incorrectly setting
+      ``Vary: Accept-Encoding`` or doesn't respond with ``406 (Not 
Acceptable)``
+      you can also enable this configuration with a ``1`.
+
 
 .. ts:cv:: CONFIG proxy.config.http.cache.ignore_accept_charset_mismatch INT 0
    :reloadable:
 
-   When enabled (``1``), Traffic Server serves documents from cache with a 
``Content-Type:`` header that does not match the
-   ``Accept-Charset:`` header of the request.
+   When enabled with a value of ``1``, Traffic Server serves documents from 
cache with a
+   ``Content-Type:`` header that does not match the ``Accept-Charset:`` header
+   of the request. If set to ``2``, this logic only happens in the absence of a
+   ``Vary`` header in the cached response (which is the recommended and safe 
use).
 
    .. note::
 
-      This option should only be enabled if you're having problems with 
caching and your origin server is
-      guaranteed to set ``Vary: Accept-Charset`` when doing content 
negotiation with ``Accept-Charset``.
+      This option should only be enabled with ``1`` if you're having
+      problems with caching *and* you origin server doesn't set the ``Vary``
+      header. Alternatively, if the origin is incorrectly setting
+      ``Vary: Accept-Charset`` or doesn't respond with ``406 (Not 
Acceptable)``,
+      you can also enable this configuration with a ``1`.
+
 
 .. ts:cv:: CONFIG proxy.config.http.cache.ignore_client_cc_max_age INT 1
    :reloadable:
 
-   When enabled (``1``), Traffic Server ignores any ``Cache-Control:  
max-age`` headers from the client.
+   When enabled (``1``), Traffic Server ignores any ``Cache-Control:
+   max-age`` headers from the client. This technically violates the HTTP RFC,
+   but avoids a problem where a client can forcefully invalidate a cached 
object.
 
 .. ts:cv:: CONFIG proxy.config.cache.max_doc_size INT 0
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/70815db3/mgmt/RecordsConfig.cc
----------------------------------------------------------------------
diff --git a/mgmt/RecordsConfig.cc b/mgmt/RecordsConfig.cc
index b5e87bc..9683ba0 100644
--- a/mgmt/RecordsConfig.cc
+++ b/mgmt/RecordsConfig.cc
@@ -134,13 +134,13 @@ RecordElement RecordsConfig[] = {
   //# Support for disabling check for Accept-* / Content-* header mismatch
   //#
   
//##############################################################################
-  {RECT_CONFIG, "proxy.config.http.cache.ignore_accept_mismatch", RECD_INT, 
"0", RECU_DYNAMIC, RR_NULL, RECC_INT, "[0-1]", RECA_NULL}
+  {RECT_CONFIG, "proxy.config.http.cache.ignore_accept_mismatch", RECD_INT, 
"0", RECU_DYNAMIC, RR_NULL, RECC_INT, "[0-2]", RECA_NULL}
   ,
-  {RECT_CONFIG, "proxy.config.http.cache.ignore_accept_language_mismatch", 
RECD_INT, "0", RECU_DYNAMIC, RR_NULL, RECC_INT, "[0-1]", RECA_NULL}
+  {RECT_CONFIG, "proxy.config.http.cache.ignore_accept_language_mismatch", 
RECD_INT, "0", RECU_DYNAMIC, RR_NULL, RECC_INT, "[0-2]", RECA_NULL}
   ,
-  {RECT_CONFIG, "proxy.config.http.cache.ignore_accept_encoding_mismatch", 
RECD_INT, "0", RECU_DYNAMIC, RR_NULL, RECC_INT, "[0-1]", RECA_NULL}
+  {RECT_CONFIG, "proxy.config.http.cache.ignore_accept_encoding_mismatch", 
RECD_INT, "0", RECU_DYNAMIC, RR_NULL, RECC_INT, "[0-2]", RECA_NULL}
   ,
-  {RECT_CONFIG, "proxy.config.http.cache.ignore_accept_charset_mismatch", 
RECD_INT, "0", RECU_DYNAMIC, RR_NULL, RECC_INT, "[0-1]", RECA_NULL}
+  {RECT_CONFIG, "proxy.config.http.cache.ignore_accept_charset_mismatch", 
RECD_INT, "0", RECU_DYNAMIC, RR_NULL, RECC_INT, "[0-2]", RECA_NULL}
   ,
 
   
//##############################################################################

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/70815db3/proxy/http/HttpConfig.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpConfig.cc b/proxy/http/HttpConfig.cc
index dcc232b..3c8109d 100644
--- a/proxy/http/HttpConfig.cc
+++ b/proxy/http/HttpConfig.cc
@@ -1523,10 +1523,10 @@ HttpConfig::reconfigure()
   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->ignore_accept_mismatch = 
INT_TO_BOOL(m_master.ignore_accept_mismatch);
-  params->ignore_accept_language_mismatch = 
INT_TO_BOOL(m_master.ignore_accept_language_mismatch);
-  params->ignore_accept_encoding_mismatch = 
INT_TO_BOOL(m_master.ignore_accept_encoding_mismatch);
-  params->ignore_accept_charset_mismatch = 
INT_TO_BOOL(m_master.ignore_accept_charset_mismatch);
+  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_when_to_revalidate = 
m_master.oride.cache_when_to_revalidate;
   params->cache_when_to_add_no_cache_to_msie_requests = 
m_master.cache_when_to_add_no_cache_to_msie_requests;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/70815db3/proxy/http/HttpSM.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index d58320b..e8b8f64 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -409,10 +409,10 @@ HttpSM::init()
   // 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 ? true : false;
-  t_state.cache_info.config.ignore_accept_language_mismatch = 
t_state.http_config_param->ignore_accept_language_mismatch ? true : false;
-  t_state.cache_info.config.ignore_accept_encoding_mismatch = 
t_state.http_config_param->ignore_accept_encoding_mismatch ? true : false;
-  t_state.cache_info.config.ignore_accept_charset_mismatch = 
t_state.http_config_param->ignore_accept_charset_mismatch ? 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;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/70815db3/proxy/http/HttpTransactCache.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpTransactCache.cc b/proxy/http/HttpTransactCache.cc
index b89dfa0..c30b9a6 100644
--- a/proxy/http/HttpTransactCache.cc
+++ b/proxy/http/HttpTransactCache.cc
@@ -296,17 +296,11 @@ 
HttpTransactCache::SelectFromAlternates(CacheHTTPInfoVector * cache_vector,
 
 */
 float
-HttpTransactCache::calculate_quality_of_match(CacheLookupHttpConfig * 
http_config_param,        // in
-                                              HTTPHdr * client_request, // in
-                                              HTTPHdr * obj_client_request,    
 // in
-                                              HTTPHdr * 
obj_origin_server_response      // in
-  )
+HttpTransactCache::calculate_quality_of_match(CacheLookupHttpConfig * 
http_config_param,
+                                              HTTPHdr * client_request,
+                                              HTTPHdr * obj_client_request,
+                                              HTTPHdr * 
obj_origin_server_response)
 {
-  float q[4], Q;
-  MIMEField *accept_field;
-  MIMEField *cached_accept_field;
-  MIMEField *content_field;
-
   // For PURGE requests, any alternate is good really.
   if (client_request->method_get_wksidx() == HTTP_WKSIDX_PURGE)
     return (float)1.0;
@@ -316,37 +310,67 @@ 
HttpTransactCache::calculate_quality_of_match(CacheLookupHttpConfig * http_confi
   if (obj_origin_server_response->status_get() != HTTP_STATUS_OK)
     return (float)1.0;
 
-  q[1] = (q[2] = (q[3] = -2.0));        /* just to make debug output happy :) 
*/
+  // Now calculate a quality based on all sorts of logic
+  float q[4], Q;
+  MIMEField *accept_field;
+  MIMEField *cached_accept_field;
+  MIMEField *content_field;
 
-  // Accept //
-  // A NULL Accept or a NULL Content-Type field are perfect matches.
+  // vary_skip_mask is used as a bitmask, 0b01 or 0b11 depending on the 
presence of Vary.
+  // This allows us to AND each of the four configs against it; Table:
+  //
+  //   Conf   Mask          Conf   Mask         Conf   Mask
+  //   ----   ----          ----   ----         ----   ----
+  //    00  &  01 == false   01  &  01 == true   10  &  01 == false
+  //    00  &  11 == false   01  &  11 == true   10  &  11 == true
+  //
+  // A true value means the check for that config can be skipped. Note: from a 
users
+  // perspective, the configs are simply 0, 1 or 2.
+  unsigned int vary_skip_mask = 
obj_origin_server_response->presence(MIME_PRESENCE_VARY) ? 0b01 : 0b11;
+
+  // Make debug output happy
+  q[1] = (q[2] = (q[3] = -2.0));
+
+  // This content_field is used for a couple of headers, so get it first
   content_field = 
obj_origin_server_response->field_find(MIME_FIELD_CONTENT_TYPE, 
MIME_LEN_CONTENT_TYPE);
-  accept_field = client_request->field_find(MIME_FIELD_ACCEPT, 
MIME_LEN_ACCEPT);
-  q[0] = (content_field != 0 && accept_field != 0 && 
!http_config_param->ignore_accept_mismatch) ?
-    calculate_quality_of_accept_match(accept_field, content_field) : 1.0;
+
+  // Accept: header
+  if (http_config_param->ignore_accept_mismatch & vary_skip_mask) {
+    // Ignore it
+    q[0] = 1.0;
+  } else {
+    accept_field = client_request->field_find(MIME_FIELD_ACCEPT, 
MIME_LEN_ACCEPT);
+
+    // A NULL Accept or a NULL Content-Type field are perfect matches.
+    if (content_field == NULL || accept_field == NULL) {
+      q[0] = 1.0; // TODO: Why should this not be 1.001 ?? // leif
+    } else {
+      q[0] = calculate_quality_of_accept_match(accept_field, content_field);
+    }
+  }
 
   if (q[0] >= 0.0) {
-    // Accept-Charset
-    if (http_config_param->ignore_accept_charset_mismatch) {    //Bug 2393700 
/ebalsa
+    // Accept-Charset: header
+    if (http_config_param->ignore_accept_charset_mismatch & vary_skip_mask) {
+      // Ignore it
       q[1] = 1.0;
     } else {
       accept_field = client_request->field_find(MIME_FIELD_ACCEPT_CHARSET, 
MIME_LEN_ACCEPT_CHARSET);
       cached_accept_field = 
obj_client_request->field_find(MIME_FIELD_ACCEPT_CHARSET, 
MIME_LEN_ACCEPT_CHARSET);
-      // content_field lookup is same as above
-      // content_field = 
obj_origin_server_response->field_find(MIME_FIELD_CONTENT_TYPE, 
MIME_LEN_CONTENT_TYPE);
 
       // absence in both requests counts as exact match
       if (accept_field == NULL && cached_accept_field == NULL) {
-        Debug("http_alternate", "Exact match for ACCEPT CHARSET");
-        q[1] = 1.001;           //slightly higher weight to this guy
+        Debug("http_alternate", "Exact match for ACCEPT CHARSET (not in 
request nor cache)");
+        q[1] = 1.001; //slightly higher weight to this guy
       } else {
         q[1] = calculate_quality_of_accept_charset_match(accept_field, 
content_field, cached_accept_field);
       }
     }
 
     if (q[1] >= 0.0) {
-      // Accept-Encoding //
-      if (http_config_param->ignore_accept_encoding_mismatch) { //Bug 2393700 
/ebalsa
+      // Accept-Encoding: header
+      if (http_config_param->ignore_accept_encoding_mismatch & vary_skip_mask) 
{
+        // Ignore it
         q[2] = 1.0;
       } else {
         accept_field = client_request->field_find(MIME_FIELD_ACCEPT_ENCODING, 
MIME_LEN_ACCEPT_ENCODING);
@@ -355,27 +379,27 @@ 
HttpTransactCache::calculate_quality_of_match(CacheLookupHttpConfig * http_confi
 
         // absence in both requests counts as exact match
         if (accept_field == NULL && cached_accept_field == NULL) {
-          Debug("http_alternate", "Exact match for ACCEPT ENCODING");
-          q[2] = 1.001;         //slightly higher weight to this guy
+          Debug("http_alternate", "Exact match for ACCEPT ENCODING (not in 
request nor cache)");
+          q[2] = 1.001; //slightly higher weight to this guy
         } else {
           q[2] = calculate_quality_of_accept_encoding_match(accept_field, 
content_field, cached_accept_field);
         }
       }
 
       if (q[2] >= 0.0) {
-        // Accept-Language //
-        if (http_config_param->ignore_accept_language_mismatch) {       //Bug 
2393700 /ebalsa
+        // Accept-Language: header
+        if (http_config_param->ignore_accept_language_mismatch & 
vary_skip_mask) {
+          // Ignore it
           q[3] = 1.0;
         } else {
           accept_field = 
client_request->field_find(MIME_FIELD_ACCEPT_LANGUAGE, 
MIME_LEN_ACCEPT_LANGUAGE);
-          content_field =
-            
obj_origin_server_response->field_find(MIME_FIELD_CONTENT_LANGUAGE, 
MIME_LEN_CONTENT_LANGUAGE);
+          content_field = 
obj_origin_server_response->field_find(MIME_FIELD_CONTENT_LANGUAGE, 
MIME_LEN_CONTENT_LANGUAGE);
           cached_accept_field = 
obj_client_request->field_find(MIME_FIELD_ACCEPT_LANGUAGE, 
MIME_LEN_ACCEPT_LANGUAGE);
 
           // absence in both requests counts as exact match
           if (accept_field == NULL && cached_accept_field == NULL) {
-            Debug("http_alternate", "Exact match for ACCEPT LANGUAGE");
-            q[3] = 1.001;       //slightly higher weight to this guy
+            Debug("http_alternate", "Exact match for ACCEPT LANGUAGE (not in 
request nor cache)");
+            q[3] = 1.001; //slightly higher weight to this guy
           } else {
             q[3] = calculate_quality_of_accept_language_match(accept_field, 
content_field, cached_accept_field);
           }
@@ -453,14 +477,14 @@ 
HttpTransactCache::calculate_quality_of_match(CacheLookupHttpConfig * http_confi
     }
 
     Debug("http_match", "    CalcQualityOfMatch: CalcVariability says 
variability = %d",
-            (variability != VARIABILITY_NONE));
+          (variability != VARIABILITY_NONE));
     Debug("http_seq", "    CalcQualityOfMatch: CalcVariability says 
variability = %d",
-            (variability != VARIABILITY_NONE));
-
+          (variability != VARIABILITY_NONE));
     Debug("http_match", "    CalcQualityOfMatch: Returning final Q = %g", Q);
     Debug("http_seq", "    CalcQualityOfMatch: Returning final Q = %g", Q);
   }
-  return (Q);
+
+  return Q;
 }
 
 /**
@@ -1114,7 +1138,6 @@ 
HttpTransactCache::calculate_quality_of_accept_language_match(MIMEField * accept
                                       &wildcard_present, &wildcard_q, &q, 
&a_range_length)) {
       min_q = (min_q < q ? min_q : q);
       match_found = true;
-//          goto language_wildcard;
     }
   }
   if (match_found) {
@@ -1141,8 +1164,7 @@ language_wildcard:
 
 */
 Variability_t
-HttpTransactCache::CalcVariability(CacheLookupHttpConfig * 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);
@@ -1151,33 +1173,29 @@ 
HttpTransactCache::CalcVariability(CacheLookupHttpConfig * http_config_params,
   ink_assert(obj_origin_server_response != NULL);
 
   Variability_t variability = VARIABILITY_NONE;
-
-  if (http_config_params->cache_enable_default_vary_headers || 
obj_origin_server_response->presence(MIME_PRESENCE_VARY)) {
-
-    StrList vary_list;
-
+  if (http_config_params->cache_enable_default_vary_headers ||
+      obj_origin_server_response->presence(MIME_PRESENCE_VARY)) {
     ///////////////////////////////////////////////////////////////////////
     // If the origin server sent a Vary header in the response, use that //
     // Vary, otherwise use the default. Ivry adds: However if the origin //
     // server was a non-compliant 1.1 and did not send a Vary header,    //
     // treat as 1.0 with no Vary header.                                 //
     ///////////////////////////////////////////////////////////////////////
-
+    StrList vary_list;
     int num_vary_values = 
obj_origin_server_response->value_get_comma_list(MIME_FIELD_VARY, 
MIME_LEN_VARY, &vary_list);
 
-    if (num_vary_values <= 0)   // no vary hdr, so use defaults if enabled
-    {
+    if (num_vary_values <= 0) {   // no vary hdr, so use defaults if enabled
       const char *vary_values = NULL;
       const char *content_type;
       int content_type_len;
       char type[32], subtype[32];
 
-      content_type =
-        obj_origin_server_response->value_get(MIME_FIELD_CONTENT_TYPE, 
MIME_LEN_CONTENT_TYPE, &content_type_len);
+      content_type = 
obj_origin_server_response->value_get(MIME_FIELD_CONTENT_TYPE,
+                                                           
MIME_LEN_CONTENT_TYPE, &content_type_len);
 
       if (content_type) {
-        HttpCompat::parse_mime_type_with_len(content_type, content_type_len,
-                                             type, subtype, sizeof(type), 
sizeof(subtype));
+        HttpCompat::parse_mime_type_with_len(content_type, content_type_len, 
type, subtype, sizeof(type),
+                                             sizeof(subtype));
       } else {
         type[0] = '\0';
         subtype[0] = '\0';
@@ -1207,8 +1225,7 @@ HttpTransactCache::CalcVariability(CacheLookupHttpConfig 
* http_config_params,
     }
 
     // for each field that varies, see if current & original hdrs match //
-    Str *field;
-    for (field = vary_list.head; field != NULL; field = field->next) {
+    for (Str *field = vary_list.head; field != NULL; field = field->next) {
       if (field->len == 0)
         continue;
 
@@ -1239,8 +1256,6 @@ HttpTransactCache::CalcVariability(CacheLookupHttpConfig 
* http_config_params,
           !strcasecmp((char *) field->str, "Accept-Encoding"))
         continue;
 
-
-
       ///////////////////////////////////////////////////////////////////
       // Take the current vary field and look up the headers in        //
       // the current client, and the original client.  The cached      //
@@ -1273,7 +1288,7 @@ HttpTransactCache::CalcVariability(CacheLookupHttpConfig 
* http_config_params,
     }
   }
 
-  return (variability);
+  return variability;
 }
 
 /**

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/70815db3/proxy/http/HttpTransactCache.h
----------------------------------------------------------------------
diff --git a/proxy/http/HttpTransactCache.h b/proxy/http/HttpTransactCache.h
index 0165c27..bd6e9bd 100644
--- a/proxy/http/HttpTransactCache.h
+++ b/proxy/http/HttpTransactCache.h
@@ -40,10 +40,10 @@ 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;
-  bool ignore_accept_mismatch;
-  bool ignore_accept_language_mismatch;
-  bool ignore_accept_encoding_mismatch;
-  bool ignore_accept_charset_mismatch;
+  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;
@@ -55,10 +55,10 @@ public:
   CacheLookupHttpConfig():
     cache_global_user_agent_header(false),
     cache_enable_default_vary_headers(false),
-    ignore_accept_mismatch(false),
-    ignore_accept_language_mismatch(false),
-    ignore_accept_encoding_mismatch(false),
-    ignore_accept_charset_mismatch(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)
   { }
 

Reply via email to