Skip to content

Reject whitespace after HTTP request versions - #893

Open
Aschenbath wants to merge 1 commit into
cherrypy:mainfrom
Aschenbath:fix/reject-request-line-trailing-whitespace-717
Open

Aschenbath wants to merge 1 commit into
cherrypy:mainfrom
Aschenbath:fix/reject-request-line-trailing-whitespace-717

Conversation

@Aschenbath

Copy link
Copy Markdown

What kind of change does this PR introduce?

  • 🐞 bug fix
  • 🐣 feature
  • 📋 docs update
  • 📋 tests/coverage improvement
  • 📋 refactoring
  • 💥 other

What do these changes do?

Preserve request-line whitespace while splitting off CRLF, then reject whitespace after the HTTP version. Previously, stripping the complete line accepted inputs such as GET / HTTP/1.1 <CRLF>. The explicit check also prevents integer conversion from accepting trailing whitespace.

Are there changes in behavior for the user?

Malformed request lines receive 400 Bad Request before version negotiation. Valid HTTP/1.0 and HTTP/1.1 requests remain supported; an otherwise valid unsupported version still receives 505.

Is it a substantial burden for the maintainers to support this?

This is a local parsing check with eleven real-socket regression cases. Eight fail before the fix; all eleven pass in the full suite after it.

Validation through tox on Windows/Python 3.12: 211 passed, 11 existing skips, 4 existing expected failures, and one TLS client-auth error-text failure. The TLS error-text failure category was also reproduced on unmodified server.py. All applicable pre-commit hooks passed; the existing tox reporting snippets fail afterward on unescaped Windows paths. No checks were relaxed.

AI assistance: Codex implemented and tested this change locally.

Related issue number

Fixes #717.

Checklist

Tip

New to open source contributions? Making a lovely PR is a great read.

  • I wrote descriptive pull request text above
  • The PR relates to only one subject with a clear title
    and description in grammatically correct, complete sentences
  • I think the code is well written
  • Unit tests for the changes exist
  • Integration tests for the changes exist (if applicable)
  • I used the same coding conventions as the rest of the project
  • The new code doesn't generate linter offenses
  • Project documentation (in docs/) and inline docstrings reflect the changes
  • My commits each have a descriptive title and a body explaining the why
    (see good commit messages)
  • I have added a change log entry
    (can be done once the PR number is known; alternatively, you can
    use a related issue number if one exists)
  • I'm planning to squash related commits together before final merge
  • I have read the contribution guide and the
    code of conduct

The request-line grammar places CRLF directly after HTTP-version.
Stripping the entire line and letting int() trim its input accepts
extra whitespace, which can disagree with other HTTP recipients.

cherrypy#717

Assisted-by: LLM
@agentscanapp

agentscanapp Bot commented Nov 20, 2026

Copy link
Copy Markdown

Automation signals

Activity patterns show signs of automation.

View full analysis →

Evidence
  • Many forks in 2 days: 18 repositories forked within 2 days
  • High PR volume (weekly): 81 PRs within a single 7-day window, 10 of them to repos it can push to
  • Very high PR volume (daily): 31 PRs within a single 24-hour window, 2 of them to repos it can push to
  • Fork branch then PR within seconds: 31 fork branches followed by upstream PRs within 89s, out of 46 branches created in total

Last 5 PRs:

This is an automated analysis by AgentScan

@pyba-chronographer pyba-chronographer Bot added the bot:chronographer:provided A mark meaning that a new change log entry is present within the patch. label Nov 20, 2026
@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 cheroot | 🛠️ Build #36039532 | 📁 Comparing 92810ea against latest (e652c2a)

  🔍 Preview build  

5 files changed · + 1 added · ± 4 modified

+ Added

± Modified

@codecov

codecov Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.10%. Comparing base (e652c2a) to head (92810ea).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #893      +/-   ##
==========================================
- Coverage   76.11%   76.10%   -0.02%     
==========================================
  Files          41       42       +1     
  Lines        4932     4955      +23     
  Branches      561      561              
==========================================
+ Hits         3754     3771      +17     
- Misses       1040     1045       +5     
- Partials      138      139       +1     

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agentscan:automation-signals bot:chronographer:provided A mark meaning that a new change log entry is present within the patch.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cheroot incorrectly allows whitespace after HTTP versions

1 participant