From 418a08dc1e4b8d7e334cb842c84c91a32b40288b Mon Sep 17 00:00:00 2001 From: Paolo Barbolini Date: Tue, 13 Aug 2024 21:45:18 +0200 Subject: [PATCH 1/2] Update to tower-http v0.5 --- examples/axum-key-value-store/Cargo.toml | 2 +- examples/tonic-key-value-store/Cargo.toml | 2 +- examples/warp-key-value-store/Cargo.toml | 2 +- tower-http/CHANGELOG.md | 4 +++- tower-http/Cargo.toml | 4 ++-- tower-http/src/classify/mod.rs | 14 +++++++------- 6 files changed, 15 insertions(+), 13 deletions(-) diff --git a/examples/axum-key-value-store/Cargo.toml b/examples/axum-key-value-store/Cargo.toml index c8775c9b..8f4566e5 100644 --- a/examples/axum-key-value-store/Cargo.toml +++ b/examples/axum-key-value-store/Cargo.toml @@ -8,7 +8,7 @@ license = "MIT" [dependencies] tokio = { version = "1.32.0", features = ["full"] } -tower = { version = "0.4.13", features = ["full"] } +tower = { version = "0.5", features = ["full"] } tower-http = { path = "../../tower-http", features = ["full"] } tracing = "0.1" tracing-subscriber = { version = "0.3.17", features = ["env-filter"] } diff --git a/examples/tonic-key-value-store/Cargo.toml b/examples/tonic-key-value-store/Cargo.toml index 530c73cf..4e7897a4 100644 --- a/examples/tonic-key-value-store/Cargo.toml +++ b/examples/tonic-key-value-store/Cargo.toml @@ -14,7 +14,7 @@ tokio = { version = "1.2.0", features = ["full"] } futures = "0.3" tokio-stream = { version = "0.1", features = ["sync", "net"] } tonic = "0.9" -tower = { version = "0.4.5", features = ["full"] } +tower = { version = "0.5", features = ["full"] } tower-http = { path = "../../tower-http", features = ["full"] } tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter"] } diff --git a/examples/warp-key-value-store/Cargo.toml b/examples/warp-key-value-store/Cargo.toml index bc7deef3..afe8666f 100644 --- a/examples/warp-key-value-store/Cargo.toml +++ b/examples/warp-key-value-store/Cargo.toml @@ -11,7 +11,7 @@ bytes = "1" clap = { version = "4.3.16", features = ["derive"] } hyper = { version = "0.14.4", features = ["full"] } tokio = { version = "1.2.0", features = ["full"] } -tower = { version = "0.4.5", features = ["full"] } +tower = { version = "0.5", features = ["full"] } tower-http = { path = "../../tower-http", features = ["full"] } tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter"] } diff --git a/tower-http/CHANGELOG.md b/tower-http/CHANGELOG.md index f1b3fb4e..d62b5795 100644 --- a/tower-http/CHANGELOG.md +++ b/tower-http/CHANGELOG.md @@ -5,13 +5,15 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -# Unreleased +# 0.6.0 ## Changed: - `body` module is disabled except for `catch-panic`, `decompression-*`, `fs`, or `limit` features (BREAKING) ([#477]) +- Update to `tower` 0.5 ([#503]) [#477]: https://github.com/tower-rs/tower-http/pull/477 +[#503]: https://github.com/tower-rs/tower-http/pull/503 # 0.5.2 diff --git a/tower-http/Cargo.toml b/tower-http/Cargo.toml index 489b585d..1e4b6cc6 100644 --- a/tower-http/Cargo.toml +++ b/tower-http/Cargo.toml @@ -34,7 +34,7 @@ mime_guess = { version = "2", optional = true, default_features = false } percent-encoding = { version = "2.1.0", optional = true } tokio = { version = "1.6", optional = true, default_features = false } tokio-util = { version = "0.7", optional = true, default_features = false, features = ["io"] } -tower = { version = "0.4.1", optional = true } +tower = { version = "0.5", optional = true } tracing = { version = "0.1", default_features = false, optional = true } httpdate = { version = "1.0", optional = true } uuid = { version = "1.0", features = ["v4"], optional = true } @@ -52,7 +52,7 @@ once_cell = "1" serde_json = "1.0" sync_wrapper = "1" tokio = { version = "1", features = ["full"] } -tower = { version = "0.4.10", features = ["buffer", "util", "retry", "make", "timeout"] } +tower = { version = "0.5", features = ["buffer", "util", "retry", "make", "timeout"] } tracing-subscriber = "0.3" uuid = { version = "1.0", features = ["v4"] } zstd = "0.13" diff --git a/tower-http/src/classify/mod.rs b/tower-http/src/classify/mod.rs index 6ea32559..72c4db92 100644 --- a/tower-http/src/classify/mod.rs +++ b/tower-http/src/classify/mod.rs @@ -397,12 +397,12 @@ mod usable_for_retries { Request: Clone, E: std::error::Error + 'static, { - type Future = std::future::Ready>; + type Future = std::future::Ready<()>; fn retry( - &self, - _req: &Request, - res: Result<&Response, &E>, + &mut self, + _req: &mut Request, + res: &mut Result, E>, ) -> Option { match res { Ok(res) => { @@ -410,7 +410,7 @@ mod usable_for_retries { self.classifier.clone().classify_response(res) { if class.err()?.is_retryable() { - return Some(std::future::ready(self.clone())); + return Some(std::future::ready(())); } } @@ -421,11 +421,11 @@ mod usable_for_retries { .clone() .classify_error(err) .is_retryable() - .then(|| std::future::ready(self.clone())), + .then(|| std::future::ready(())), } } - fn clone_request(&self, req: &Request) -> Option> { + fn clone_request(&mut self, req: &Request) -> Option> { Some(req.clone()) } } From c62eefed9b3d86f9e5fc3962a26eea4a5b2338e6 Mon Sep 17 00:00:00 2001 From: Paolo Barbolini Date: Tue, 13 Aug 2024 22:22:15 +0200 Subject: [PATCH 2/2] Update tower-http/CHANGELOG.md Co-authored-by: Jonas Platte --- tower-http/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tower-http/CHANGELOG.md b/tower-http/CHANGELOG.md index d62b5795..e4da30fe 100644 --- a/tower-http/CHANGELOG.md +++ b/tower-http/CHANGELOG.md @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -# 0.6.0 +# 0.6.0 (unreleased) ## Changed: