Tests for HTTP/1.1 Parsing (NUL, CR, LF, Colon and more) #50629
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Parsing (invalid) HTTP/1.1 responses is not fully defined in HTTP and Fetch and browser behavior diverges from the specs and between different browsers and there are not many tests in WPT yet. The aim of this pull request is to document the current browser behavior for various edge cases and start standardizing edge case behavior.
This pull requests adds a bunch of tests for (invalid) HTTP/1.1 responses for various edge cases. The tests are marked as tentative.
The tests are about the general parsing of (invalid) HTTP/1.1 messages and are not about the parsing of individual (invalid) headers such as how browsers should handle invalid bytes in CSP headers (Pull Request for that here).
All tests use the following base response and inject various bytes in different places to test both
status-line
andheader-line
parsing.There are two types of tests:
fetch tests
: they fetch the resource and either fail (Network Error
) or fetch the resource (Valid
)framing tests
: they frame the resource in an IFrame. They can result inNetwork Error
(browser renders an error frame),active-XFO
(browser renders an error frame due to XFO), or render the iframe (no-XFO
, either the value is invalid or the full header line containing XFO is ignored). Note that the tests currently do not distinguish betweenNetwork Error
andactive-XFO
.The following shows all the injection points and their names:
The following bytes are injected:
LF, CR, HTAB, SP, NUL, COLON
.The expected behavior is described in a mapping:
Currently, there are 102*2=204 tests. In the future, other characters could be injected or other tests can be added.
The initial expected mapping is strict and expects "Network Error" for almost everything that is not explicitly allowed.
The current results are (both on HTTP and HTTPS):
See also: