diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-10-21 17:19:17 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-10-21 17:19:17 +0200 |
commit | 835496375f59701486b9cdd666f43d9aa56d1788 (patch) | |
tree | 45f4ed514eb46f75c6b0d9046d7ae23afa2ab2b0 /AK/URL.cpp | |
parent | 9c434d8c6a3244bde1fdd48a653d73e7867ab3e4 (diff) | |
download | serenity-835496375f59701486b9cdd666f43d9aa56d1788.zip |
URL: https:// URLs should default to port 443
Diffstat (limited to 'AK/URL.cpp')
-rw-r--r-- | AK/URL.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/AK/URL.cpp b/AK/URL.cpp index 81fda73dd7..a110936302 100644 --- a/AK/URL.cpp +++ b/AK/URL.cpp @@ -60,6 +60,10 @@ bool URL::parse(const StringView& string) if (buffer.is_empty()) return false; m_protocol = String::copy(buffer); + if (m_protocol == "http") + m_port = 80; + else if (m_protocol == "https") + m_port = 443; buffer.clear(); if (m_protocol == "file") state = State::InPath; @@ -133,7 +137,7 @@ String URL::to_string() const builder.append("://"); if (protocol() != "file") { builder.append(m_host); - if (protocol() != "http" || port() != 80) { + if (!(protocol() == "http" && port() == 80) && !(protocol() == "https" && port() == 443)) { builder.append(':'); builder.append(String::number(m_port)); } |