From 38e7edcc1f904e25acc48568a87dfbc9b75b4cae Mon Sep 17 00:00:00 2001 From: Fangdun Tsai Date: Thu, 27 Jul 2023 02:31:23 +0800 Subject: [PATCH] chore(deps): hyper v1.0.0-rc.4 --- Cargo.toml | 13 +++++++------ examples/hyper.rs | 3 ++- src/async.rs | 5 +++-- src/lib.rs | 3 ++- src/state.rs | 2 +- src/utils.rs | 4 ++-- tests/lib/limited.rs | 2 +- 7 files changed, 18 insertions(+), 14 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 7c17f59..9091f3c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -41,12 +41,13 @@ futures-util = { version = "0.3", default-features = false, features = [ anyhow = "1.0" rand = "0.8" async-fs = "1.6" -tempfile = "3.4" -hyper = { version = "1.0.0-rc.3", features = ["server", "http1"] } -http-body = "1.0.0-rc.2" -http-body-util = "0.1.0-rc.2" -tokio = { version = "1.27", features = ["macros", "rt-multi-thread"] } -tokio-util = { version = "0.7.7", features = ["io"] } +tempfile = "3.7" +hyper = { version = "=1.0.0-rc.4", features = ["server", "http1"] } +hyper-util = { version = "=0.0.0", git = "https://github.com/hyperium/hyper-util.git" } +http-body = "=1.0.0-rc.2" +http-body-util = "=0.1.0-rc.3" +tokio = { version = "1.29", features = ["macros", "rt-multi-thread"] } +tokio-util = { version = "0.7", features = ["io"] } tracing-subscriber = { version = "0.3", features = ["env-filter"] } warp = "0.3" tiny_http = "0.12" diff --git a/examples/hyper.rs b/examples/hyper.rs index e2ce06a..4d3e7a6 100644 --- a/examples/hyper.rs +++ b/examples/hyper.rs @@ -32,6 +32,7 @@ use futures_util::{ }; use http_body_util::Full; use hyper::{body::Incoming, header, server::conn::http1, service::service_fn, Request, Response}; +use hyper_util::rt::TokioIo; use tempfile::tempdir; use tokio::net::TcpListener; @@ -156,7 +157,7 @@ pub async fn main() -> Result<(), Box> { if let Err(err) = http1::Builder::new() .max_buf_size(size) .serve_connection( - stream, + TokioIo::new(stream), service_fn(|req: Request| hello(size, req)), ) .await diff --git a/src/async.rs b/src/async.rs index 9e670fb..b392a96 100644 --- a/src/async.rs +++ b/src/async.rs @@ -182,7 +182,7 @@ where trace!("polling {} {}", self.index, self.state.is_some()); let Some(state) = self.state.clone() else { - return Poll::Ready(None) + return Poll::Ready(None); }; let is_file = self.filename.is_some(); @@ -263,7 +263,8 @@ where // invalid content disposition let Some((name, filename)) = headers .remove(CONTENT_DISPOSITION) - .and_then(|v| parse_content_disposition(v.as_bytes()).ok()) else { + .and_then(|v| parse_content_disposition(v.as_bytes()).ok()) + else { return Poll::Ready(Some(Err(Error::InvalidContentDisposition))); }; diff --git a/src/lib.rs b/src/lib.rs index edac6d9..e7ea7b3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -16,6 +16,7 @@ //! }; //! use http_body_util::Full; //! use hyper::{body::Incoming, header, server::conn::http1, service::service_fn, Request, Response}; +//! use hyper_util::rt::TokioIo; //! use tempfile::tempdir; //! use tokio::net::TcpListener; //! @@ -140,7 +141,7 @@ //! if let Err(err) = http1::Builder::new() //! .max_buf_size(size) //! .serve_connection( -//! stream, +//! TokioIo::new(stream), //! service_fn(|req: Request| hello(size, req)), //! ) //! .await diff --git a/src/state.rs b/src/state.rs index eb452e0..973aae1 100644 --- a/src/state.rs +++ b/src/state.rs @@ -224,6 +224,6 @@ impl fmt::Debug for State { .field("limits", &self.limits) .field("is_readable", &self.is_readable) .field("boundary", &String::from_utf8_lossy(self.boundary())) - .finish() + .finish_non_exhaustive() } } diff --git a/src/utils.rs b/src/utils.rs index 31df3dc..cf60622 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -58,7 +58,7 @@ pub(crate) fn parse_content_disposition(hv: &[u8]) -> Result<(String, Option Result<(String, Option { if p == 1 { - if let Some(mut e) = v.last_mut() { + if let Some(e) = v.last_mut() { e.1 = &hv[if hv[j] == b'"' && hv[i - 1] == b'"' { j + 1..i - 1 } else { diff --git a/tests/lib/limited.rs b/tests/lib/limited.rs index 5d29b15..97a0b1d 100644 --- a/tests/lib/limited.rs +++ b/tests/lib/limited.rs @@ -61,7 +61,7 @@ impl fmt::Debug for Limited { .field("eof", &self.eof) .field("limit", &self.limit) .field("length", &self.length) - .finish() + .finish_non_exhaustive() } }