1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 13:27:34 +00:00

AK::URL: Fix setting the port number in the case it was the last element of the URL

This commit is contained in:
xspager 2020-12-12 13:24:19 -03:00 committed by Andreas Kling
parent 2b8c7faee4
commit dd198e1a29
2 changed files with 12 additions and 0 deletions

View file

@ -236,6 +236,12 @@ bool URL::parse(const StringView& string)
m_fragment = String::copy(buffer);
if (state == State::InDataPayload)
m_data_payload = urldecode(String::copy(buffer));
if (state == State::InPort) {
auto port_opt = String::copy(buffer).to_uint();
if (port_opt.has_value())
m_port = port_opt.value();
}
if (m_query.is_null())
m_query = "";
if (m_fragment.is_null())