Skip to content

catch Defect in asynchttpserver for bad http request#25820

Open
YesDrX wants to merge 2 commits into
nim-lang:develfrom
YesDrX:fix_asynchttpserver_crash
Open

catch Defect in asynchttpserver for bad http request#25820
YesDrX wants to merge 2 commits into
nim-lang:develfrom
YesDrX:fix_asynchttpserver_crash

Conversation

@YesDrX
Copy link
Copy Markdown

@YesDrX YesDrX commented May 16, 2026

@tersec
Copy link
Copy Markdown
Contributor

tersec commented May 17, 2026

Is catching Defect necessarily well-defined?

Presumably some other code in this scenario is triggering the issue and that could/should be fixed, minimally, in addition.

This is a workaround of what appears to be some real underlying issue.

For example, parseProtocol should not trigger such an issue, and this doesn't address that at all.

@ringabout
Copy link
Copy Markdown
Member

related to #25568

@YesDrX
Copy link
Copy Markdown
Author

YesDrX commented May 17, 2026

changed to raise ValueError inside parseProtocol rather than catch Defect

 [OK]    valid HTTP/1.1 → (1, 1)
 [OK]    valid HTTP/1.0 → (1, 0)
 [OK]    valid HTTP/2 → (2, 0)
 [OK]    valid HTTP/2.0 → (2, 0)
 [OK]    valid HTTP/3 → (3, 0)
 [OK]    garbage prefix → ValueError (as expected)
 [OK]    empty string → ValueError (as expected)
 [OK]    HTTP/ only (THE CRASH) → ValueError (as expected)
 [OK]    HTTP/1 (no dot) → (1, 0)
 [OK]    HTTP/. (dot only) → ValueError (as expected)
 [OK]    HTTP/1. (no minor) → ValueError (as expected)
 [OK]    HTTP// (double slash) → ValueError (as expected)

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.

3 participants