1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:37:35 +00:00

URL: Parse URLs that lack a path (e.g "http://serenityos.org")

This commit is contained in:
Andreas Kling 2019-10-17 20:21:57 +02:00
parent 7b6aba4284
commit f1f928670e

View file

@ -109,6 +109,14 @@ bool URL::parse(const StringView& string)
continue;
}
}
if (state == State::InHostname) {
// We're still in the hostname, so e.g "http://serenityos.org"
if (buffer.is_empty())
return false;
m_host = String::copy(buffer);
m_path = "/";
return true;
}
m_path = String::copy(buffer);
return true;
}