mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-07 21:59:54 +00: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:
parent
00070455fd
commit
cbfae97101
Notes:
github-actions[bot]
2025-11-27 02:23:46 +00:00
Author: https://github.com/trflynn89
Commit: cbfae97101
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6949
3 changed files with 28 additions and 1 deletions
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue