mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 01:17:46 +00:00
RequestServer: Avoid unnecessary IPC::Dictionary wrapper
We already have and use HashMap<DeprecatedString, DeprecatedString> nearly everywhere, which is equivalent.
This commit is contained in:
parent
0ee5a4e308
commit
9b9a38ec81
6 changed files with 23 additions and 20 deletions
|
@ -36,7 +36,7 @@ Messages::RequestServer::IsSupportedProtocolResponse ConnectionFromClient::is_su
|
|||
return supported;
|
||||
}
|
||||
|
||||
Messages::RequestServer::StartRequestResponse ConnectionFromClient::start_request(DeprecatedString const& method, URL const& url, IPC::Dictionary const& request_headers, ByteBuffer const& request_body, Core::ProxyData const& proxy_data)
|
||||
Messages::RequestServer::StartRequestResponse ConnectionFromClient::start_request(DeprecatedString const& method, URL const& url, HashMap<DeprecatedString, DeprecatedString> const& request_headers, ByteBuffer const& request_body, Core::ProxyData const& proxy_data)
|
||||
{
|
||||
if (!url.is_valid()) {
|
||||
dbgln("StartRequest: Invalid URL requested: '{}'", url);
|
||||
|
@ -47,7 +47,7 @@ Messages::RequestServer::StartRequestResponse ConnectionFromClient::start_reques
|
|||
dbgln("StartRequest: No protocol handler for URL: '{}'", url);
|
||||
return { -1, Optional<IPC::File> {} };
|
||||
}
|
||||
auto request = protocol->start_request(*this, method, url, request_headers.entries(), request_body, proxy_data);
|
||||
auto request = protocol->start_request(*this, method, url, request_headers, request_body, proxy_data);
|
||||
if (!request) {
|
||||
dbgln("StartRequest: Protocol handler failed to start request: '{}'", url);
|
||||
return { -1, Optional<IPC::File> {} };
|
||||
|
@ -72,10 +72,7 @@ Messages::RequestServer::StopRequestResponse ConnectionFromClient::stop_request(
|
|||
|
||||
void ConnectionFromClient::did_receive_headers(Badge<Request>, Request& request)
|
||||
{
|
||||
IPC::Dictionary response_headers;
|
||||
for (auto& it : request.response_headers())
|
||||
response_headers.add(it.key, it.value);
|
||||
|
||||
auto response_headers = request.response_headers().clone().release_value_but_fixme_should_propagate_errors();
|
||||
async_headers_became_available(request.id(), move(response_headers), request.status_code());
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ private:
|
|||
explicit ConnectionFromClient(NonnullOwnPtr<Core::LocalSocket>);
|
||||
|
||||
virtual Messages::RequestServer::IsSupportedProtocolResponse is_supported_protocol(DeprecatedString const&) override;
|
||||
virtual Messages::RequestServer::StartRequestResponse start_request(DeprecatedString const&, URL const&, IPC::Dictionary const&, ByteBuffer const&, Core::ProxyData const&) override;
|
||||
virtual Messages::RequestServer::StartRequestResponse start_request(DeprecatedString const&, URL const&, HashMap<DeprecatedString, DeprecatedString> const&, ByteBuffer const&, Core::ProxyData const&) override;
|
||||
virtual Messages::RequestServer::StopRequestResponse stop_request(i32) override;
|
||||
virtual Messages::RequestServer::SetCertificateResponse set_certificate(i32, DeprecatedString const&, DeprecatedString const&) override;
|
||||
virtual void ensure_connection(URL const& url, ::RequestServer::CacheLevel const& cache_level) override;
|
||||
|
|
|
@ -4,7 +4,7 @@ endpoint RequestClient
|
|||
{
|
||||
request_progress(i32 request_id, Optional<u32> total_size, u32 downloaded_size) =|
|
||||
request_finished(i32 request_id, bool success, u32 total_size) =|
|
||||
headers_became_available(i32 request_id, IPC::Dictionary response_headers, Optional<u32> status_code) =|
|
||||
headers_became_available(i32 request_id, HashMap<DeprecatedString,DeprecatedString,CaseInsensitiveStringTraits> response_headers, Optional<u32> status_code) =|
|
||||
|
||||
// Certificate requests
|
||||
certificate_requested(i32 request_id) =|
|
||||
|
|
|
@ -6,7 +6,7 @@ endpoint RequestServer
|
|||
// Test if a specific protocol is supported, e.g "http"
|
||||
is_supported_protocol(DeprecatedString protocol) => (bool supported)
|
||||
|
||||
start_request(DeprecatedString method, URL url, IPC::Dictionary request_headers, ByteBuffer request_body, Core::ProxyData proxy_data) => (i32 request_id, Optional<IPC::File> response_fd)
|
||||
start_request(DeprecatedString method, URL url, HashMap<DeprecatedString,DeprecatedString> request_headers, ByteBuffer request_body, Core::ProxyData proxy_data) => (i32 request_id, Optional<IPC::File> response_fd)
|
||||
stop_request(i32 request_id) => (bool success)
|
||||
set_certificate(i32 request_id, DeprecatedString certificate, DeprecatedString key) => (bool success)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue