Skip to content

Commit 0d4f77c

Browse files
authored
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.
1 parent 2667e2a commit 0d4f77c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/proxy/http/remap/UrlRewrite.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1016,7 +1016,7 @@ UrlRewrite::_regexMappingLookup(RegexMappingList &regex_mappings, URL *request_u
10161016
// If the scheme is empty (e.g. because of a CONNECT method), guess it based on port
10171017
// This is equivalent to the logic in UrlMappingPathIndex::_GetTrie().
10181018
if (request_scheme.empty()) {
1019-
request_scheme = std::string_view{80 ? URL_SCHEME_HTTP : URL_SCHEME_HTTPS};
1019+
request_scheme = std::string_view{request_port == 80 ? URL_SCHEME_HTTP : URL_SCHEME_HTTPS};
10201020
}
10211021

10221022
// Loop over the entire linked list, or until we're satisfied

0 commit comments

Comments
 (0)