mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-05 06:32:30 +02:00
LibWeb: Include empty header values when joining duplicated headers
Fixes a regression from commit:
f675cfe90f
It is not sufficient to only check if the builder is empty, as we will
then drop empty header values (when the first found value is empty).
This is tested in WPT by /cors/origin.htm, but that requires an HTTP
server.
This commit is contained in:
Notes:
github-actions[bot]
2025-11-27 02:23:46 +00:00
Author: https://github.com/trflynn89 Commit: https://github.com/LadybirdBrowser/ladybird/commit/cbfae97101e Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6949
@@ -86,14 +86,17 @@ Optional<ByteString> HeaderList::get(StringView name) const
|
||||
// 2. Return the values of all headers in list whose name is a byte-case-insensitive match for name, separated from
|
||||
// each other by 0x2C 0x20, in order.
|
||||
StringBuilder builder;
|
||||
bool first = true;
|
||||
|
||||
for (auto const& header : *this) {
|
||||
if (!header.name.equals_ignoring_ascii_case(name))
|
||||
continue;
|
||||
|
||||
if (!builder.is_empty())
|
||||
if (!first)
|
||||
builder.append(", "sv);
|
||||
|
||||
builder.append(header.value);
|
||||
first = false;
|
||||
}
|
||||
|
||||
return builder.to_byte_string();
|
||||
|
||||
Reference in New Issue
Block a user