1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 06:57:45 +00:00

AK: Add URL::cannot_have_a_username_or_password_or_port

As defined by the URL specification:
https://url.spec.whatwg.org/#cannot-have-a-username-password-port
This commit is contained in:
Idan Horowitz 2021-09-13 22:46:31 +03:00 committed by Andreas Kling
parent 929af64a67
commit 1c9c43785d

View file

@ -58,6 +58,7 @@ public:
String const& fragment() const { return m_fragment; } String const& fragment() const { return m_fragment; }
u16 port() const { return m_port ? m_port : default_port_for_scheme(m_scheme); } u16 port() const { return m_port ? m_port : default_port_for_scheme(m_scheme); }
bool cannot_be_a_base_url() const { return m_cannot_be_a_base_url; } bool cannot_be_a_base_url() const { return m_cannot_be_a_base_url; }
bool cannot_have_a_username_or_password_or_port() const { return m_host.is_null() || m_host.is_empty() || m_cannot_be_a_base_url || m_scheme == "file"sv; }
bool includes_credentials() const { return !m_username.is_empty() || !m_password.is_empty(); } bool includes_credentials() const { return !m_username.is_empty() || !m_password.is_empty(); }
bool is_special() const { return is_special_scheme(m_scheme); } bool is_special() const { return is_special_scheme(m_scheme); }