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

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

commit b3523604d69879688427806c57a60ca8798f118a
Author: Jasmine Emanouel <[email protected]>
AuthorDate: Sat Jun 21 10:48:13 2025 +1000

    Update url_m_loc variable to the newly generated one in set-destination 
(#12278)
    
    * Update url_m_loc variable to the newly generated on in set-destination
    
    * Update operators.cc
    
    * Update operators.cc
    
    * Update operators.cc
    
    (cherry picked from commit 02139d56ece499599a31b066f8ab28e8225cd957)
---
 plugins/header_rewrite/operators.cc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/plugins/header_rewrite/operators.cc 
b/plugins/header_rewrite/operators.cc
index b9c55ad53c..6d6a27b889 100644
--- a/plugins/header_rewrite/operators.cc
+++ b/plugins/header_rewrite/operators.cc
@@ -268,7 +268,7 @@ OperatorSetDestination::exec(const Resources &res) const
     // Determine which TSMBuffer and TSMLoc to use
     TSMBuffer bufp;
     TSMLoc    url_m_loc;
-    if (res._rri) {
+    if (res._rri && !res.changed_url) {
       bufp      = res._rri->requestBufp;
       url_m_loc = res._rri->requestUrl;
     } else {
@@ -343,6 +343,7 @@ OperatorSetDestination::exec(const Resources &res) const
         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) {
+          const_cast<Resources &>(res).changed_url = true;
           Dbg(pi_dbg_ctl, "Set destination URL to %s", value.c_str());
         } else {
           Dbg(pi_dbg_ctl, "Failed to set URL %s", value.c_str());
@@ -355,6 +356,7 @@ OperatorSetDestination::exec(const Resources &res) const
         Dbg(pi_dbg_ctl, "Would set destination SCHEME to an empty value, 
skipping");
       } else {
         TSUrlSchemeSet(bufp, url_m_loc, value.c_str(), value.length());
+        const_cast<Resources &>(res).changed_url = true;
         Dbg(pi_dbg_ctl, "OperatorSetDestination::exec() invoked with SCHEME: 
%s", value.c_str());
       }
       break;

Reply via email to