diff --git a/src/tunnel/server/handler_websocket.rs b/src/tunnel/server/handler_websocket.rs index 5599c9b..44e6df8 100644 --- a/src/tunnel/server/handler_websocket.rs +++ b/src/tunnel/server/handler_websocket.rs @@ -47,7 +47,13 @@ pub(super) async fn ws_server_upgrade( tokio::spawn( async move { let (ws_rx, ws_tx) = match fut.await { - Ok(ws) => mk_websocket_tunnel(ws, Role::Server, mask_frame)?, + Ok(ws) => match mk_websocket_tunnel(ws, Role::Server, mask_frame) { + Ok(ws) => ws, + Err(err) => { + error!("Error during http upgrade request: {:?}", err); + return Err(err); + } + }, Err(err) => { error!("Error during http upgrade request: {:?}", err); return Err(anyhow::Error::from(err)); diff --git a/src/tunnel/transport/websocket.rs b/src/tunnel/transport/websocket.rs index 95e2623..3f53453 100644 --- a/src/tunnel/transport/websocket.rs +++ b/src/tunnel/transport/websocket.rs @@ -319,8 +319,7 @@ pub fn mk_websocket_tunnel( WebSocket::after_handshake(transport, role) } Err(upgraded) => { - let stream = upgraded - .downcast::>() + let stream = hyper_util::server::conn::auto::upgrade::downcast::>(upgraded) .map_err(|_| anyhow!("cannot downcast websocket server stream"))?; let transport = TransportStream::from_tcp(stream.io.into_inner(), stream.read_buf); WebSocket::after_handshake(transport, role)