-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1606798 [wpt PR 21019] - HTTP: 0x00 in a header value, a=testonly
Automatic update from web-platform-tests HTTP: 0x00 in a header value Tests to complement those written in web-platform-tests/wpt#10424. -- wpt-commits: 38ecde806a5f1710d9e5beba700cef7352f7570e wpt-pr: 21019 UltraBlame original commit: 2df4f38122005c353cf34c665c293fcb975fbdb7
- Loading branch information
Showing
6 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
testing/web-platform/tests/fetch/h1-parsing/resources-with-0x00-in-header.window.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
async_test(t => { | ||
const script = document.createElement("script"); | ||
t.add_cleanup(() => script.remove()); | ||
script.src = "resources/script-with-0x00-in-header.py"; | ||
script.onerror = t.step_func_done(); | ||
script.onload = t.unreached_func(); | ||
document.body.append(script); | ||
}, "Expect network error for script with 0x00 in a header"); | ||
|
||
async_test(t => { | ||
const frame = document.createElement("iframe"); | ||
t.add_cleanup(() => frame.remove()); | ||
frame.src = "resources/document-with-0x00-in-header.py"; | ||
|
||
|
||
|
||
t.step_timeout(() => { | ||
assert_equals(frame.contentDocument, null); | ||
t.done(); | ||
}, 1000); | ||
document.body.append(frame); | ||
}, "Expect network error for frame navigation to resource with 0x00 in a header"); | ||
|
||
async_test(t => { | ||
const img = document.createElement("img"); | ||
t.add_cleanup(() => img.remove()); | ||
img.src = "resources/blue-with-0x00-in-a-header.asis"; | ||
img.onerror = t.step_func_done(); | ||
img.onload = t.unreached_func(); | ||
document.body.append(img); | ||
}, "Expect network error for image with 0x00 in a header"); |
6 changes: 6 additions & 0 deletions
6
testing/web-platform/tests/fetch/h1-parsing/resources/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
`blue-with-0x00-in-a-header.asis` is a copy from `../../images/blue.png` with the following prepended using Control Pictures to signify actual newlines and 0x00: | ||
``` | ||
HTTP/1.1 200 AN IMAGE␍␊ | ||
Content-Type: image/png␍␊ | ||
Custom: ␀␍␊␍␊ | ||
``` |
Binary file added
BIN
+546 Bytes
testing/web-platform/tests/fetch/h1-parsing/resources/blue-with-0x00-in-a-header.asis
Binary file not shown.
4 changes: 4 additions & 0 deletions
4
testing/web-platform/tests/fetch/h1-parsing/resources/document-with-0x00-in-header.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
def main(request, response): | ||
response.headers.set("Content-Type", "text/html") | ||
response.headers.set("Custom", "\0") | ||
return "<!doctype html><b>This is a document.</b>" |
4 changes: 4 additions & 0 deletions
4
testing/web-platform/tests/fetch/h1-parsing/resources/script-with-0x00-in-header.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
def main(request, response): | ||
response.headers.set("Content-Type", "text/javascript") | ||
response.headers.set("Custom", "\0") | ||
return "var thisIsJavaScript = 0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters