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
Notes: sideshowbarker 2024-07-19 11:39:45 +09:00

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;
}