Skip to content

asynchttpserver: Don't throw IndexDefect on malformed HTTP protocol#25568

Open
hourianto wants to merge 1 commit intonim-lang:develfrom
hourianto:fix-asynchttpserver-parseprotocol-crash
Open

asynchttpserver: Don't throw IndexDefect on malformed HTTP protocol#25568
hourianto wants to merge 1 commit intonim-lang:develfrom
hourianto:fix-asynchttpserver-parseprotocol-crash

Conversation

@hourianto
Copy link
Contributor

@hourianto hourianto commented Mar 2, 2026

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.1 are 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.

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.
@Araq
Copy link
Member

Araq commented Mar 4, 2026

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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants