diff --git a/tonic/Cargo.toml b/tonic/Cargo.toml
index 013cc6e72..aa070f3ac 100644
--- a/tonic/Cargo.toml
+++ b/tonic/Cargo.toml
@@ -28,7 +28,14 @@ gzip = ["dep:flate2"]
zstd = ["dep:zstd"]
default = ["transport", "codegen", "prost"]
prost = ["dep:prost"]
-tls = ["dep:rustls-pemfile", "transport", "dep:tokio-rustls", "dep:rustls", "tokio/rt", "tokio/macros"]
+tls = [
+ "dep:rustls-pemfile",
+ "transport",
+ "dep:tokio-rustls",
+ "dep:rustls",
+ "tokio/rt",
+ "tokio/macros",
+]
tls-roots = ["tls-roots-common", "dep:rustls-native-certs"]
tls-roots-common = ["tls"]
tls-webpki-roots = ["tls-roots-common", "dep:webpki-roots"]
@@ -52,29 +59,42 @@ channel = []
[dependencies]
base64 = "0.21"
bytes = "1.0"
-http = "0.2"
+http = "1.0"
tracing = "0.1"
tokio = "1.0.1"
-http-body = "0.4.4"
+http-body = "1.0"
+http-body-util = "0.1"
percent-encoding = "2.1"
pin-project = "1.0.11"
tower-layer = "0.3"
tower-service = "0.3"
# prost
-prost = {version = "0.12", default-features = false, features = ["std"], optional = true}
+prost = { version = "0.12", default-features = false, features = [
+ "std",
+], optional = true }
# codegen
-async-trait = {version = "0.1.13", optional = true}
+async-trait = { version = "0.1.13", optional = true }
# transport
-h2 = {version = "0.3.17", optional = true}
-hyper = {version = "0.14.26", features = ["full"], optional = true}
-hyper-timeout = {version = "0.4", optional = true}
-tokio-stream = "0.1"
-tower = {version = "0.4.7", default-features = false, features = ["balance", "buffer", "discover", "limit", "load", "make", "timeout", "util"], optional = true}
-axum = {version = "0.6.9", default_features = false, optional = true}
+h2 = { version = "0.4", optional = true }
+hyper = { version = "1.0", features = ["full"], optional = true }
+hyper-util = { version = "0.1", features = ["full"] }
+hyper-timeout = { version = "0.5", optional = true }
+tokio-stream = { version = "0.1", features = ["net"] }
+tower = { version = "0.4.7", default-features = false, features = [
+ "balance",
+ "buffer",
+ "discover",
+ "limit",
+ "load",
+ "make",
+ "timeout",
+ "util",
+], optional = true }
+axum = { version = "0.7", default_features = false, optional = true }
# rustls
async-stream = { version = "0.3", optional = true }
@@ -85,7 +105,7 @@ rustls = { version = "0.21.7", optional = true }
webpki-roots = { version = "0.25.0", optional = true }
# compression
-flate2 = {version = "1.0", optional = true}
+flate2 = { version = "1.0", optional = true }
zstd = { version = "0.12.3", optional = true }
[dev-dependencies]
@@ -94,8 +114,8 @@ quickcheck = "1.0"
quickcheck_macros = "1.0"
rand = "0.8"
static_assertions = "1.0"
-tokio = {version = "1.0", features = ["rt", "macros"]}
-tower = {version = "0.4.7", features = ["full"]}
+tokio = { version = "1.0", features = ["rt", "macros"] }
+tower = { version = "0.4.7", features = ["full"] }
[package.metadata.docs.rs]
all-features = true
diff --git a/tonic/benches/decode.rs b/tonic/benches/decode.rs
index 5c7cd0159..ca9984c51 100644
--- a/tonic/benches/decode.rs
+++ b/tonic/benches/decode.rs
@@ -1,11 +1,13 @@
-use bencher::{benchmark_group, benchmark_main, Bencher};
-use bytes::{Buf, BufMut, Bytes, BytesMut};
-use http_body::Body;
use std::{
fmt::{Error, Formatter},
pin::Pin,
task::{Context, Poll},
};
+
+use bencher::{benchmark_group, benchmark_main, Bencher};
+use bytes::{Buf, BufMut, Bytes, BytesMut};
+use http_body::{Body, Frame, SizeHint};
+
use tonic::{codec::DecodeBuf, codec::Decoder, Status, Streaming};
macro_rules! bench {
@@ -58,23 +60,24 @@ impl Body for MockBody {
type Data = Bytes;
type Error = Status;
- fn poll_data(
- mut self: Pin<&mut Self>,
- _: &mut Context<'_>,
- ) -> Poll