{{ message }}
Repository navigation
[PR #13581/9c77642c backport][3.15] Accept case-insensitive range unit names in http_range - #13588
Merged
Dreamsorcerer merged 1 commit intoAug 31, 2026
Conversation
(cherry picked from commit 9c77642)
5 tasks done
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 3.15 #13588 +/- ##
==========================================
+ Coverage 96.19% 96.27% +0.07%
==========================================
Files 161 161
Lines 51905 51909 +4
Branches 2852 2852
==========================================
+ Hits 49932 49977 +45
+ Misses 1781 1752 -29
+ Partials 192 180 -12
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
Dreamsorcerer
deleted the
patchback/backports/3.15/9c77642ce54c836017961ff1908c3ff2dc934615/pr-13581
branch
August 31, 2026 00:43
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

This is a backport of PR #13581 as merged into master (9c77642).
What do these changes do?
BaseRequest.http_rangenow matches the range unit name case-insensitively (re.IGNORECASE), per RFC 9110 §14.1.1 ("All range unit names are case-insensitive").Previously a valid header like
Range: Bytes=0-499failed the^bytes=(\d*)-(\d*)$regex, raisingValueError("range not in acceptable format"), whichFileResponseconverts into416 Requested Range Not Satisfiable— even for a perfectly satisfiable range. Only lowercasebytes=worked.Are there changes in behavior for the user?
Yes, for the better: case variants of the range unit (
Bytes,BYTES,bYtEs, …) are now accepted and yield206 Partial Contentwhere lowercase already did. Behavior for lowercasebytes=and for genuinely malformed ranges (non-bytesunits, non-numeric bounds, multi-range, empty) is unchanged — those still raise the sameValueError.Is it a substantial burden for the maintainers to support this?
No. One regex flag; no API surface change; the pure-Python
http_rangeproperty is the only code path touched.FileResponseconsumes it, so the fix propagates automatically.Related issue number
Fixes #13580
Checklist
CONTRIBUTORS.txtCHANGES/folder<issue_or_pr_num>.<type>.rst(e.g.588.bugfix.rst).bugfix: A bug fix for something the maintainers deemed an improper undesired behavior that got corrected to match pre-agreed expectations.Test output
(10 of those are the
http_range/range parsing tests, including the newtest_range_to_slice_uppercase_unit.)End-to-end repro (local
web.FileResponseserver, raw TCP requests):Drafted with Hermes Agent (deepseek-v4-flash); reviewed by Manny7717.