LibHTTP: Make sure we're not sending an empty path in requests

When the path component of the request URL was empty we'd end up
sending requests like "GET  HTTP/1.1" (note the missing /). This
ensures that we always send a path.
This commit is contained in:
Gunnar Beutner 2021-05-17 20:43:33 +02:00 committed by Andreas Kling
parent 79d3910145
commit f1dc8e12d2
Notes: sideshowbarker 2024-07-18 17:55:38 +09:00

View File

@ -37,7 +37,10 @@ ByteBuffer HttpRequest::to_raw_request() const
StringBuilder builder;
builder.append(method_name());
builder.append(' ');
if (!m_url.path().is_empty())
builder.append(m_url.path());
else
builder.append('/');
if (!m_url.query().is_empty()) {
builder.append('?');
builder.append(m_url.query());