mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 09:45:06 +02:00
The Fetch spec defines HTTP whitespace as tab, LF, CR, and space. Previously, trim_whitespace was also stripping vertical tab (U+000B) and form feed (U+000C), which are not HTTP whitespace characters. Switch to HTTP::normalize_header_value which matches the fetch definition. Fixes 4 subtests for WPT test: https://wpt.live/cors/origin.htm
27 lines
913 B
HTML
27 lines
913 B
HTML
<!DOCTYPE html>
|
|
<script src="../include.js"></script>
|
|
<script>
|
|
promiseTest(async () => {
|
|
try {
|
|
const httpServer = httpTestServer();
|
|
const url = await httpServer.createEcho("GET", `/header-whitespace-normalization`, {
|
|
status: 200,
|
|
headers: {
|
|
"Access-Control-Allow-Origin": "*",
|
|
"Access-Control-Expose-Headers": "X-Test-Header",
|
|
"X-Test-Header": '\u000B' + "hello" + '\u000C',
|
|
},
|
|
});
|
|
const resp = await fetch(url);
|
|
const value = resp.headers.get("X-Test-Header");
|
|
if (value !== '\u000Bhello\u000C') {
|
|
println("FAIL - got: " + JSON.stringify(value));
|
|
return;
|
|
}
|
|
println("PASS");
|
|
} catch (err) {
|
|
println("FAIL - " + err);
|
|
}
|
|
});
|
|
</script>
|