summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIdan Horowitz <idan.horowitz@gmail.com>2021-09-13 22:46:31 +0300
committerAndreas Kling <kling@serenityos.org>2021-09-14 00:14:45 +0200
commit1c9c43785d0f3b810e581a6d3267e52f566733b4 (patch)
treed6b8e89944dd2872847576eb7586268a46374e05
parent929af64a67669c023be68aeda7770f702ed36913 (diff)
downloadserenity-1c9c43785d0f3b810e581a6d3267e52f566733b4.zip
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
-rw-r--r--AK/URL.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/AK/URL.h b/AK/URL.h
index 5d3bf1a6fe..ee25ef74fd 100644
--- a/AK/URL.h
+++ b/AK/URL.h
@@ -58,6 +58,7 @@ public:
String const& fragment() const { return m_fragment; }
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_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 is_special() const { return is_special_scheme(m_scheme); }