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 2018/03/02 18:18:53 UTC

[trafficserver] branch 7.1.x updated: Support more redirect status codes - 303, 305.

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 fe66ee7  Support more redirect status codes - 303, 305.
fe66ee7 is described below

commit fe66ee7a289ba38f625a8f8ec756c5d6bd9e37af
Author: Alan M. Carroll <am...@apache.org>
AuthorDate: Fri Mar 2 10:36:08 2018 -0600

    Support more redirect status codes - 303, 305.
    
    (cherry picked from commit e84988733e57823d7136044b16097cd6b7f94bca)
---
 plugins/header_rewrite/operators.cc | 8 ++++----
 proxy/http/HttpTransact.cc          | 2 ++
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/plugins/header_rewrite/operators.cc b/plugins/header_rewrite/operators.cc
index d467f89..3460ed0 100644
--- a/plugins/header_rewrite/operators.cc
+++ b/plugins/header_rewrite/operators.cc
@@ -26,6 +26,7 @@
 
 #include "operators.h"
 #include "expander.h"
+#include "../../lib/ts/apidefs.h"
 
 // OperatorConfig
 void
@@ -279,10 +280,9 @@ OperatorSetRedirect::initialize(Parser &p)
 
   _status.set_value(p.get_arg());
   _location.set_value(p.get_value());
-
-  if ((_status.get_int_value() != (int)TS_HTTP_STATUS_MOVED_PERMANENTLY) &&
-      (_status.get_int_value() != (int)TS_HTTP_STATUS_MOVED_TEMPORARILY)) {
-    TSError("[%s] unsupported redirect status %d", PLUGIN_NAME, _status.get_int_value());
+  auto status = _status.get_int_value();
+  if (status < 300 || status > 399 || status == TS_HTTP_STATUS_NOT_MODIFIED) {
+    TSError("[%s] unsupported redirect status %d", PLUGIN_NAME, status);
   }
 
   require_resources(RSRC_SERVER_RESPONSE_HEADERS);
diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index 289a747..b91c06d 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -797,6 +797,8 @@ HttpTransact::EndRemapRequest(State *s)
     switch (s->http_return_code) {
     case HTTP_STATUS_MOVED_PERMANENTLY:
     case HTTP_STATUS_PERMANENT_REDIRECT:
+    case HTTP_STATUS_SEE_OTHER:
+    case HTTP_STATUS_USE_PROXY:
       error_body_type = "redirect#moved_permanently";
       break;
     case HTTP_STATUS_MOVED_TEMPORARILY:

-- 
To stop receiving notification emails like this one, please contact
zwoop@apache.org.