-
Notifications
You must be signed in to change notification settings - Fork 195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
http: validate HTTP version #157
Conversation
@indutny Any input on this? Does it look fine to you? |
Why not check the major and minor after the parse is complete? |
Well, I would say to allow to save some bytes to read and close the bad socket ASAP. |
Yes, you can do that during on_status or on_status_complete. Maybe it's worth adding an on_version_complete callback? I just worry that someone is using a non-standard major/minor for something and this would break that. |
Ok, let me think about it and eventually restructured this! |
d245a5f
to
2101d70
Compare
I followed a slightly different approach without using callbacks. How does it look now? About people using invalid |
So this parser is used for protocols other than basic HTTP, which is why there are a set of methods for RTSP, ICE, &c. If you really want to validate 0.9,1.0,1.1,1.2,2.0, could you please add a |
Well, it was reported in Node for security issue. Adding a new lenient flag will not be a problem, I'll have it ready on Monday! |
Sure, maybe it is a security problem, but it's not a problem in the parser, it's a problem in the application calling the parser. |
That's a fair point and I kinda agree. |
Lenient flag added! |
@indutny What do you think of the approach for checking the version? Is there any other way? |
I feel like @pallas has a point. The parser supports multiple protocols and extensions and while we should make the core secure, the version checking sounds like it should be at the very least behind lenient flags. |
Nevermind. I misread. |
fcf2212
to
41b999d
Compare
I have updated the PR to solve merge conflicts. |
41b999d
to
848c4db
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
@indutny What is your take on this? Can we merge it? |
For the semantics of these new flags, see * nodejs/llhttp#161 Chunked transfer encoding * nodejs/llhttp#157 http: validate HTTP version
Fixes nodejs/node#43115 on Node 16+.