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

bneradt 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 0d4f77c0d2 Fix scheme detection via port for regex remap (#12637)
0d4f77c0d2 is described below

commit 0d4f77c0d250ddbadf39a63cfe434b13cf164644
Author: Brian Neradt <[email protected]>
AuthorDate: Tue Nov 4 14:14:59 2025 -0600

    Fix scheme detection via port for regex remap (#12637)
    
    The ternary operator was checking literal 80 instead of
    request_port == 80, making an accidental tautology that always returned
    the HTTP scheme. This was introduced in the #12243 URL std::string_view
    refactor.
---
 src/proxy/http/remap/UrlRewrite.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/proxy/http/remap/UrlRewrite.cc 
b/src/proxy/http/remap/UrlRewrite.cc
index 9f71e183ca..6c7e3f48d6 100644
--- a/src/proxy/http/remap/UrlRewrite.cc
+++ b/src/proxy/http/remap/UrlRewrite.cc
@@ -1016,7 +1016,7 @@ UrlRewrite::_regexMappingLookup(RegexMappingList 
&regex_mappings, URL *request_u
   // If the scheme is empty (e.g. because of a CONNECT method), guess it based 
on port
   // This is equivalent to the logic in UrlMappingPathIndex::_GetTrie().
   if (request_scheme.empty()) {
-    request_scheme = std::string_view{80 ? URL_SCHEME_HTTP : URL_SCHEME_HTTPS};
+    request_scheme = std::string_view{request_port == 80 ? URL_SCHEME_HTTP : 
URL_SCHEME_HTTPS};
   }
 
   // Loop over the entire linked list, or until we're satisfied

Reply via email to