From 41ec1705864758ed86d255c68a27a0c159cdd95c Mon Sep 17 00:00:00 2001 From: Yagiz Nizipli Date: Mon, 23 Dec 2024 19:59:10 -0500 Subject: [PATCH] fix canonicalize_ipv6_hostname --- src/url_pattern_helpers.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/url_pattern_helpers.cpp b/src/url_pattern_helpers.cpp index 31063a0b5..c47319d19 100644 --- a/src/url_pattern_helpers.cpp +++ b/src/url_pattern_helpers.cpp @@ -117,9 +117,9 @@ tl::expected canonicalize_ipv6_hostname( std::string_view input) { ada_log("canonicalize_ipv6_hostname input=", input); // TODO: Optimization opportunity: Use lookup table to speed up checking - if (std::ranges::all_of(input, [](char c) { - return c == '[' || c == ']' || c == ':' || - unicode::is_ascii_hex_digit(c); + if (std::ranges::any_of(input, [](char c) { + return c != '[' && c != ']' && c != ':' && + !unicode::is_ascii_hex_digit(c); })) { return tl::unexpected(url_pattern_errors::type_error); }