LibWeb+RequestServer: Let RequestServer set HTTP Accept-Encoding header
Ultimately it's RequestServer who knows which kind of encodings it can handle and decompress, so let's have it set the Accept-Encoding.
This commit is contained in:
parent
bfc9dc447f
commit
2c918b540d
Notes:
sideshowbarker
2024-07-17 03:35:16 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/LadybirdBrowser/ladybird/commit/2c918b540d Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/658 Reviewed-by: https://github.com/alimpfard ✅
2 changed files with 5 additions and 4 deletions
|
@ -499,9 +499,6 @@ RefPtr<ResourceLoaderConnectorRequest> ResourceLoader::start_network_request(Loa
|
|||
if (!headers.contains("User-Agent"))
|
||||
headers.set("User-Agent", m_user_agent.to_byte_string());
|
||||
|
||||
if (!headers.contains("Accept-Encoding"))
|
||||
headers.set("Accept-Encoding", "gzip, deflate, br");
|
||||
|
||||
auto protocol_request = m_connector->start_request(request.method(), request.url(), headers, request.body(), proxy);
|
||||
if (!protocol_request) {
|
||||
log_failure(request, "Failed to initiate load"sv);
|
||||
|
|
|
@ -205,11 +205,15 @@ void ConnectionFromClient::start_request(i32 request_id, ByteString const& metho
|
|||
return;
|
||||
}
|
||||
|
||||
auto headers = request_headers;
|
||||
if (!headers.contains("Accept-Encoding"))
|
||||
headers.set("Accept-Encoding", "gzip, deflate, br");
|
||||
|
||||
enqueue(StartRequest {
|
||||
.request_id = request_id,
|
||||
.method = method,
|
||||
.url = url,
|
||||
.request_headers = request_headers,
|
||||
.request_headers = move(headers),
|
||||
.request_body = request_body,
|
||||
.proxy_data = proxy_data,
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue