Repository navigation
Allow ignoring unsupported multi-range requests - #727
Merged
jlizen merged 1 commit intoAug 24, 2026
Merged
Conversation
Add an opt-in for serving the full representation when a request contains multiple byte ranges. Keep the existing 416 behavior by default and strip representation headers from range errors. Fixes: tower-rs#725
jlizen
approved these changes
Aug 24, 2026
|
|
||
| /// Configure whether syntactically valid multi-range requests should be ignored. | ||
| /// | ||
| /// When enabled, a request containing multiple byte ranges is served as a normal full |
| .status(StatusCode::RANGE_NOT_SATISFIABLE) | ||
| .body(empty_body()) | ||
| .unwrap(); | ||
| response.headers_mut().remove(header::CONTENT_TYPE); |
1 task done
markharding
pushed a commit
to futo-org/Harbor
that referenced
this pull request
Oct 13, 2026
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [tower-http](https://github.com/tower-rs/tower-http) | dependencies | patch | `0.7.0` → `0.7.1` | --- ### Release Notes <details> <summary>tower-rs/tower-http (tower-http)</summary> ### [`v0.7.1`](https://github.com/tower-rs/tower-http/releases/tag/tower-http-0.7.1) [Compare Source](tower-rs/tower-http@tower-http-0.7.0...tower-http-0.7.1) #### Added - `fs`: add `ServeDir::redirect_to_trailing_slash()` to serve directory indexes directly instead of first redirecting to the trailing-slash path. The redirect remains the default ([#​728]) - `fs`: add `ignore_multi_range_requests()` to `ServeDir` and `ServeFile`, serving the full representation when a request asks for multiple byte ranges. The existing `416 Range Not Satisfiable` response remains the default ([#​727]) - `request-id`: the constructors and accessors on the request-id layers, services, and `RequestId` are now `const fn`, so they can be used in const context ([#​716]) #### Changed - `fs`: the minimum `http-range-header` requirement is now 0.4.2 ([#​661]) #### Fixed - **behavioral change:** `fs`: make `ServeDir::try_call` propagate expected filesystem I/O errors when no fallback is configured, as documented, instead of converting them to `404 Not Found` responses ([#​718]) - `decompression`: don't end the body when a data frame with no remaining bytes arrives after the decompressor reports end-of-stream. Trailers following such a frame were dropped and could not be recovered ([#​722]) - `decompression`: return a body error when a data frame with remaining bytes arrives after the decompressor reports end-of-stream, rather than silently truncating. This regressed in 0.7.0 ([#​712]) - `fs`: multipart range requests are now rejected before range validation, so they consistently return `416 Range Not Satisfiable` with a `Cannot serve multipart range requests` body instead of a generic unsatisfiable-range response ([#​661]) - `fs`: range error responses no longer carry representation headers such as `Content-Type` and `Content-Encoding` ([#​727]) - `set-header`: `SetMultipleResponseHeadersLayer` and `SetMultipleResponseHeader` are now `Clone` regardless of the response body type, matching the fix applied to the request-side types in 0.7.0 ([#​714]) [#​661]: tower-rs/tower-http#661 [#​712]: tower-rs/tower-http#712 [#​714]: tower-rs/tower-http#714 [#​716]: tower-rs/tower-http#716 [#​718]: tower-rs/tower-http#718 [#​722]: tower-rs/tower-http#722 [#​727]: tower-rs/tower-http#727 [#​728]: tower-rs/tower-http#728 #### All the changes - chore(deps): bump actions/checkout from 6 to 7 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​708](tower-rs/tower-http#708) - fix(compression): reject non-empty data frames after codec is EOF by [@​seanmonstar](https://github.com/seanmonstar) in [#​712](tower-rs/tower-http#712) - Remove Clone derivations from SetMultipleResponseHeader\* types by [@​skeet70](https://github.com/skeet70) in [#​714](tower-rs/tower-http#714) - feat(request-id): Allow request-id constructor in const context by [@​tottoto](https://github.com/tottoto) in [#​716](tower-rs/tower-http#716) - fs: Avoid unnecessary conversions between SystemTime and HttpDate by [@​tottoto](https://github.com/tottoto) in [#​717](tower-rs/tower-http#717) - fs: Use HeaderValue::is_empty to check for empty values by [@​tottoto](https://github.com/tottoto) in [#​720](tower-rs/tower-http#720) - fs: Use HeaderValue::to_str for date headers by [@​tottoto](https://github.com/tottoto) in [#​721](tower-rs/tower-http#721) - chore(deps): bump taiki-e/install-action from 2 to 2.85.4 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​715](tower-rs/tower-http#715) - chore(deps): bump taiki-e/install-action from 2.85.4 to 2.85.12 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​723](tower-rs/tower-http#723) - docs(example)/custom future with multiple bodies by [@​Reza-Darius](https://github.com/Reza-Darius) in [#​711](tower-rs/tower-http#711) - fix(decompression): don't end the body on an empty data frame by [@​clemenslosbichler-cloud](https://github.com/clemenslosbichler-cloud) in [#​722](tower-rs/tower-http#722) - Propagate ServeDir::try_call I/O errors by [@​Boulea7](https://github.com/Boulea7) in [#​718](tower-rs/tower-http#718) - ci: Update to cargo-check-external-types 0.5.0 by [@​tottoto](https://github.com/tottoto) in [#​724](tower-rs/tower-http#724) - fix: reject multipart ranges before validation by [@​shblue21](https://github.com/shblue21) in [#​661](tower-rs/tower-http#661) - chore(deps): bump taiki-e/install-action from 2.85.12 to 2.86.3 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​726](tower-rs/tower-http#726) - feat(services): configure directory redirects by [@​BreezeDelegate](https://github.com/BreezeDelegate) in [#​728](tower-rs/tower-http#728) - Allow ignoring unsupported multi-range requests by [@​BreezeDelegate](https://github.com/BreezeDelegate) in [#​727](tower-rs/tower-http#727) - chore(deps): bump taiki-e/install-action from 2.86.3 to 2.86.8 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​730](tower-rs/tower-http#730) - chore(release): prepare 0.7.1 by [@​jlizen](https://github.com/jlizen) in [#​729](tower-rs/tower-http#729) #### New Contributors - [@​skeet70](https://github.com/skeet70) made their first contribution in [#​714](tower-rs/tower-http#714) - [@​Reza-Darius](https://github.com/Reza-Darius) made their first contribution in [#​711](tower-rs/tower-http#711) - [@​clemenslosbichler-cloud](https://github.com/clemenslosbichler-cloud) made their first contribution in [#​722](tower-rs/tower-http#722) - [@​Boulea7](https://github.com/Boulea7) made their first contribution in [#​718](tower-rs/tower-http#718) - [@​shblue21](https://github.com/shblue21) made their first contribution in [#​661](tower-rs/tower-http#661) - [@​BreezeDelegate](https://github.com/BreezeDelegate) made their first contribution in [#​728](tower-rs/tower-http#728) </details> --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - "before 9am on tuesday" - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4xMzMuMCIsInVwZGF0ZWRJblZlciI6IjQ0LjE1NS4xIiwidGFyZ2V0QnJhbmNoIjoiZGV2ZWxvcCIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiLCJyZW5vdmF0ZSJdfQ==--> Reviewed-on: https://code.futo.org/harbor/harbor/pulls/1799 Reviewed-by: Thomas de Zeeuw <[email protected]>
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.
Motivation
ServeDirandServeFilecannot produce multipart range responses. Returning416for a syntactically valid multi-range request is avoidable because RFC 9110 allows a server to ignoreRangeand serve the full representation.Fixes #725.
Solution
Add an opt-in
ignore_multi_range_requestssetting toServeDirandServeFile. When enabled, syntactically valid multi-range headers are ignored before semantic range validation and the full representation is returned with200; malformed headers and unsatisfiable single ranges keep returning416.The default remains unchanged. GET and HEAD behavior is covered, as are overlapping/reversed multi-ranges.
416responses also stop retaining the selected representation'sContent-TypeandContent-Encoding, including for precompressed files.