summaryrefslogtreecommitdiff
path: root/ext/websocket/lib.rs
diff options
context:
space:
mode:
authorDivy Srivastava <dj.srivastava23@gmail.com>2023-04-28 21:30:27 +0530
committerGitHub <noreply@github.com>2023-04-28 18:00:27 +0200
commit8739519ebce4127af3fd3a0648d11e021b0084f9 (patch)
tree6c06e129fcccc5929f4fe79e8009848a505d5068 /ext/websocket/lib.rs
parent142c1ab9fcb6d88f36a8f9f096a59393525da7d0 (diff)
fix(ext/websocket): client connect URI (#18892)
Diffstat (limited to 'ext/websocket/lib.rs')
-rw-r--r--ext/websocket/lib.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/ext/websocket/lib.rs b/ext/websocket/lib.rs
index d2ec14ec3..2ce141fc9 100644
--- a/ext/websocket/lib.rs
+++ b/ext/websocket/lib.rs
@@ -184,7 +184,12 @@ where
let root_cert_store = state.borrow().borrow::<WsRootStore>().0.clone();
let user_agent = state.borrow().borrow::<WsUserAgent>().0.clone();
let uri: Uri = url.parse()?;
- let mut request = Request::builder().method(Method::GET).uri(&uri);
+ let mut request = Request::builder().method(Method::GET).uri(
+ uri
+ .path_and_query()
+ .ok_or(type_error("Missing path in url".to_string()))?
+ .as_str(),
+ );
let authority = uri.authority().unwrap().as_str();
let host = authority
@@ -195,7 +200,7 @@ where
.header("User-Agent", user_agent)
.header("Host", host)
.header(UPGRADE, "websocket")
- .header(CONNECTION, "upgrade")
+ .header(CONNECTION, "Upgrade")
.header(
"Sec-WebSocket-Key",
fastwebsockets::handshake::generate_key(),