Skip to content

Commit

Permalink
fix canonicalize_ipv6_hostname
Browse files Browse the repository at this point in the history
  • Loading branch information
anonrig committed Dec 24, 2024
1 parent e8a1b23 commit 41ec170
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/url_pattern_helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ tl::expected<std::string, url_pattern_errors> 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);
}
Expand Down

0 comments on commit 41ec170

Please sign in to comment.