mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-26 03:09:08 +00:00
LibWeb: Avoid re-encoding response headers
isomorphic encoding a value that has already been encoded will result in garbage data. `response_headers` is already encoded in ISO-8859-1/latin1, we cannot use `from_string_pair`, as it triggers ISO-8859-1/latin1 encoding. Follow-up of https://github.com/LadybirdBrowser/ladybird/pull/1893
This commit is contained in:
committed by
Jelle Raaijmakers
parent
3063be11a9
commit
e0c0668f3d
@@ -2330,7 +2330,7 @@ WebIDL::ExceptionOr<GC::Ref<PendingResponse>> nonstandard_resource_loader_file_o
|
||||
}
|
||||
|
||||
for (auto const& [name, value] : response_headers.headers()) {
|
||||
auto header = Infrastructure::Header::from_string_pair(name, value);
|
||||
auto header = Infrastructure::Header::from_latin1_pair(name, value);
|
||||
response->header_list()->append(move(header));
|
||||
}
|
||||
|
||||
@@ -2396,7 +2396,7 @@ WebIDL::ExceptionOr<GC::Ref<PendingResponse>> nonstandard_resource_loader_file_o
|
||||
response->set_status(status_code.value_or(200));
|
||||
response->set_body(move(body));
|
||||
for (auto const& [name, value] : response_headers.headers()) {
|
||||
auto header = Infrastructure::Header::from_string_pair(name, value);
|
||||
auto header = Infrastructure::Header::from_latin1_pair(name, value);
|
||||
response->header_list()->append(move(header));
|
||||
}
|
||||
|
||||
@@ -2421,7 +2421,7 @@ WebIDL::ExceptionOr<GC::Ref<PendingResponse>> nonstandard_resource_loader_file_o
|
||||
auto [body, _] = TRY_OR_IGNORE(extract_body(realm, data));
|
||||
response->set_body(move(body));
|
||||
for (auto const& [name, value] : response_headers.headers()) {
|
||||
auto header = Infrastructure::Header::from_string_pair(name, value);
|
||||
auto header = Infrastructure::Header::from_latin1_pair(name, value);
|
||||
response->header_list()->append(move(header));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user