Respond 400 instead of 500 when first header field line starts with SP or HTAB#729
Respond 400 instead of 500 when first header field line starts with SP or HTAB#729kenballus wants to merge 2 commits into
Conversation
bd642f1 to
3fa1439
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #729 +/- ##
==========================================
- Coverage 78.32% 78.20% -0.12%
==========================================
Files 41 41
Lines 4788 4800 +12
Branches 547 548 +1
==========================================
+ Hits 3750 3754 +4
- Misses 900 905 +5
- Partials 138 141 +3 |
6778ce9 to
0889b8b
Compare
avinashkamat48
left a comment
There was a problem hiding this comment.
The functional change here is hard to review because the PR also reformats a large part of the project from double quotes to single quotes. The title describes a specific HTTP parser behavior change, but the diff includes 30+ files and roughly 1.5k lines of formatting churn, which makes it easy to miss the actual 400-vs-500 logic and creates avoidable merge/blame noise. Could the formatting-only changes be split out or reverted in this PR so the behavioral fix and its tests are reviewable on their own?
I didn't do this; it's the CI. My original change was just a simple patch, but this commit, which was automatically generated by the CI, added all this bs on top. |
When the first header field line begins with whitespace, cheroot responds 500 due to an UnboundLocalError. This patch checks that at least one header key has been received before processing folded lines.
for more information, see https://pre-commit.ci
|
I've updated the PR to apply cleanly again. |
❓ What kind of change does this PR introduce?
📋 What is the related issue number (starting with
#)#728
❓ What is the current behavior? (You can also link to an open issue here)
Cheroot responds 500 when it receives a request in which the first header field line starts with SP or HTAB, due to an
UnboundLocalError.❓ What is the new behavior (if this is a feature change)?
It responds 400 instead.
📋 Contribution checklist:
(If you're a first-timer, check out
this guide on making great pull requests)
the changes have been approved
and description in grammatically correct, complete sentences
This change is