Skip to content

Normalize multiple Transfer-Encoding headers before chunked detection#12465

Open
jmestwa-coder wants to merge 1 commit intoaio-libs:masterfrom
jmestwa-coder:normalize-transfer-encoding-headers
Open

Normalize multiple Transfer-Encoding headers before chunked detection#12465
jmestwa-coder wants to merge 1 commit intoaio-libs:masterfrom
jmestwa-coder:normalize-transfer-encoding-headers

Conversation

@jmestwa-coder
Copy link
Copy Markdown
Contributor

Summary

Normalize multiple Transfer-Encoding headers into a single comma-separated value before chunked detection.


Motivation

RFC 9110 §5.3 defines that multiple header fields are equivalent to a single comma-separated value. This makes the parser behavior explicit and consistent with the RFC.


Changes

  • Use headers.getall(...) for Transfer-Encoding
  • Join values before evaluating chunked encoding
  • No change to existing parsing logic

Test

Add test covering split Transfer-Encoding headers (gzip + chunked) and verifying correct parsing of multiple responses.


What do these changes do?

Normalize multiple Transfer-Encoding headers into a single comma-separated value before evaluating chunked encoding, in line with RFC 9110 §5.3.


Are there changes in behavior for the user?

No.
This makes header handling explicit and consistent without changing observable behavior.


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

No.
The change is small, self-contained, and limited to parsing normalization. It does not introduce new APIs or complexity.


Related issue number

N/A


Checklist

  • I think the code is well written
  • Unit tests for the changes exist
  • Documentation reflects the changes
  • If you provide code modification, please add yourself to CONTRIBUTORS.txt
  • Add a new news fragment into the CHANGES/ folder (.misc)

@jmestwa-coder jmestwa-coder requested a review from asvetlov as a code owner May 5, 2026 15:36
@jmestwa-coder jmestwa-coder force-pushed the normalize-transfer-encoding-headers branch from 2d5b4d4 to 1998286 Compare May 5, 2026 15:37
@codecov
Copy link
Copy Markdown

codecov Bot commented May 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.92%. Comparing base (0471d65) to head (1998286).
⚠️ Report is 2 commits behind head on master.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #12465   +/-   ##
=======================================
  Coverage   98.92%   98.92%           
=======================================
  Files         134      134           
  Lines       46750    46759    +9     
  Branches     2429     2429           
=======================================
+ Hits        46248    46257    +9     
  Misses        373      373           
  Partials      129      129           
Flag Coverage Δ
CI-GHA 98.98% <100.00%> (+<0.01%) ⬆️
OS-Linux 98.72% <100.00%> (-0.01%) ⬇️
OS-Windows 96.98% <100.00%> (+<0.01%) ⬆️
OS-macOS 97.89% <100.00%> (+<0.01%) ⬆️
Py-3.10.11 97.39% <100.00%> (+<0.01%) ⬆️
Py-3.10.20 97.86% <100.00%> (+<0.01%) ⬆️
Py-3.11.15 98.12% <100.00%> (+<0.01%) ⬆️
Py-3.11.9 97.65% <100.00%> (+<0.01%) ⬆️
Py-3.12.10 97.73% <100.00%> (+<0.01%) ⬆️
Py-3.12.13 98.20% <100.00%> (+<0.01%) ⬆️
Py-3.13.13 98.45% <100.00%> (+<0.01%) ⬆️
Py-3.14.4 98.50% <100.00%> (-0.01%) ⬇️
Py-3.14.4t 97.52% <100.00%> (+<0.01%) ⬆️
Py-pypy3.11.15-7.3.21 97.35% <100.00%> (+<0.01%) ⬆️
VM-macos 97.89% <100.00%> (+<0.01%) ⬆️
VM-ubuntu 98.72% <100.00%> (-0.01%) ⬇️
VM-windows 96.98% <100.00%> (+<0.01%) ⬆️
cython-coverage 38.09% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented May 5, 2026

Merging this PR will not alter performance

✅ 67 untouched benchmarks
⏩ 4 skipped benchmarks1


Comparing jmestwa-coder:normalize-transfer-encoding-headers (1998286) with master (0471d65)2

Open in CodSpeed

Footnotes

  1. 4 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

  2. No successful run was found on master (0f0b0e5) during the generation of this report, so 0471d65 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant