You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by ma...@apache.org on 2025/06/21 00:48:21 UTC

(trafficserver) branch master updated: Update url_m_loc variable to the newly generated one in set-destination (#12278)

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

masaori 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 02139d56ec Update url_m_loc variable to the newly generated one in set-destination (#12278)
02139d56ec is described below

commit 02139d56ece499599a31b066f8ab28e8225cd957
Author: Jasmine Emanouel <40...@users.noreply.github.com>
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
---
 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 c5e31664b3..96d4898a21 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;