Updated Branches:
  refs/heads/master 38d8b6a14 -> 8793e8cbb

TS-1262 allow the alternate selection api to force an alternate using a magick 
return value

Author: Otto van der Schaaf


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

Branch: refs/heads/master
Commit: 8793e8cbbb87a1dbc6cb3825175d44df32931cbc
Parents: 38d8b6a
Author: Otto van der Schaaf <oschaaf at gmail dot com>
Authored: Tue May 22 15:06:48 2012 -0600
Committer: Leif Hedstrom <[email protected]>
Committed: Tue May 22 15:06:48 2012 -0600

----------------------------------------------------------------------
 proxy/http/HttpTransactCache.cc |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/8793e8cb/proxy/http/HttpTransactCache.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpTransactCache.cc b/proxy/http/HttpTransactCache.cc
index a44e34d..5004c6e 100644
--- a/proxy/http/HttpTransactCache.cc
+++ b/proxy/http/HttpTransactCache.cc
@@ -407,6 +407,8 @@ 
HttpTransactCache::calculate_quality_of_match(CacheLookupHttpConfig * http_confi
   Debug("http_alternate", "Mult's Quality Factor: %f", Q);
   Debug("http_alternate", "----------End of Alternate----------");
 
+  int force_alt = 0;
+
   if (Q > 0.0) {
     APIHook *hook;
     HttpAltInfo info;
@@ -426,6 +428,8 @@ 
HttpTransactCache::calculate_quality_of_match(CacheLookupHttpConfig * http_confi
         if (info.m_qvalue < 0.0) {
           info.m_qvalue = 0.0;
         } else if (info.m_qvalue > 1.0) {
+          if (info.m_qvalue == FLT_MAX)
+            force_alt = 1;
           info.m_qvalue = 1.0;
         }
         qvalue *= info.m_qvalue;
@@ -440,7 +444,7 @@ 
HttpTransactCache::calculate_quality_of_match(CacheLookupHttpConfig * http_confi
     }
   }
 
-  if (Q >= 0.0) {                 // make sense to check 'variability' only if 
Q >= 0.0
+  if (Q >= 0.0 && !force_alt ) {                 // make sense to check 
'variability' only if Q >= 0.0
     // set quality to -1, if cached copy would vary for this request //
     Variability_t variability = CalcVariability(http_config_param, 
client_request,
                                                 obj_client_request, 
obj_origin_server_response);

Reply via email to