1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:17:44 +00:00

AK: Make URL::m_port an Optional<u16>, Expose raw port getter

Our current way of signalling a missing port with m_port == 0 was
lacking, as 0 is a valid port number in URLs.
This commit is contained in:
Idan Horowitz 2021-09-13 23:12:16 +03:00 committed by Andreas Kling
parent 1c9c43785d
commit d6cfa34667
15 changed files with 42 additions and 41 deletions

View file

@ -134,7 +134,7 @@ Origin Document::origin() const
{
if (!m_url.is_valid())
return {};
return { m_url.protocol(), m_url.host(), m_url.port() };
return { m_url.protocol(), m_url.host(), m_url.port_or_default() };
}
void Document::set_origin(const Origin& origin)