mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-03 07:07:23 +00:00
LibWeb/Fetch: Refactor forbidden request-headers
This is a change in the Fetch spec. See: - https://github.com/whatwg/fetch/commit/92e6c91 - https://github.com/whatwg/xhr/commit/494431a
This commit is contained in:
@@ -310,15 +310,16 @@ WebIDL::ExceptionOr<void> XMLHttpRequest::set_request_header(DeprecatedString co
|
||||
if (!Fetch::Infrastructure::is_header_value(value))
|
||||
return WebIDL::SyntaxError::create(realm, "Header value contains invalid characters.");
|
||||
|
||||
// 5. If name is a forbidden header name, then return.
|
||||
if (Fetch::Infrastructure::is_forbidden_header_name(name))
|
||||
return {};
|
||||
|
||||
// 6. Combine (name, value) in this’s author request headers.
|
||||
auto header = Fetch::Infrastructure::Header {
|
||||
.name = move(name),
|
||||
.value = move(value),
|
||||
};
|
||||
|
||||
// 5. If (name, value) is a forbidden request-header, then return.
|
||||
if (TRY_OR_RETURN_OOM(realm, Fetch::Infrastructure::is_forbidden_request_header(header)))
|
||||
return {};
|
||||
|
||||
// 6. Combine (name, value) in this’s author request headers.
|
||||
TRY_OR_RETURN_OOM(realm, m_author_request_headers->combine(move(header)));
|
||||
|
||||
return {};
|
||||
|
||||
Reference in New Issue
Block a user