From 84f673515bd76415788e613cc5f882663e03aabd Mon Sep 17 00:00:00 2001 From: rmg-x Date: Tue, 19 Nov 2024 16:55:56 -0600 Subject: [PATCH] LibWeb/XHR: Use normalized header value when validating contents This was not matching specification and caused valid requests to be rejected. --- Libraries/LibWeb/XHR/XMLHttpRequest.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Libraries/LibWeb/XHR/XMLHttpRequest.cpp b/Libraries/LibWeb/XHR/XMLHttpRequest.cpp index e0b3c127273..fd84dbf9a6f 100644 --- a/Libraries/LibWeb/XHR/XMLHttpRequest.cpp +++ b/Libraries/LibWeb/XHR/XMLHttpRequest.cpp @@ -433,7 +433,7 @@ WebIDL::ExceptionOr 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 {