Update Rust crate tower-http to v0.6.11 #20

Merged
navicore merged 1 commit from renovate/tower-http-0.x-lockfile into main 2026-05-25 13:18:11 +00:00
Owner

This PR contains the following updates:

Package Type Update Change
tower-http dependencies patch 0.6.80.6.11

Release Notes

tower-rs/tower-http (tower-http)

v0.6.11

Compare Source

Added

  • set-header: add SetMultipleResponseHeadersLayer and
    SetMultipleResponseHeader for setting multiple response headers at once.
    Supports overriding, appending, and if_not_present modes. Header
    values can be fixed or computed dynamically via closures (#​672)

    use http::{Response, header::{self, HeaderValue}};
    use http_body::Body as _;
    use tower_http::set_header::response::SetMultipleResponseHeadersLayer;
    
    let layer = SetMultipleResponseHeadersLayer::overriding(vec![
        (header::X_FRAME_OPTIONS, HeaderValue::from_static("DENY")).into(),
        (header::CONTENT_LENGTH, |res: &Response<MyBody>| {
            res.body().size_hint().exact()
                .map(|size| HeaderValue::from_str(&size.to_string()).unwrap())
        }).into(),
    ]);
    
  • set-header: add SetMultipleRequestHeadersLayer and
    SetMultipleRequestHeaders for setting multiple request headers at once,
    mirroring the response-side API (#​677)

  • classify: add From<i32> and From<NonZeroI32> impls for GrpcCode.
    Unrecognized status codes map to GrpcCode::Unknown (#​506)

Changed

  • compression: compress application/grpc-web responses. Previously all
    application/grpc* content types were excluded from compression; now only
    application/grpc (non-web) is excluded (#​408)

Fixed

  • fs: fix ServeDir returning 500 instead of 405 for non-GET/HEAD requests
    when call_fallback_on_method_not_allowed is enabled but no fallback service
    is configured (#​587)
  • fs: remove duplicate cfg attribute on is_reserved_dos_name (#​675)

All PRs

New Contributors

Full Changelog: https://github.com/tower-rs/tower-http/compare/tower-http-0.6.10...tower-http-0.6.11

v0.6.10

Compare Source

Added

  • follow-redirect: expose Attempt::method() and Attempt::previous_method()
    so redirect policies can react to method changes across redirects (e.g.
    POST to GET on 301/303) (#​559)

Fixed

  • Restore tokio and async-compression as no-op features. These will be
    removed next breaking release (#​667)

What's Changed

New Contributors

Full Changelog: https://github.com/tower-rs/tower-http/compare/tower-http-0.6.9...tower-http-0.6.10

v0.6.9

Compare Source

Added:

  • on-early-drop: middleware that detects when a response future or response
    body is dropped before completion (#​636)

    Two events get hooks: the response future being dropped before
    the inner service produces a response, and the response body being
    dropped before reaching end-of-stream.

    Install custom callbacks with OnEarlyDropLayer::builder():

    use http::Request;
    use tower_http::on_early_drop::{OnBodyDropFn, OnEarlyDropLayer};
    
    let layer = OnEarlyDropLayer::builder()
        .on_future_drop(|req: &Request<()>| {
            let uri = req.uri().clone();
            move || eprintln!("future dropped for {}", uri)
        })
        .on_body_drop(OnBodyDropFn::new(|req: &Request<()>| {
            let uri = req.uri().clone();
            move |parts: &http::response::Parts| {
                let status = parts.status;
                move || eprintln!("body dropped for {} status {}", uri, status)
            }
        }));
    

    Or route both events through a trace::OnFailure hook with
    EarlyDropsAsFailures. Place this layer inside a TraceLayer so the
    emitted events inherit the request span:

    use tower::ServiceBuilder;
    use tower_http::on_early_drop::{OnEarlyDropLayer, EarlyDropsAsFailures};
    use tower_http::trace::{DefaultOnFailure, TraceLayer};
    
    let stack = ServiceBuilder::new()
        .layer(TraceLayer::new_for_http())
        .layer(OnEarlyDropLayer::new(
            EarlyDropsAsFailures::new(DefaultOnFailure::default()),
        ));
    
  • fs: make AsyncReadBody::with_capacity public (#​415)

Changed:

  • The implicit async-compression feature is removed (#​642)
  • The implicit tokio feature is removed (#​628)
  • fs: no longer auto-enables the tracing crate feature; enable tracing
    explicitly to restore error logging on ServeDir IO failures (#​614)

Fixed

  • trace: restore failure classification at end-of-stream (#​483)
  • follow-redirect: support unicode URLs (swaps iri-string dep for
    url) (#​646)
  • fs: reject reserved Windows DOS device names (CON, COM1, etc.) in
    ServeDir (#​663)

All the PRs

New Contributors

Full Changelog: https://github.com/tower-rs/tower-http/compare/tower-http-0.6.8...tower-http-0.6.9


Configuration

📅 Schedule: (UTC)

  • Branch creation
    • Between 08:00 AM and 09:59 AM, only on Monday and Thursday (* 8-9 * * 1,4)
  • 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.


  • If you want to rebase/retry this PR, check this box

This PR has been generated by Mend Renovate.

This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [tower-http](https://github.com/tower-rs/tower-http) | dependencies | patch | `0.6.8` → `0.6.11` | --- ### Release Notes <details> <summary>tower-rs/tower-http (tower-http)</summary> ### [`v0.6.11`](https://github.com/tower-rs/tower-http/releases/tag/tower-http-0.6.11) [Compare Source](https://github.com/tower-rs/tower-http/compare/tower-http-0.6.10...tower-http-0.6.11) #### Added - `set-header`: add `SetMultipleResponseHeadersLayer` and `SetMultipleResponseHeader` for setting multiple response headers at once. Supports `overriding`, `appending`, and `if_not_present` modes. Header values can be fixed or computed dynamically via closures ([#&#8203;672]) ```rust use http::{Response, header::{self, HeaderValue}}; use http_body::Body as _; use tower_http::set_header::response::SetMultipleResponseHeadersLayer; let layer = SetMultipleResponseHeadersLayer::overriding(vec![ (header::X_FRAME_OPTIONS, HeaderValue::from_static("DENY")).into(), (header::CONTENT_LENGTH, |res: &Response<MyBody>| { res.body().size_hint().exact() .map(|size| HeaderValue::from_str(&size.to_string()).unwrap()) }).into(), ]); ``` - `set-header`: add `SetMultipleRequestHeadersLayer` and `SetMultipleRequestHeaders` for setting multiple request headers at once, mirroring the response-side API ([#&#8203;677]) - `classify`: add `From<i32>` and `From<NonZeroI32>` impls for `GrpcCode`. Unrecognized status codes map to `GrpcCode::Unknown` ([#&#8203;506]) #### Changed - `compression`: compress `application/grpc-web` responses. Previously all `application/grpc*` content types were excluded from compression; now only `application/grpc` (non-web) is excluded ([#&#8203;408]) #### Fixed - `fs`: fix `ServeDir` returning 500 instead of 405 for non-GET/HEAD requests when `call_fallback_on_method_not_allowed` is enabled but no fallback service is configured ([#&#8203;587]) - `fs`: remove duplicate `cfg` attribute on `is_reserved_dos_name` ([#&#8203;675]) [#&#8203;408]: https://github.com/tower-rs/tower-http/pull/408 [#&#8203;506]: https://github.com/tower-rs/tower-http/pull/506 [#&#8203;587]: https://github.com/tower-rs/tower-http/pull/587 [#&#8203;672]: https://github.com/tower-rs/tower-http/pull/672 [#&#8203;675]: https://github.com/tower-rs/tower-http/pull/675 [#&#8203;677]: https://github.com/tower-rs/tower-http/pull/677 #### All PRs - ci: fix flaky encoding test, add nightly stress test job by [@&#8203;jlizen](https://github.com/jlizen) in [#&#8203;670](https://github.com/tower-rs/tower-http/pull/670) - ci: use static timeout in stress-test workflow by [@&#8203;jlizen](https://github.com/jlizen) in [#&#8203;671](https://github.com/tower-rs/tower-http/pull/671) - Fix serve\_dir method not allowed handling when no fallback is configured by [@&#8203;soerenmeier](https://github.com/soerenmeier) in [#&#8203;587](https://github.com/tower-rs/tower-http/pull/587) - Do compress grpc-web responses by [@&#8203;bouk](https://github.com/bouk) in [#&#8203;408](https://github.com/tower-rs/tower-http/pull/408) - add From<i32> impl for GrpcCode by [@&#8203;gshipilov](https://github.com/gshipilov) in [#&#8203;506](https://github.com/tower-rs/tower-http/pull/506) - feat(set\_header): refactor and improve multiple header middleware by [@&#8203;seun-ja](https://github.com/seun-ja) in [#&#8203;672](https://github.com/tower-rs/tower-http/pull/672) - Remove duplicate cfg attribute for is\_reserved\_dos\_name by [@&#8203;GlenDC](https://github.com/GlenDC) in [#&#8203;675](https://github.com/tower-rs/tower-http/pull/675) - feat: set multiple request header by [@&#8203;seun-ja](https://github.com/seun-ja) in [#&#8203;677](https://github.com/tower-rs/tower-http/pull/677) - chore: release 0.6.11 by [@&#8203;jlizen](https://github.com/jlizen) in [#&#8203;673](https://github.com/tower-rs/tower-http/pull/673) #### New Contributors - [@&#8203;gshipilov](https://github.com/gshipilov) made their first contribution in [#&#8203;506](https://github.com/tower-rs/tower-http/pull/506) - [@&#8203;seun-ja](https://github.com/seun-ja) made their first contribution in [#&#8203;672](https://github.com/tower-rs/tower-http/pull/672) **Full Changelog**: <https://github.com/tower-rs/tower-http/compare/tower-http-0.6.10...tower-http-0.6.11> ### [`v0.6.10`](https://github.com/tower-rs/tower-http/releases/tag/tower-http-0.6.10) [Compare Source](https://github.com/tower-rs/tower-http/compare/tower-http-0.6.9...tower-http-0.6.10) #### Added - `follow-redirect`: expose `Attempt::method()` and `Attempt::previous_method()` so redirect policies can react to method changes across redirects (e.g. POST to GET on 301/303) ([#&#8203;559]) #### Fixed - Restore `tokio` and `async-compression` as no-op features. These will be removed next breaking release ([#&#8203;667]) [#&#8203;559]: https://github.com/tower-rs/tower-http/pull/559 [#&#8203;667]: https://github.com/tower-rs/tower-http/pull/667 #### What's Changed - fix: restore tokio and async-compression as no-op features by [@&#8203;jlizen](https://github.com/jlizen) in [#&#8203;667](https://github.com/tower-rs/tower-http/pull/667) - fix gate-ing of atomic64 in tests by [@&#8203;alexanderkjall](https://github.com/alexanderkjall) in [#&#8203;607](https://github.com/tower-rs/tower-http/pull/607) - follow\_redirect: expose previous and next request methods by [@&#8203;lucab](https://github.com/lucab) in [#&#8203;559](https://github.com/tower-rs/tower-http/pull/559) - chore: release tower-http 0.6.10 by [@&#8203;jlizen](https://github.com/jlizen) in [#&#8203;669](https://github.com/tower-rs/tower-http/pull/669) #### New Contributors - [@&#8203;lucab](https://github.com/lucab) made their first contribution in [#&#8203;559](https://github.com/tower-rs/tower-http/pull/559) **Full Changelog**: <https://github.com/tower-rs/tower-http/compare/tower-http-0.6.9...tower-http-0.6.10> ### [`v0.6.9`](https://github.com/tower-rs/tower-http/releases/tag/tower-http-0.6.9) [Compare Source](https://github.com/tower-rs/tower-http/compare/tower-http-0.6.8...tower-http-0.6.9) #### Added: - `on-early-drop`: middleware that detects when a response future or response body is dropped before completion ([#&#8203;636]) Two events get hooks: the response future being dropped before the inner service produces a response, and the response body being dropped before reaching end-of-stream. Install custom callbacks with `OnEarlyDropLayer::builder()`: ```rust use http::Request; use tower_http::on_early_drop::{OnBodyDropFn, OnEarlyDropLayer}; let layer = OnEarlyDropLayer::builder() .on_future_drop(|req: &Request<()>| { let uri = req.uri().clone(); move || eprintln!("future dropped for {}", uri) }) .on_body_drop(OnBodyDropFn::new(|req: &Request<()>| { let uri = req.uri().clone(); move |parts: &http::response::Parts| { let status = parts.status; move || eprintln!("body dropped for {} status {}", uri, status) } })); ``` Or route both events through a `trace::OnFailure` hook with `EarlyDropsAsFailures`. Place this layer inside a `TraceLayer` so the emitted events inherit the request span: ```rust use tower::ServiceBuilder; use tower_http::on_early_drop::{OnEarlyDropLayer, EarlyDropsAsFailures}; use tower_http::trace::{DefaultOnFailure, TraceLayer}; let stack = ServiceBuilder::new() .layer(TraceLayer::new_for_http()) .layer(OnEarlyDropLayer::new( EarlyDropsAsFailures::new(DefaultOnFailure::default()), )); ``` - `fs`: make `AsyncReadBody::with_capacity` public ([#&#8203;415]) #### Changed: - The implicit `async-compression` feature is removed ([#&#8203;642]) - The implicit `tokio` feature is removed ([#&#8203;628]) - `fs`: no longer auto-enables the `tracing` crate feature; enable `tracing` explicitly to restore error logging on `ServeDir` IO failures ([#&#8203;614]) #### Fixed - `trace`: restore failure classification at end-of-stream ([#&#8203;483]) - `follow-redirect`: support unicode URLs (swaps `iri-string` dep for `url`) ([#&#8203;646]) - `fs`: reject reserved Windows DOS device names (`CON`, `COM1`, etc.) in `ServeDir` ([#&#8203;663]) [#&#8203;415]: https://github.com/tower-rs/tower-http/pull/415 [#&#8203;483]: https://github.com/tower-rs/tower-http/pull/483 [#&#8203;614]: https://github.com/tower-rs/tower-http/pull/614 [#&#8203;628]: https://github.com/tower-rs/tower-http/pull/628 [#&#8203;636]: https://github.com/tower-rs/tower-http/pull/636 [#&#8203;642]: https://github.com/tower-rs/tower-http/pull/642 [#&#8203;646]: https://github.com/tower-rs/tower-http/pull/646 [#&#8203;663]: https://github.com/tower-rs/tower-http/pull/663 #### All the PRs - ci: update deny action to v2 by [@&#8203;seanmonstar](https://github.com/seanmonstar) in [#&#8203;627](https://github.com/tower-rs/tower-http/pull/627) - chore: improve code comments clarity by [@&#8203;xibeiyoumian](https://github.com/xibeiyoumian) in [#&#8203;626](https://github.com/tower-rs/tower-http/pull/626) - ci: Update to actions/checkout v6 by [@&#8203;tottoto](https://github.com/tottoto) in [#&#8203;629](https://github.com/tower-rs/tower-http/pull/629) - ci: msrv resolver by [@&#8203;seanmonstar](https://github.com/seanmonstar) in [#&#8203;635](https://github.com/tower-rs/tower-http/pull/635) - chore: Remove resolved cargo-deny config by [@&#8203;tottoto](https://github.com/tottoto) in [#&#8203;631](https://github.com/tower-rs/tower-http/pull/631) - ci: Update to cargo-check-external-types 0.4.0 by [@&#8203;tottoto](https://github.com/tottoto) in [#&#8203;633](https://github.com/tower-rs/tower-http/pull/633) - examples: Use typed default value clap config by [@&#8203;tottoto](https://github.com/tottoto) in [#&#8203;634](https://github.com/tower-rs/tower-http/pull/634) - examples: Disable unused reqwest feature by [@&#8203;tottoto](https://github.com/tottoto) in [#&#8203;632](https://github.com/tower-rs/tower-http/pull/632) - examples: Update to reqwest 0.13 by [@&#8203;tottoto](https://github.com/tottoto) in [#&#8203;640](https://github.com/tower-rs/tower-http/pull/640) - Fix clippy warnings in warp-key-value-store example by [@&#8203;jplatte](https://github.com/jplatte) in [#&#8203;637](https://github.com/tower-rs/tower-http/pull/637) - ci: Use Swatinem/rust-cache\@&#8203;v2 to cache by [@&#8203;tottoto](https://github.com/tottoto) in [#&#8203;644](https://github.com/tower-rs/tower-http/pull/644) - ci: Remove unused working-directory config by [@&#8203;tottoto](https://github.com/tottoto) in [#&#8203;645](https://github.com/tower-rs/tower-http/pull/645) - Use cargo-deny graph config by [@&#8203;tottoto](https://github.com/tottoto) in [#&#8203;639](https://github.com/tower-rs/tower-http/pull/639) - Fix: follow redirect unicode in [#&#8203;646](https://github.com/tower-rs/tower-http/pull/646) - doc: remove mention of deprecated bearer method in lib.rs comment by [@&#8203;VojtaStanek](https://github.com/VojtaStanek) in [#&#8203;641](https://github.com/tower-rs/tower-http/pull/641) - Allow Unicode-3.0 license by [@&#8203;tottoto](https://github.com/tottoto) in [#&#8203;648](https://github.com/tower-rs/tower-http/pull/648) - fix(docs): typo by [@&#8203;carlocorradini](https://github.com/carlocorradini) in [#&#8203;649](https://github.com/tower-rs/tower-http/pull/649) - fix: remove unused GzEncoder import in decompression in [#&#8203;647](https://github.com/tower-rs/tower-http/pull/647) - docs: update Example server in [#&#8203;652](https://github.com/tower-rs/tower-http/pull/652) - Don't automatically enable tracing for fs feature by [@&#8203;ginnyTheCat](https://github.com/ginnyTheCat) in [#&#8203;614](https://github.com/tower-rs/tower-http/pull/614) - examples: Remove unnecessary trait bound by [@&#8203;tottoto](https://github.com/tottoto) in [#&#8203;651](https://github.com/tower-rs/tower-http/pull/651) - Remove implicit async-compression feature by [@&#8203;tottoto](https://github.com/tottoto) in [#&#8203;642](https://github.com/tower-rs/tower-http/pull/642) - fix clippy warnings by [@&#8203;alexanderkjall](https://github.com/alexanderkjall) in [#&#8203;659](https://github.com/tower-rs/tower-http/pull/659) - Check for reserved DOS names by [@&#8203;Darksonn](https://github.com/Darksonn) in [#&#8203;663](https://github.com/tower-rs/tower-http/pull/663) - enable clippy for tower-http and fix current issues by [@&#8203;GlenDC](https://github.com/GlenDC) in [#&#8203;407](https://github.com/tower-rs/tower-http/pull/407) - chore: remove implicit tokio feature by [@&#8203;WaterWhisperer](https://github.com/WaterWhisperer) in [#&#8203;628](https://github.com/tower-rs/tower-http/pull/628) - trace: adds back call to classify\_eos on trailers by [@&#8203;markdingram](https://github.com/markdingram) in [#&#8203;483](https://github.com/tower-rs/tower-http/pull/483) - Make AsyncReadBody::with\_capacity public by [@&#8203;bouk](https://github.com/bouk) in [#&#8203;415](https://github.com/tower-rs/tower-http/pull/415) - examples: Use axum::body::to\_bytes by [@&#8203;tottoto](https://github.com/tottoto) in [#&#8203;650](https://github.com/tower-rs/tower-http/pull/650) - ci: Remove unnecessary protoc setup by [@&#8203;tottoto](https://github.com/tottoto) in [#&#8203;665](https://github.com/tower-rs/tower-http/pull/665) - feat(on-early-drop): Add middleware for client early drop detection by [@&#8203;fbergero](https://github.com/fbergero) in [#&#8203;636](https://github.com/tower-rs/tower-http/pull/636) - chore: release tower-http 0.6.9 by [@&#8203;jlizen](https://github.com/jlizen) in [#&#8203;666](https://github.com/tower-rs/tower-http/pull/666) #### New Contributors - [@&#8203;xibeiyoumian](https://github.com/xibeiyoumian) made their first contribution in [#&#8203;626](https://github.com/tower-rs/tower-http/pull/626) - [@&#8203;VojtaStanek](https://github.com/VojtaStanek) made their first contribution in [#&#8203;641](https://github.com/tower-rs/tower-http/pull/641) - [@&#8203;carlocorradini](https://github.com/carlocorradini) made their first contribution in [#&#8203;649](https://github.com/tower-rs/tower-http/pull/649) - [@&#8203;ginnyTheCat](https://github.com/ginnyTheCat) made their first contribution in [#&#8203;614](https://github.com/tower-rs/tower-http/pull/614) - [@&#8203;alexanderkjall](https://github.com/alexanderkjall) made their first contribution in [#&#8203;659](https://github.com/tower-rs/tower-http/pull/659) - [@&#8203;Darksonn](https://github.com/Darksonn) made their first contribution in [#&#8203;663](https://github.com/tower-rs/tower-http/pull/663) - [@&#8203;WaterWhisperer](https://github.com/WaterWhisperer) made their first contribution in [#&#8203;628](https://github.com/tower-rs/tower-http/pull/628) - [@&#8203;bouk](https://github.com/bouk) made their first contribution in [#&#8203;415](https://github.com/tower-rs/tower-http/pull/415) - [@&#8203;fbergero](https://github.com/fbergero) made their first contribution in [#&#8203;636](https://github.com/tower-rs/tower-http/pull/636) - [@&#8203;jlizen](https://github.com/jlizen) made their first contribution in [#&#8203;666](https://github.com/tower-rs/tower-http/pull/666) **Full Changelog**: <https://github.com/tower-rs/tower-http/compare/tower-http-0.6.8...tower-http-0.6.9> </details> --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - Between 08:00 AM and 09:59 AM, only on Monday and Thursday (`* 8-9 * * 1,4`) - 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](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xODYuMSIsInVwZGF0ZWRJblZlciI6IjQzLjE4Ni4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJyZW5vdmF0ZSIsInJ1c3QiXX0=-->
Update Rust crate tower-http to v0.6.11
All checks were successful
CI / ci (pull_request) Successful in 1m50s
7a1ffadac1
Sign in to join this conversation.
No description provided.