trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bri...@apache.org
Subject [5/5] git commit: [TS-2631] Header_rewrite add SkipRemap operator
Date Wed, 12 Mar 2014 22:08:13 GMT
[TS-2631] Header_rewrite add SkipRemap operator


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

Branch: refs/heads/master
Commit: 5701441b6d329d652f557091fe5996df978faaa1
Parents: 9f7afd8
Author: Brian Geffon <briang@apache.org>
Authored: Wed Mar 12 14:58:20 2014 -0700
Committer: Brian Geffon <briang@apache.org>
Committed: Wed Mar 12 14:58:20 2014 -0700

----------------------------------------------------------------------
 plugins/header_rewrite/factory.cc   |  2 ++
 plugins/header_rewrite/operators.cc | 18 ++++++++++++++++++
 plugins/header_rewrite/operators.h  | 19 +++++++++++++++++++
 3 files changed, 39 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5701441b/plugins/header_rewrite/factory.cc
----------------------------------------------------------------------
diff --git a/plugins/header_rewrite/factory.cc b/plugins/header_rewrite/factory.cc
index 208d42a..66087fc 100644
--- a/plugins/header_rewrite/factory.cc
+++ b/plugins/header_rewrite/factory.cc
@@ -51,6 +51,8 @@ operator_factory(const std::string& op)
     o = new OperatorSetRedirect();
   } else if (op == "timeout-out") {
     o = new OperatorSetTimeoutOut();
+  } else if (op == "skip-remap") {
+    o = new OperatorSkipRemap();
   } else if (op == "no-op") {
     o = new OperatorNoOp();
   } else if (op == "counter") {

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5701441b/plugins/header_rewrite/operators.cc
----------------------------------------------------------------------
diff --git a/plugins/header_rewrite/operators.cc b/plugins/header_rewrite/operators.cc
index 086a316..6d062dd 100644
--- a/plugins/header_rewrite/operators.cc
+++ b/plugins/header_rewrite/operators.cc
@@ -364,6 +364,24 @@ OperatorSetTimeoutOut::exec(const Resources& res) const
   }
 }
 
+// OperatorSkipRemap
+void
+OperatorSkipRemap::initialize(Parser& p)
+{
+  Operator::initialize(p);
+
+  if (p.get_arg() == "1" || p.get_arg() == "true") {
+    _skip_remap = true;
+  }
+}
+
+void
+OperatorSkipRemap::exec(const Resources& res) const
+{
+  TSDebug(PLUGIN_NAME, "OperatorSkipRemap::exec() skipping remap: %s", _skip_remap ? "True"
: "False");
+  TSSkipRemappingSet(res.txnp, _skip_remap ? 1 : 0);
+}
+
 
 // OperatorRMHeader
 void

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5701441b/plugins/header_rewrite/operators.h
----------------------------------------------------------------------
diff --git a/plugins/header_rewrite/operators.h b/plugins/header_rewrite/operators.h
index 6ab67ff..57d6608 100644
--- a/plugins/header_rewrite/operators.h
+++ b/plugins/header_rewrite/operators.h
@@ -185,6 +185,25 @@ private:
   Value _timeout;
 };
 
+class OperatorSkipRemap : public Operator
+{
+public:
+  OperatorSkipRemap()
+    : _skip_remap(false)
+  {
+    TSDebug(PLUGIN_NAME_DBG, "Calling CTOR for OperatorSkipRemap");
+  }
+  void initialize(Parser& p);
+
+protected:
+  void exec(const Resources& res) const;
+
+private:
+  DISALLOW_COPY_AND_ASSIGN(OperatorSkipRemap);
+
+  bool _skip_remap;
+};
+
 
 // All the header operators share a base class
 class OperatorRMHeader : public OperatorHeaders


Mime
View raw message