Fix Malformed header bug#34
Fix Malformed header bug#34kibertoad merged 6 commits intofastify:masterfrom Uzlopak:malformed-payload-bug
Conversation
| this.buffer = lines[i]; | ||
| modded = true; | ||
| break; | ||
| if (h) { |
There was a problem hiding this comment.
What was the intention of this rewrite?
There was a problem hiding this comment.
I think this is the patch?
There was a problem hiding this comment.
Do you see a potential regression?
There was a problem hiding this comment.
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.
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 testandnpm run benchmarkand the Code of conduct