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

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

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

    Support more redirect status codes - 303, 305.
---
 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 21a0063..fe143fc 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 2d89222..34ae415 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -693,6 +693,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
a...@apache.org.

Reply via email to