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:
parent
79d3910145
commit
f1dc8e12d2
Notes:
sideshowbarker
2024-07-18 17:55:38 +09:00
Author: https://github.com/gunnarbeutner Commit: https://github.com/SerenityOS/serenity/commit/f1dc8e12d2f Pull-request: https://github.com/SerenityOS/serenity/pull/7219
1 changed files with 4 additions and 1 deletions
|
@ -37,7 +37,10 @@ ByteBuffer HttpRequest::to_raw_request() const
|
|||
StringBuilder builder;
|
||||
builder.append(method_name());
|
||||
builder.append(' ');
|
||||
builder.append(m_url.path());
|
||||
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());
|
||||
|
|
Loading…
Add table
Reference in a new issue