From 1af40cee30e35bad95bf11d2d2f1718c231f6b23 Mon Sep 17 00:00:00 2001 From: 4t145 Date: Fri, 27 Oct 2023 11:11:12 +0800 Subject: [PATCH] fix #9 --- src/connection/tokio_connection.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/connection/tokio_connection.rs b/src/connection/tokio_connection.rs index d47bffa..f2c2ada 100644 --- a/src/connection/tokio_connection.rs +++ b/src/connection/tokio_connection.rs @@ -89,7 +89,11 @@ impl TokioConnection { .expect("should have headers"); let req = http_req_builder .uri(reqwest_req.url().as_str()) - .method("GET") + .header("Host", reqwest_req.url().host_str().unwrap_or_default()) + .header("Connection", "Upgrade") + .header("Upgrade", "websocket") + .header("Sec-WebSocket-Version", "13") + .header("Sec-WebSocket-Key", ws2::handshake::client::generate_key()) .body(()) .expect("shouldn't fail to build ssh req body"); let (mut ws_stream, _resp) = tokio_ws2::connect_async(req).await?;