mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 11:49:44 +00:00
LibHTTP+RequestServer: Use HTTP::HeaderMap for request headers
No longer just for response headers! The same type is obviously useful and ergonomic when making requests as well.
This commit is contained in:
parent
5ac0938859
commit
260c5c50ad
Notes:
sideshowbarker
2024-07-16 22:58:46 +09:00
Author: https://github.com/awesomekling
Commit: 260c5c50ad
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/116
20 changed files with 41 additions and 54 deletions
|
@ -252,7 +252,7 @@ ErrorOr<JsonValue, Client::WrappedError> Client::read_body_as_json()
|
|||
// FIXME: Check the Content-Type is actually application/json.
|
||||
size_t content_length = 0;
|
||||
|
||||
for (auto const& header : m_request->headers()) {
|
||||
for (auto const& header : m_request->headers().headers()) {
|
||||
if (header.name.equals_ignoring_ascii_case("Content-Length"sv)) {
|
||||
content_length = header.value.to_number<size_t>(TrimWhitespace::Yes).value_or(0);
|
||||
break;
|
||||
|
@ -281,7 +281,7 @@ ErrorOr<void, Client::WrappedError> Client::handle_request(JsonValue body)
|
|||
ErrorOr<void, Client::WrappedError> Client::send_success_response(JsonValue result)
|
||||
{
|
||||
bool keep_alive = false;
|
||||
if (auto it = m_request->headers().find_if([](auto& header) { return header.name.equals_ignoring_ascii_case("Connection"sv); }); !it.is_end())
|
||||
if (auto it = m_request->headers().headers().find_if([](auto& header) { return header.name.equals_ignoring_ascii_case("Connection"sv); }); !it.is_end())
|
||||
keep_alive = it->value.trim_whitespace().equals_ignoring_ascii_case("keep-alive"sv);
|
||||
|
||||
result = make_success_response(move(result));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue