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 2019/05/31 17:16:40 UTC
[trafficserver] branch master updated: Adds support for
set-destination SCHEME/URL to take string expansions
This is an automated email from the ASF dual-hosted git repository.
zwoop 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 a98a1e3 Adds support for set-destination SCHEME/URL to take string expansions
a98a1e3 is described below
commit a98a1e35fbd1e79dfb976edadf390382fab9adab
Author: Leif Hedstrom <zw...@apache.org>
AuthorDate: Thu May 30 15:19:44 2019 -0600
Adds support for set-destination SCHEME/URL to take string expansions
Closes #4143
---
plugins/header_rewrite/operators.cc | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/plugins/header_rewrite/operators.cc b/plugins/header_rewrite/operators.cc
index c205011..1d7ccf3 100644
--- a/plugins/header_rewrite/operators.cc
+++ b/plugins/header_rewrite/operators.cc
@@ -239,26 +239,28 @@ OperatorSetDestination::exec(const Resources &res) const
}
break;
case URL_QUAL_URL:
- if (_value.empty()) {
+ _value.append_value(value, res);
+ if (value.empty()) {
TSDebug(PLUGIN_NAME, "Would set destination URL to an empty value, skipping");
} else {
- const char *start = _value.get_value().c_str();
- const char *end = _value.get_value().size() + start;
+ const char *start = value.c_str();
+ const char *end = start + value.size();
TSMLoc new_url_loc;
if (TSUrlCreate(bufp, &new_url_loc) == TS_SUCCESS && TSUrlParse(bufp, new_url_loc, &start, end) == TS_PARSE_DONE &&
TSHttpHdrUrlSet(bufp, res.hdr_loc, new_url_loc) == TS_SUCCESS) {
- TSDebug(PLUGIN_NAME, "Set destination URL to %s", _value.get_value().c_str());
+ TSDebug(PLUGIN_NAME, "Set destination URL to %s", value.c_str());
} else {
- TSDebug(PLUGIN_NAME, "Failed to set URL %s", _value.get_value().c_str());
+ TSDebug(PLUGIN_NAME, "Failed to set URL %s", value.c_str());
}
}
break;
case URL_QUAL_SCHEME:
- if (_value.empty()) {
+ _value.append_value(value, res);
+ if (value.empty()) {
TSDebug(PLUGIN_NAME, "Would set destination SCHEME to an empty value, skipping");
} else {
- TSUrlSchemeSet(bufp, url_m_loc, _value.get_value().c_str(), _value.get_value().length());
- TSDebug(PLUGIN_NAME, "OperatorSetDestination::exec() invoked with SCHEME: %s", _value.get_value().c_str());
+ TSUrlSchemeSet(bufp, url_m_loc, value.c_str(), value.length());
+ TSDebug(PLUGIN_NAME, "OperatorSetDestination::exec() invoked with SCHEME: %s", value.c_str());
}
break;
default: