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/07/02 00:41:57 UTC

[trafficserver] branch master updated: Fix remap redirection with build_error_reponse

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 191aaef  Fix remap redirection with build_error_reponse
191aaef is described below

commit 191aaef2d15a7568d045859f83e967fb1e94166f
Author: scw00 <61...@qq.com>
AuthorDate: Sat Jul 1 11:06:44 2017 +0800

    Fix remap redirection with build_error_reponse
---
 proxy/http/HttpSM.cc | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index 2439e91..673a799 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -1487,9 +1487,6 @@ HttpSM::state_api_callout(int event, void *data)
   api_timer     = 0;
   switch (api_next) {
   case API_RETURN_CONTINUE:
-    if (t_state.api_next_action == HttpTransact::SM_ACTION_API_SEND_RESPONSE_HDR) {
-      do_redirect();
-    }
     handle_api_return();
     break;
   case API_RETURN_DEFERED_CLOSE:
@@ -1562,6 +1559,16 @@ HttpSM::handle_api_return()
     if (ua_session) {
       ua_session->set_inactivity_timeout(HRTIME_SECONDS(t_state.txn_conf->transaction_no_activity_timeout_in));
     }
+
+    // We only follow 3xx when redirect_in_process == false. Otherwise the redirection has already been launched (in
+    // SM_ACTION_SERVE_FROM_CACHE or SM_ACTION_SERVER_READ).redirect_in_process is set before this logic if we need more direction.
+    // This redirection is only used with the build_error_reponse. Then, the redirection_tries will be increased by
+    // state_read_server_reponse_header and never get into this logic again.
+    if (enable_redirection && !t_state.redirect_info.redirect_in_process && is_redirect_required() &&
+        (redirection_tries <= t_state.txn_conf->number_of_redirections)) {
+      ++redirection_tries;
+      do_redirect();
+    }
     // we have further processing to do
     //  based on what t_state.next_action is
     break;

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