Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 8449fc1aaccab18301e786f3e337b8e5540cd99e
https://github.com/WebKit/WebKit/commit/8449fc1aaccab18301e786f3e337b8e5540cd99e
Author: Anne van Kesteren <[email protected]>
Date: 2026-05-29 (Fri, 29 May 2026)
Changed paths:
M Source/WTF/wtf/URL.cpp
M Source/WTF/wtf/URL.h
M Source/WTF/wtf/URLHelpers.cpp
M Source/WTF/wtf/URLParser.cpp
M Tools/TestWebKitAPI/Tests/WTF/cocoa/URLExtras.mm
Log Message:
-----------
Fix encodeHostName() for inputs containing %
https://bugs.webkit.org/show_bug.cgi?id=310982
Reviewed by Alex Christensen.
There were two issues with encodeHostName():
1. mapHostNames() would return early for ASCII-only input, even when
that input contains %.
2. mapHostName() checked the wrong variable for %.
3. Fixing (1) meant URLs containing % could now reach the host-range
detection code, which doesn't understand bracketed IPv6 syntax:
for http://[::1]/path%20x it would pick '[' as the host, which
then failed UIDNA. Skip IDN processing for host ranges starting
with '[' in collectRangesThatNeedMapping().
We also fix various trivial issues in the URL code:
1. protocolIsFile() is redundant with hasSpecialScheme().
2. Some type mismatches.
3. A redundant call to codePointAt(i).
Test: Tools/TestWebKitAPI/Tests/WTF/cocoa/URLExtras.mm
Canonical link: https://commits.webkit.org/314167@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications