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

zwoop pushed a commit to branch 8.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/8.1.x by this push:
     new 60038ae  Adds support for set-destination SCHEME/URL to take string 
expansions
60038ae is described below

commit 60038ae7d40003b57721a2f88e5eed3119bfd857
Author: Leif Hedstrom <[email protected]>
AuthorDate: Thu May 30 15:19:44 2019 -0600

    Adds support for set-destination SCHEME/URL to take string expansions
    
    Closes #4143
    
    (cherry picked from commit a98a1e35fbd1e79dfb976edadf390382fab9adab)
---
 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 9c2e5c0..f8c39a7 100644
--- a/plugins/header_rewrite/operators.cc
+++ b/plugins/header_rewrite/operators.cc
@@ -240,26 +240,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:

Reply via email to