From 31365c9dd5e856d6166cb0a5c08fa34034041009 Mon Sep 17 00:00:00 2001 From: Toshit Chawda Date: Sat, 13 Jul 2024 22:30:47 -0700 Subject: [PATCH] remove tower from deps --- Cargo.lock | 39 +++++++++++++++-------------------- client/Cargo.toml | 3 +-- client/src/stream_provider.rs | 18 +++++----------- 3 files changed, 23 insertions(+), 37 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4af0d61..6e95c95 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -289,15 +289,15 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.6.0" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" +checksum = "a12916984aab3fa6e39d655a33e09c0071eb36d6ab3aea5c2d78551f1df6d952" [[package]] name = "cc" -version = "1.1.0" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaff6f8ce506b9773fa786672d63fc7a191ffea1be33f72bbd4aeacefca9ffc8" +checksum = "18e2d530f35b40a84124146478cd16f34225306a8441998836466a2e2961c950" [[package]] name = "certs-grabber" @@ -536,7 +536,6 @@ dependencies = [ "send_wrapper", "thiserror", "tokio", - "tower-service", "wasm-bindgen", "wasm-bindgen-futures", "wasm-streams", @@ -921,9 +920,9 @@ dependencies = [ [[package]] name = "http-body" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" dependencies = [ "bytes", "http 1.1.0", @@ -938,7 +937,7 @@ dependencies = [ "bytes", "futures-util", "http 1.1.0", - "http-body 1.0.0", + "http-body 1.0.1", "pin-project-lite", ] @@ -995,7 +994,7 @@ dependencies = [ "futures-util", "h2 0.4.5", "http 1.1.0", - "http-body 1.0.0", + "http-body 1.0.1", "httparse", "httpdate", "itoa", @@ -1026,7 +1025,7 @@ dependencies = [ "bytes", "futures-util", "http 1.1.0", - "http-body 1.0.0", + "http-body 1.0.1", "hyper 1.4.1", "pin-project-lite", "tokio", @@ -1035,20 +1034,16 @@ dependencies = [ [[package]] name = "hyper-util-wasm" version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "185e0d2e1af65e61860ad821d8ceafd38715f264f4abbed62456851ff5415e55" +source = "git+https://github.com/r58Playz/hyper-util-wasm?branch=opinionated#d36369d5280cb35078dde318d68affceeef32131" dependencies = [ "bytes", "futures-channel", "futures-util", "http 1.1.0", - "http-body 1.0.0", + "http-body 1.0.1", "hyper 1.4.1", "pin-project-lite", - "tower", - "tower-service", "tracing", - "wasm-bindgen", "wasmtimer", ] @@ -1802,9 +1797,9 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" -version = "2.0.70" +version = "2.0.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f0209b68b3613b093e0ec905354eccaedcfe83b8cb37cbdeae64026c3064c16" +checksum = "b146dcf730474b4bcd16c311627b31ede9ab149045db4d6088b3becaea046462" dependencies = [ "proc-macro2", "quote", @@ -1841,18 +1836,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.61" +version = "1.0.62" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" +checksum = "f2675633b1499176c2dff06b0856a27976a8f9d436737b4cf4f312d4d91d8bbb" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.61" +version = "1.0.62" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" +checksum = "d20468752b09f49e909e55a5d338caa8bedf615594e9d80bc4c565d30faf798c" dependencies = [ "proc-macro2", "quote", diff --git a/client/Cargo.toml b/client/Cargo.toml index f0c799d..b96d743 100644 --- a/client/Cargo.toml +++ b/client/Cargo.toml @@ -21,13 +21,12 @@ getrandom = { version = "0.2.15", features = ["js", "std"], optional = true } http = "1.1.0" http-body-util = "0.1.2" hyper = "1.3.1" -hyper-util-wasm = { version = "0.1.3", features = ["client-legacy", "http1"] } +hyper-util-wasm = { git = "https://github.com/r58Playz/hyper-util-wasm", branch = "opinionated", version = "0.1.7", features = ["client-legacy", "http1"] } js-sys = "0.3.69" pin-project-lite = "0.2.14" send_wrapper = "0.4.0" thiserror = "1.0.61" tokio = "1.38.0" -tower-service = "0.3.2" wasm-bindgen = "0.2.92" wasm-bindgen-futures = "0.4.42" wasm-streams = "0.4.0" diff --git a/client/src/stream_provider.rs b/client/src/stream_provider.rs index d2e209f..e926d61 100644 --- a/client/src/stream_provider.rs +++ b/client/src/stream_provider.rs @@ -7,11 +7,10 @@ use futures_rustls::{ use futures_util::{ future::Either, lock::{Mutex, MutexGuard}, AsyncRead, AsyncWrite, Future }; -use hyper_util_wasm::client::legacy::connect::{Connected, Connection}; +use hyper_util_wasm::client::legacy::connect::{ConnectSvc, Connected, Connection}; use js_sys::{Array, Reflect, Uint8Array}; use pin_project_lite::pin_project; use rustls_pki_types::{Der, TrustAnchor}; -use tower_service::Service; use wasm_bindgen::{JsCast, JsValue}; use wasm_bindgen_futures::spawn_local; use wisp_mux::{ @@ -225,19 +224,12 @@ impl Connection for HyperIo { #[derive(Clone)] pub struct StreamProviderService(pub Arc); -impl Service for StreamProviderService { - type Response = HyperIo; +impl ConnectSvc for StreamProviderService { + type Connection = HyperIo; type Error = EpoxyError; - type Future = Pin>>>; + type Future = Pin>>>; - fn poll_ready( - &mut self, - _: &mut std::task::Context<'_>, - ) -> std::task::Poll> { - Poll::Ready(Ok(())) - } - - fn call(&mut self, req: hyper::Uri) -> Self::Future { + fn connect(self, req: hyper::Uri) -> Self::Future { let provider = self.0.clone(); Box::pin(async move { let scheme = req.scheme_str().ok_or(EpoxyError::InvalidUrlScheme)?;