LibWeb/XHR: Use normalized header value when validating contents

This was not matching specification and caused valid requests to be
rejected.
This commit is contained in:
rmg-x 2024-11-19 16:55:56 -06:00 committed by Tim Ledbetter
parent 4e48298414
commit 84f673515b
Notes: github-actions[bot] 2024-11-21 00:59:06 +00:00

View file

@ -433,7 +433,7 @@ WebIDL::ExceptionOr<void> XMLHttpRequest::set_request_header(String const& name_
// 4. If name is not a header name or value is not a header value, then throw a "SyntaxError" DOMException.
if (!Fetch::Infrastructure::is_header_name(name))
return WebIDL::SyntaxError::create(realm, "Header name contains invalid characters."_string);
if (!Fetch::Infrastructure::is_header_value(value))
if (!Fetch::Infrastructure::is_header_value(normalized_value))
return WebIDL::SyntaxError::create(realm, "Header value contains invalid characters."_string);
auto header = Fetch::Infrastructure::Header {