mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
LibURL: Remove default port handling for the IRC schemes
LibURL previously assigned a default port to the IRC schemes, a carryover from SerenityOS where IRC is supported. This behavior deviates from the URL Standard and affects URL parsing by eliding an explicitly specified port when it matches the default (this is considered a legacy behaviour of the web URL schemes). Remove the IRC default port to restore spec-compliant behavior.
This commit is contained in:
committed by
Shannon Booth
parent
5af269913e
commit
b6969fb82d
Notes:
github-actions[bot]
2026-02-06 11:04:44 +00:00
Author: https://github.com/shannonbooth Commit: https://github.com/LadybirdBrowser/ladybird/commit/b6969fb82d7 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/7598
@@ -106,24 +106,16 @@ bool URL::cannot_have_a_username_or_password_or_port() const
|
||||
// https://url.spec.whatwg.org/#default-port
|
||||
Optional<u16> default_port_for_scheme(StringView scheme)
|
||||
{
|
||||
// Spec defined mappings with port:
|
||||
if (scheme == "ftp")
|
||||
if (scheme == "ftp"sv)
|
||||
return 21;
|
||||
if (scheme == "http")
|
||||
if (scheme == "http"sv)
|
||||
return 80;
|
||||
if (scheme == "https")
|
||||
if (scheme == "https"sv)
|
||||
return 443;
|
||||
if (scheme == "ws")
|
||||
if (scheme == "ws"sv)
|
||||
return 80;
|
||||
if (scheme == "wss")
|
||||
if (scheme == "wss"sv)
|
||||
return 443;
|
||||
|
||||
// NOTE: not in spec, but we support these too
|
||||
if (scheme == "irc")
|
||||
return 6667;
|
||||
if (scheme == "ircs")
|
||||
return 6697;
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user