Fix rejecting invalid HTTP request starting with newlines #1110
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.
This changeset fixes rejecting invalid HTTP requests starting with empty newlines. This is part 13 of reviving Ratchet as discussed in #1054, unblocking more future progress.
The code in question hasn't been touched in a while. The idea is to start parsing HTTP headers when a double newline is encountered and the same logic should trigger if the buffer starts with a double newline. Accordingly, this will now properly reject such invalid requests and should not otherwise affect any valid HTTP requests. I've updated the tests to ensure this should not happen again. The test suite confirms this now has full test coverage and does not otherwise affect any of the existing tests.
Overall, this required quite a massive effort. If you want to support this project, please consider sponsoring @reactphp ❤️
Builds on top of #1092 and others, one step closer to reviving Ratchet as discussed in #1054
Resolves / closes #334