-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HTTP/1 parsing of responses without newlines after headers
For whatwg/fetch#472.
- Loading branch information
Showing
2 changed files
with
19 additions
and
0 deletions.
There are no files selected for viewing
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,16 @@ | ||
// This only tests headers without a single newline after them for now. | ||
// See https://github.com/whatwg/fetch/issues/472 for context. | ||
|
||
const statusLine = "HTTP/1.1 200 OKAYISH\n"; | ||
|
||
[ | ||
"header: value\t", | ||
"header: value ", | ||
"header: value\f", | ||
"header: value\r" | ||
].forEach(input => { | ||
promise_test(t => { | ||
const message = encodeURIComponent(statusLine + input) | ||
return promise_rejects_js(t, TypeError, fetch(`resources/message.py?message=${message}`)); | ||
}, `Parsing response without trailing newline (${input})`); | ||
}); |
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,3 @@ | ||
def main(request, response): | ||
response.writer.write(request.GET.first(b"message")) | ||
response.close_connection = True |