Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ futures-util = { version = "0.3", default-features = false, features = ["sink"]
futures-channel = { version = "0.3.17", features = ["sink"]}
headers = "0.4"
http = "1"
http-body = "1"
http-body-util = "0.1.2"
hyper = { version = "1", features = ["server", "http1", "http2"] }
hyper = { version = "1", optional = true }
hyper-util = { version = "0.1.12", features = ["server", "server-graceful", "server-auto", "http1", "http2", "service", "tokio"], optional = true }
log = "0.4"
mime = "0.3"
Expand All @@ -40,7 +41,7 @@ scoped-tls = "1.0"
serde = "1.0"
serde_json = "1.0"
serde_urlencoded = "0.7.1"
tokio = { version = "1.0", features = ["fs", "sync", "time"] }
tokio = { version = "1.0", features = ["io-util", "fs", "sync", "time"] }
tokio-util = { version = "0.7.1", features = ["io"] }
tracing = { version = "0.1.21", default-features = false, features = ["log", "std"] }
tower-service = "0.3"
Expand All @@ -62,9 +63,9 @@ tokio-stream = { version = "0.1.1", features = ["net"] }
[features]
default = []
multipart = ["dep:multer"]
websocket = ["hyper/client", "hyper/http1", "dep:tokio-tungstenite", "hyper-util/tokio"]
server = ["hyper/server", "hyper/http1", "hyper/http2", "dep:hyper-util", "tokio/net"]
test = ["server"]
websocket = ["dep:hyper", "dep:tokio-tungstenite", "hyper-util/tokio"]
server = ["dep:hyper", "dep:hyper-util", "tokio/net"]
test = ["server", "hyper/client", "hyper/http1"]
# tls might come back, uncertain
#tls = ["tokio-rustls", "rustls-pemfile"]

Expand Down
8 changes: 4 additions & 4 deletions src/bodyt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use std::task::{Context, Poll};
use bytes::Buf;
use bytes::Bytes;
use futures_util::StreamExt;
use http_body::Frame;
use http_body_util::{combinators::BoxBody, BodyExt};
use hyper::body::Frame;

#[derive(Debug)]
pub struct Body(BoxBody<Bytes, crate::Error>);
Expand All @@ -16,7 +16,7 @@ impl Default for Body {
}
}

impl hyper::body::Body for Body {
impl http_body::Body for Body {
type Data = Bytes;
type Error = crate::Error;

Expand All @@ -31,7 +31,7 @@ impl hyper::body::Body for Body {
self.0.is_end_stream()
}

fn size_hint(&self) -> hyper::body::SizeHint {
fn size_hint(&self) -> http_body::SizeHint {
self.0.size_hint()
}
}
Expand All @@ -47,7 +47,7 @@ impl Body {

pub(crate) fn wrap<B>(body: B) -> Self
where
B: hyper::body::Body + Send + Sync + 'static,
B: http_body::Body + Send + Sync + 'static,
B::Error: Into<Box<dyn std::error::Error + Send + Sync>>,
{
let body = body
Expand Down
2 changes: 1 addition & 1 deletion src/filter/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ where
F: Filter,
<F::Future as TryFuture>::Ok: Reply,
<F::Future as TryFuture>::Error: IsReject,
B: hyper::body::Body + Send + Sync + 'static,
B: http_body::Body + Send + Sync + 'static,
B::Error: Into<Box<dyn std::error::Error + Send + Sync>>,
{
type Response = Response;
Expand Down
3 changes: 1 addition & 2 deletions src/filters/compression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ use async_compression::tokio::bufread::BrotliEncoder;
use async_compression::tokio::bufread::{DeflateEncoder, GzipEncoder};

use crate::bodyt::Body;
use http::header::HeaderValue;
use hyper::header::{CONTENT_ENCODING, CONTENT_LENGTH};
use http::header::{HeaderValue, CONTENT_ENCODING, CONTENT_LENGTH};
use tokio_util::io::{ReaderStream, StreamReader};

use crate::filter::{Filter, WrapSealed};
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ pub use self::server::Server;
pub use self::service::service;
#[doc(hidden)]
pub use http;
#[cfg(any(feature = "server", feature = "websocket"))]
#[doc(hidden)]
pub use hyper;

Expand Down