asynchttpserver: Don't throw IndexDefect on malformed HTTP protocol#25568
Open
hourianto wants to merge 1 commit intonim-lang:develfrom
Open
asynchttpserver: Don't throw IndexDefect on malformed HTTP protocol#25568hourianto wants to merge 1 commit intonim-lang:develfrom
IndexDefect on malformed HTTP protocol#25568hourianto wants to merge 1 commit intonim-lang:develfrom
Conversation
Validate HTTP version tokens in parseProtocol and return 400 for malformed forms instead of triggering a defect. Add wire-level regression coverage for malformed protocol variants in tasynchttpserver.
Member
|
So where did it throw the IndexDefect before and why can't you fix that without rewriting the logic. Ignoring the wrong HTTP version is safer than adding more exception paths... |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
While the docs indicate this module isn't intended for production use, it's still relied upon in real-world software (a recent example: nserve, among others).
Found and fixed with GPT-5.3 Codex. Will be opening additional PRs to address some unexpected crashes in the other HTTP-related modules (such as httpclient) as well.
One remaining edge case: extremely large version numbers like
HTTP/99999999999999999999999999999999999.1are still parsed and passed through to the handler. Oped not to fix this here since it would complicate the procedure further, and it doesn't actually crash.