mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 20:15:17 +00:00
LibWeb: Only inject "User-Agent"/"Accept" headers when they're missing
...otherwise we send out HTTP requests with duplicates of these headers.
This commit is contained in:
parent
bd16648b71
commit
847243b706
Notes:
sideshowbarker
2024-07-17 06:28:38 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/LadybirdBrowser/ladybird/commit/847243b706
1 changed files with 6 additions and 2 deletions
|
@ -494,13 +494,17 @@ RefPtr<ResourceLoaderConnectorRequest> ResourceLoader::start_network_request(Loa
|
|||
auto proxy = ProxyMappings::the().proxy_for_url(request.url());
|
||||
|
||||
HTTP::HeaderMap headers;
|
||||
headers.set("User-Agent", m_user_agent.to_byte_string());
|
||||
headers.set("Accept-Encoding", "gzip, deflate, br");
|
||||
|
||||
for (auto const& it : request.headers()) {
|
||||
headers.set(it.key, it.value);
|
||||
}
|
||||
|
||||
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);
|
||||
|
|
Loading…
Add table
Reference in a new issue