You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by am...@apache.org on 2015/05/06 20:52:05 UTC

trafficserver git commit: TS-3585: DNS is not done for redirects if cache is disabled.

Repository: trafficserver
Updated Branches:
  refs/heads/master c9fe5c218 -> 60ffbfda0


TS-3585: DNS is not done for redirects if cache is disabled.


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

Branch: refs/heads/master
Commit: 60ffbfda03997c018dac1d02118170c1eb1ecc1e
Parents: c9fe5c2
Author: Alan M. Carroll <so...@yahoo-inc.com>
Authored: Wed May 6 13:49:47 2015 -0500
Committer: Alan M. Carroll <so...@yahoo-inc.com>
Committed: Wed May 6 13:49:47 2015 -0500

----------------------------------------------------------------------
 proxy/http/HttpTransact.cc | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/60ffbfda/proxy/http/HttpTransact.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index 964f69b..a923d6e 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -1357,11 +1357,17 @@ HttpTransact::HandleRequest(State *s)
       s->parent_params->ParentTable->hostMatch) {
     s->force_dns = 1;
   }
-  // YTS Team, yamsat Plugin
-  // Doing a Cache Lookup in case of a Redirection to ensure that
-  // the newly requested object is not in the CACHE
-  if (s->txn_conf->cache_http && s->redirect_info.redirect_in_process && s->state_machine->enable_redirection) {
-    TRANSACT_RETURN(SM_ACTION_CACHE_LOOKUP, NULL);
+  /* A redirect means we need to check some things again.
+     If the cache is enabled then we need to check the new (redirected) request against the cache.
+     If not, then we need to at least do DNS again to guarantee we are using the correct IP address
+     (if the host changed). Note DNS comes after cache lookup so in both cases we do the DNS.
+  */
+  if (s->redirect_info.redirect_in_process && s->state_machine->enable_redirection) {
+    if (s->txn_conf->cache_http) {
+      TRANSACT_RETURN(SM_ACTION_CACHE_LOOKUP, NULL);
+    } else {
+      TRANSACT_RETURN(SM_ACTION_DNS_LOOKUP, OSDNSLookup); // effectively s->force_dns
+    }
   }