mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 09:04:59 +00:00
AK: Do not consider port of 0 as a null port
This fixes an issue where if a port number of 0 was given for a non special scheme the port number was being dropped.
This commit is contained in:
parent
66f4cdba85
commit
23e82114b4
4 changed files with 14 additions and 4 deletions
|
@ -166,7 +166,7 @@ bool URL::compute_validity() const
|
|||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#default-port
|
||||
u16 URL::default_port_for_scheme(StringView scheme)
|
||||
Optional<u16> URL::default_port_for_scheme(StringView scheme)
|
||||
{
|
||||
// Spec defined mappings with port:
|
||||
if (scheme == "ftp")
|
||||
|
@ -188,7 +188,7 @@ u16 URL::default_port_for_scheme(StringView scheme)
|
|||
if (scheme == "ircs")
|
||||
return 6697;
|
||||
|
||||
return 0;
|
||||
return {};
|
||||
}
|
||||
|
||||
URL URL::create_with_file_scheme(DeprecatedString const& path, DeprecatedString const& fragment, DeprecatedString const& hostname)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue