mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 20:07:36 +00:00
URL: https:// URLs should default to port 443
This commit is contained in:
parent
9c434d8c6a
commit
835496375f
1 changed files with 5 additions and 1 deletions
|
@ -60,6 +60,10 @@ bool URL::parse(const StringView& string)
|
||||||
if (buffer.is_empty())
|
if (buffer.is_empty())
|
||||||
return false;
|
return false;
|
||||||
m_protocol = String::copy(buffer);
|
m_protocol = String::copy(buffer);
|
||||||
|
if (m_protocol == "http")
|
||||||
|
m_port = 80;
|
||||||
|
else if (m_protocol == "https")
|
||||||
|
m_port = 443;
|
||||||
buffer.clear();
|
buffer.clear();
|
||||||
if (m_protocol == "file")
|
if (m_protocol == "file")
|
||||||
state = State::InPath;
|
state = State::InPath;
|
||||||
|
@ -133,7 +137,7 @@ String URL::to_string() const
|
||||||
builder.append("://");
|
builder.append("://");
|
||||||
if (protocol() != "file") {
|
if (protocol() != "file") {
|
||||||
builder.append(m_host);
|
builder.append(m_host);
|
||||||
if (protocol() != "http" || port() != 80) {
|
if (!(protocol() == "http" && port() == 80) && !(protocol() == "https" && port() == 443)) {
|
||||||
builder.append(':');
|
builder.append(':');
|
||||||
builder.append(String::number(m_port));
|
builder.append(String::number(m_port));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue