mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:37:35 +00:00
LibWeb: Trim leading and trailing HTTP whitespace bytes
The XMLHttpRequest specification specifices that header values should be normalized by trimming leading and trailing HTTP whitespace bytes.
This commit is contained in:
parent
fccea8888e
commit
1ca1a73d67
2 changed files with 3 additions and 2 deletions
|
@ -406,8 +406,7 @@ static String normalize_method(String const& method)
|
|||
// https://fetch.spec.whatwg.org/#concept-header-value-normalize
|
||||
static String normalize_header_value(String const& header_value)
|
||||
{
|
||||
// FIXME: I'm not sure if this is the right trim, it should only be HTML whitespace bytes.
|
||||
return header_value.trim_whitespace();
|
||||
return header_value.trim(StringView { http_whitespace_bytes });
|
||||
}
|
||||
|
||||
// https://xhr.spec.whatwg.org/#dom-xmlhttprequest-setrequestheader
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
namespace Web::XHR {
|
||||
|
||||
static constexpr Array<u8, 4> http_whitespace_bytes = { '\t', '\n', '\r', ' ' };
|
||||
|
||||
class XMLHttpRequest final
|
||||
: public RefCounted<XMLHttpRequest>
|
||||
, public Weakable<XMLHttpRequest>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue