You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2017/11/07 00:02:38 UTC

[trafficserver] branch 7.1.x updated: Backport of 2015, setup HttpSM for redirect

This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch 7.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/7.1.x by this push:
     new 58862e0  Backport of 2015, setup HttpSM for redirect
58862e0 is described below

commit 58862e00958fccac2a783eba41b21dc98aad696e
Author: Leif Hedstrom <zw...@apache.org>
AuthorDate: Sun Nov 5 17:29:30 2017 -0700

    Backport of 2015, setup HttpSM for redirect
    
    This was fixed on master, in a6c14f0. However, that change was an
    incompatible change, and should not be backported to 7.x. However,
    I think we can "cheat" here a little bit, and just pick the portion
    that makes sure the internal state is properly mirroring the
    overridable settings. This is a little ugly, but does seem to work.
    
    This closes #2765.
---
 proxy/http/HttpTransact.cc | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index b0596c2..29f492e 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -695,6 +695,11 @@ HttpTransact::StartRemapRequest(State *s)
 
     s->hdr_info.client_request.set_url_target_from_host_field();
 
+    // Since we're not doing remap, we still have to allow for these overridable
+    // configurations to modify follow-redirect behavior. Someone could for example
+    // have set them in a plugin other than conf_remap running in a prior hook.
+    s->state_machine->enable_redirection = (s->txn_conf->redirection_enabled && (s->txn_conf->number_of_redirections > 0));
+
     if (s->is_upgrade_request && s->post_remap_upgrade_return_point) {
       TRANSACT_RETURN(SM_ACTION_POST_REMAP_SKIP, s->post_remap_upgrade_return_point);
     }
@@ -777,6 +782,12 @@ HttpTransact::EndRemapRequest(State *s)
   const char *host = incoming_request->host_get(&host_len);
   DebugTxn("http_trans", "EndRemapRequest host is %.*s", host_len, host);
 
+  // Setting enable_redirection according to HttpConfig (master or overridable). We
+  // defer this as late as possible, to allow plugins to modify the overridable
+  // configurations (e.g. conf_remap.so). We intentionally only modify this if
+  // the configuration says so.
+  s->state_machine->enable_redirection = (s->txn_conf->redirection_enabled && (s->txn_conf->number_of_redirections > 0));
+
   ////////////////////////////////////////////////////////////////
   // if we got back a URL to redirect to, vector the user there //
   ////////////////////////////////////////////////////////////////

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>'].