Skip to content

Preserve folded request header values - #897

Open
Aschenbath wants to merge 1 commit into
cherrypy:mainfrom
Aschenbath:fix/preserve-folded-header-values-726
Open

Aschenbath wants to merge 1 commit into
cherrypy:mainfrom
Aschenbath:fix/preserve-folded-header-values-726

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?

Join header continuation lines with spaces. Previously, ordinary headers lost all but the last line, while list-valued headers gained commas between continuation lines. Repeated header fields retain their existing behavior.

Are there changes in behavior for the user?

Test: a\r\n b\r\n c now reaches the application as a b c, as permitted by RFC 9112 section 5.2. The same unfolding applies to list-valued headers such as Accept.

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

The change uses the existing header parsing path. Eight real-socket cases cover whitespace, multiple continuation lines, empty initial values and repeated fields. Five fail on the unmodified code; all eight pass with the fix.

Full tox tests on Windows/Python 3.12: 208 passed, 11 existing skips, 4 existing expected failures and one existing TLS client-auth error-text failure. All applicable pre-commit hooks passed; tox's existing reporting snippets fail on unescaped Windows paths. No checks were relaxed.

AI assistance: Codex implemented and tested this change locally.

Related issue number

Fixes #726.

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

Continuation lines currently overwrite earlier values for ordinary
headers and add commas to list-valued headers. Joining continuations
with spaces preserves the field value while keeping repeated fields
subject to the existing header rules.

Real socket tests cover spaces, tabs, multiple lines, empty initial
values, and repeated fields. Five cases fail without the change.

Fixes cherrypy#726

Assisted-by: LLM
@agentscanapp

agentscanapp Bot commented Nov 21, 2026

Copy link
Copy Markdown

Automation signals

Activity patterns show signs of automation.

View full analysis →

Evidence
  • Very many forks in one day: 36 repositories forked within 24 hours
  • PRs to many projects in one day: Opened PRs in 48 different repos within 24 hours
  • Very high PR volume (weekly): 129 PRs within a single 7-day window, 2 of them to repos it can push to
  • Very high PR volume (daily): 82 PRs within a single 24-hour window
  • Fork branch then PR within seconds: 42 fork branches followed by upstream PRs within 80s, out of 55 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 21, 2026
@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 cheroot | 🛠️ Build #36064070 | 📁 Comparing bb9787f against latest (468fe5c)

  🔍 Preview build  

5 files changed · + 1 added · ± 4 modified

+ Added

± Modified

@codecov

codecov Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.20%. Comparing base (468fe5c) to head (bb9787f).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #897      +/-   ##
==========================================
+ Coverage   75.95%   76.20%   +0.25%     
==========================================
  Files          41       42       +1     
  Lines        4932     4960      +28     
  Branches      561      562       +1     
==========================================
+ Hits         3746     3780      +34     
+ Misses       1046     1043       -3     
+ Partials      140      137       -3     

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 clobbers previous lines' values during field line folding

1 participant