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 2012/02/27 14:08:47 UTC

git commit: Oops, wrong logic around when to set redirect.

Updated Branches:
  refs/heads/master bf6abfe59 -> 520481a03


Oops, wrong logic around when to set redirect.


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

Branch: refs/heads/master
Commit: 520481a031c36bbc254a0fd6493230b6f6b3f958
Parents: bf6abfe
Author: Leif Hedstrom <zw...@apache.org>
Authored: Mon Feb 27 06:08:42 2012 -0700
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Mon Feb 27 06:08:42 2012 -0700

----------------------------------------------------------------------
 regex_remap/regex_remap.cc |   18 +++++++-----------
 1 files changed, 7 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver-plugins/blob/520481a0/regex_remap/regex_remap.cc
----------------------------------------------------------------------
diff --git a/regex_remap/regex_remap.cc b/regex_remap/regex_remap.cc
index 786180a..53a9659 100644
--- a/regex_remap/regex_remap.cc
+++ b/regex_remap/regex_remap.cc
@@ -842,21 +842,17 @@ TSRemapDoRemap(void* ih, TSHttpTxn txnp, TSRemapRequestInfo *rri)
         TSDebug(PLUGIN_NAME, "    matched rule %d [%s]", re->order(), re->regex());
 
         // Check for a quick response, if the status option is set
-        if (re->status_option() > 0 &&
-            re->status_option() != TS_HTTP_STATUS_MOVED_PERMANENTLY &&
-            re->status_option() != TS_HTTP_STATUS_MOVED_TEMPORARILY) {
-          // Don't set the URL / Location for this.
-          TSHttpTxnSetHttpRetStatus(txnp, re->status_option());
-          break;
-        }
+        if (re->status_option() > 0) {
+          if (re->status_option() != TS_HTTP_STATUS_MOVED_PERMANENTLY &&
+              re->status_option() != TS_HTTP_STATUS_MOVED_TEMPORARILY) {
+            // Don't set the URL / Location for this.
+            TSHttpTxnSetHttpRetStatus(txnp, re->status_option());
+            break;
+          }
 
-        if (dest_len > 0) {
           TSDebug(PLUGIN_NAME, "Redirecting URL, status=%d", re->status_option());
           TSHttpTxnSetHttpRetStatus(txnp, re->status_option());
           rri->redirect = 1;
-        } else {
-          TSHttpTxnSetHttpRetStatus(txnp, TS_HTTP_STATUS_INTERNAL_SERVER_ERROR);
-          TSError("redirect to zero-length URL");
         }
 
         // Now parse the new URL, which can also be the redirect URL