Range header issues
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 28/100
- Issue type
- Refactor
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- rust
- Domain
- networking
Research direction
Start with the Range header implementation and its Range::bytes and satisfiable_ranges entry points. Review the proposed ByteRangeSpec representation, iterator construction, collection-backed storage, and unknown-resource-size behavior; done means all four listed issues are addressed consistently.
Written by the indexing model from the issue text.
Description
The Range header is one of the least useful header types in this library. Most of these problems stem from the fact that it contains only a string HeaderValue, instead of a parsed representation of the Range.
-
The internal representation of range endpoints passed to
bytesand returned fromsatisfiable_rangesisBound<u64>. But this is a very poor fit, because it suggests in the return type thatBound::Excludedwould be a valid value to use in aRangeheader, when it is actually never possible for it to appear.headersshould re-introduce theByteRangeSpecenum to encode the three valid cases for theRangeheader. -
Range::bytesallows construction from a singleimpl RangeBounds<u64>.Rangeshould be extended to allow construction fromimpl Iterator<ByteRangeSpec>. -
The internal representation of a
Rangeis a string cloned from theHeaderValuepassed todecode. It should instead be a collection ofByteRanges, perhaps aSmallVec<[ByteRangeSpec; 1]>since the expected case is that there will only be one range (multipart ranges are generally uncommon).If you are constructing or parsing this header, it is expected that you are going to access the fields, so the extra memory overhead of doing so is explicitly necessary. And the type already clones the string header value! Doing the SmallVec optimization would reduce the number of allocations by 1 for the typical case.
-
satisfiable_rangesassumes the caller will know the size of the resource being fetched. It may not, in which case passingu64::MAXwill return nonsense results when a suffix range is parsed.
- Dominant language
- Rust
- Stars
- 200
- Forks
- 107
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from hyperium/headers
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
-
Difficulty 3/5 1-2 days Newbie friendliness 78/100
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
Link support Open
Difficulty 4/5 3-5 days Newbie friendliness 38/100
All issues in hyperium/headers
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
issue
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
agentic-workflows
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
web-infra-dev/rspack#15847 ·