From 4081ea6cce3a9e55cf8cca4c6f83e6c63a15fceb Mon Sep 17 00:00:00 2001 From: CoolElectronics Date: Mon, 15 Jan 2024 14:37:55 -0500 Subject: [PATCH] fix r58 dum --- client/index.html | 2 +- client/src/websocket.rs | 15 +++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/client/index.html b/client/index.html index 99d1eb8..c8ff7ed 100644 --- a/client/index.html +++ b/client/index.html @@ -2,8 +2,8 @@ epoxy - + diff --git a/client/src/websocket.rs b/client/src/websocket.rs index 42937b8..ecd6601 100644 --- a/client/src/websocket.rs +++ b/client/src/websocket.rs @@ -26,7 +26,6 @@ pub struct EpxWebSocket { #[wasm_bindgen] impl EpxWebSocket { #[wasm_bindgen(constructor)] - /// DO NOT CALL THIS!!!!!!!!!!!!!!!!!!! pub fn new() -> Result { Err(jerr!("Use EpoxyClient.connect_ws() instead.")) } @@ -51,9 +50,16 @@ impl EpxWebSocket { let rand: [u8; 16] = rand::random(); let key = STANDARD.encode(rand); + + let pathstr = if let Some(p) = url.path_and_query() { + p.to_string() + } else { + url.path().to_string() + }; + let mut builder = Request::builder() .method("GET") - .uri(url.clone()) + .uri(pathstr) .header("Host", host) .header("Origin", origin) .header(UPGRADE, "websocket") @@ -69,8 +75,9 @@ impl EpxWebSocket { let stream = tcp.get_http_io(&url).await?; - let (mut sender, conn) = - hyper_conn::handshake::, Empty>(TokioIo::new(stream)) + let (mut sender, conn) = Builder::new() + .title_case_headers(true) + .preserve_header_case(true).handshake::, Empty>(TokioIo::new(stream)) .await?; wasm_bindgen_futures::spawn_local(async move {