-
Notifications
You must be signed in to change notification settings - Fork 17
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
Fix Malformed header bug #34
Conversation
this.buffer = lines[i]; | ||
modded = true; | ||
break; | ||
if (h) { |
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.
What was the intention of this rewrite?
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.
I think this is the patch?
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.
Do you see a potential regression?
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.
I don't understand neither the original code, nor the fix, which is why the change makes me pause. I guess I would need to reread carefully both the original and the change, to fully understand what is happening in both scenarios.
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.
https://www.rfc-editor.org/rfc/rfc2616#section-2.2
HTTP/1.1 header field values can be folded onto multiple lines if the
continuation line begins with a space or horizontal tab. All linear
white space, including folding, has the same semantics as SP. A
recipient MAY replace any linear white space with a single SP before
interpreting the field value or forwarding the message downstream.
And for this part there is the test "Folded values" in "dicer-headerparser". If it was wrong the test there would fail.
What is the perf impact of this change? |
No impact on performance
|
This adapts the bugfix and improvements from @RolandHeinze
mscdex/dicer#22
To see that the bug exists you have to checkout the commit "fix malformed header bug, red phase", which is prepatched phase with added unit test.
Afterwards the above patch was adapted to the codebase in "fix malformed header bug, green phase". The unit test is then green.
Checklist
npm run test
andnpm run benchmark
and the Code of conduct