Repository: trafficserver Updated Branches: refs/heads/master 89606cb54 -> 591df370c
TS-3940: Add turning on transaction debug from header_rewrite Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/591df370 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/591df370 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/591df370 Branch: refs/heads/master Commit: 591df370c9c3f79468aa12b1e86e1bce484e007d Parents: 89606cb Author: Bryan Call <[email protected]> Authored: Fri Sep 25 09:44:53 2015 -0700 Committer: Bryan Call <[email protected]> Committed: Fri Sep 25 09:44:53 2015 -0700 ---------------------------------------------------------------------- plugins/header_rewrite/factory.cc | 2 ++ plugins/header_rewrite/operators.cc | 19 +++++++++++++++++++ plugins/header_rewrite/operators.h | 16 ++++++++++++++++ 3 files changed, 37 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/591df370/plugins/header_rewrite/factory.cc ---------------------------------------------------------------------- diff --git a/plugins/header_rewrite/factory.cc b/plugins/header_rewrite/factory.cc index 89cfe40..be1225b 100644 --- a/plugins/header_rewrite/factory.cc +++ b/plugins/header_rewrite/factory.cc @@ -59,6 +59,8 @@ operator_factory(const std::string &op) o = new OperatorCounter(); } else if (op == "set-conn-dscp") { o = new OperatorSetConnDSCP(); + } else if (op == "set-debug") { + o = new OperatorSetDebug(); } else { TSError("[%s] Unknown operator: %s", PLUGIN_NAME, op.c_str()); return NULL; http://git-wip-us.apache.org/repos/asf/trafficserver/blob/591df370/plugins/header_rewrite/operators.cc ---------------------------------------------------------------------- diff --git a/plugins/header_rewrite/operators.cc b/plugins/header_rewrite/operators.cc index 3b3345b..5ce75f5 100644 --- a/plugins/header_rewrite/operators.cc +++ b/plugins/header_rewrite/operators.cc @@ -644,3 +644,22 @@ OperatorSetConnDSCP::exec(const Resources &res) const TSHttpTxnClientPacketDscpSet(res.txnp, _ds_value.get_int_value()); } } + +// OperatorSetDebug +void +OperatorSetDebug::initialize(Parser &p) +{ + Operator::initialize(p); +} + +void +OperatorSetDebug::initialize_hooks() +{ + add_allowed_hook(TS_HTTP_READ_REQUEST_HDR_HOOK); +} + +void +OperatorSetDebug::exec(const Resources &res) const +{ + TSHttpTxnDebugSet(res.txnp, 1); +} http://git-wip-us.apache.org/repos/asf/trafficserver/blob/591df370/plugins/header_rewrite/operators.h ---------------------------------------------------------------------- diff --git a/plugins/header_rewrite/operators.h b/plugins/header_rewrite/operators.h index cfb59e9..95a9a38 100644 --- a/plugins/header_rewrite/operators.h +++ b/plugins/header_rewrite/operators.h @@ -257,4 +257,20 @@ private: Value _ds_value; }; +class OperatorSetDebug : public Operator +{ +public: + OperatorSetDebug() { TSDebug(PLUGIN_NAME_DBG, "Calling CTOR for OperatorSetDebug"); } + void initialize(Parser &p); + +protected: + void initialize_hooks(); + void exec(const Resources &res) const; + +private: + DISALLOW_COPY_AND_ASSIGN(OperatorSetDebug); + + Value _ds_value; +}; + #endif // __OPERATORS_H
