Skip to content

Bump hyper v1.1 and http v1 #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: tokio-rustls-0.23
Choose a base branch
from
Open
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
9 changes: 5 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "hyper-proxy"
version = "0.10.1"
version = "0.10.2"
authors = ["Johann Tuffe <[email protected]>"]
description = "A proxy connector for Hyper-based applications"

Expand All @@ -15,10 +15,11 @@ edition = "2018"

[dependencies]
tokio = { version = "1", features = ["io-std", "io-util"] }
hyper = { version = "0.14", features = ["client"] }
hyper = { version = "1.1", features = ["client"] }
hyper-util = { version = "0.1.2", default-features = false, features = ["client-legacy", "tokio"] }

tower-service = "0.3"
http = "0.2"
http = "1"
futures-util = { version = "0.3", default-features = false }
bytes = "1.0"
hyper-tls = { version = "0.5.0", optional = true }
Expand All @@ -32,7 +33,7 @@ hyper-rustls = { version = "0.24", optional = true }
webpki = { version = "0.21", optional = true }
rustls-native-certs = { version = "0.6", optional = true }
webpki-roots = { version = "0.21.0", optional = true }
headers = "0.3"
headers = "0.4"

[dev-dependencies]
tokio = { version = "1.0", features = ["full"] }
Expand Down
22 changes: 12 additions & 10 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ mod stream;
mod tunnel;

use http::header::{HeaderMap, HeaderName, HeaderValue};
use hyper::{service::Service, Uri};
use hyper::Uri;

use tower_service::Service;

use futures_util::future::TryFutureExt;
#[cfg(feature = "rustls-base")]
Expand Down Expand Up @@ -458,19 +460,19 @@ where

fn call(&mut self, uri: Uri) -> Self::Future {
if let (Some(p), Some(host)) = (self.match_proxy(&uri), uri.host()) {
if uri.scheme() == Some(&http::uri::Scheme::HTTPS) || p.force_connect {
if uri.scheme() == Some(&hyper::http::uri::Scheme::HTTPS) || p.force_connect {
let host = host.to_owned();
let port =
uri.port_u16()
.unwrap_or(if uri.scheme() == Some(&http::uri::Scheme::HTTP) {
80
} else {
443
});
let port = uri.port_u16().unwrap_or(
if uri.scheme() == Some(&hyper::http::uri::Scheme::HTTP) {
80
} else {
443
},
);
let tunnel = tunnel::new(&host, port, &p.headers);
let connection =
proxy_dst(&uri, &p.uri).map(|proxy_url| self.connector.call(proxy_url));
let tls = if uri.scheme() == Some(&http::uri::Scheme::HTTPS) {
let tls = if uri.scheme() == Some(&hyper::http::uri::Scheme::HTTPS) {
self.tls.clone()
} else {
None
Expand Down
2 changes: 1 addition & 1 deletion src/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use tokio_native_tls::TlsStream;
#[cfg(feature = "openssl-tls")]
use tokio_openssl::SslStream as OpenSslStream;

use hyper::client::connect::{Connected, Connection};
use hyper_util::client::legacy::connect::{Connected, Connection};

#[cfg(feature = "rustls-base")]
pub type TlsStream<R> = RustlsStream<R>;
Expand Down