Skip to content

Commit

Permalink
Trim header values in GetResponseHeader
Browse files Browse the repository at this point in the history
Fixes #24917
  • Loading branch information
Eijebong committed Nov 30, 2019
1 parent f9c69e8 commit a91176e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
6 changes: 4 additions & 2 deletions components/script/dom/xmlhttprequest.rs
Expand Up @@ -783,8 +783,10 @@ impl XMLHttpRequestMethods for XMLHttpRequest {
if !first {
vec.extend(", ".as_bytes());
}
first = false;
vec.extend(value.as_bytes());
if let Ok(v) = str::from_utf8(value.as_bytes()).map(|s| s.trim().as_bytes()) {
vec.extend(v);
first = false;
}
vec
});

Expand Down
12 changes: 0 additions & 12 deletions tests/wpt/metadata/xhr/headers-normalize-response.htm.ini
Expand Up @@ -6,15 +6,3 @@
[Header value: \\0hello_world]
expected: FAIL

[Header value: hello_world[tab\]]
expected: FAIL

[Header value: [tab\]hello_world[tab\]]
expected: FAIL

[Header value: hello_world__]
expected: FAIL

[Header value: __hello_world__]
expected: FAIL

0 comments on commit a91176e

Please sign in to comment.