From 9674dfa5dca8e91a27fc69bb9343103ab62f3cfa Mon Sep 17 00:00:00 2001 From: lmq8267 <119713693+lmq8267@users.noreply.github.com> Date: Mon, 10 Mar 2025 20:07:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=BF=E6=8D=A2=E5=89=8D=E7=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vnt/src/channel/ws_channel.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/vnt/src/channel/ws_channel.rs b/vnt/src/channel/ws_channel.rs index bb7409a..b11eed8 100644 --- a/vnt/src/channel/ws_channel.rs +++ b/vnt/src/channel/ws_channel.rs @@ -103,7 +103,16 @@ where if let Ok(redirect) = v.to_str() { log::info!("url重定向响应头 {:?}", res.headers()); log::info!("url重定向地址 {}", redirect); - url = redirect.to_string(); + // 替换协议前缀 + if redirect.starts_with("http://") { + url = redirect.replacen("http://", "ws://", 1); + } else if redirect.starts_with("https://") { + url = redirect.replacen("https://", "wss://", 1); + } else { + url = redirect.to_string(); + } + println!("Location:{}", url); + log::info!("修改后的重定向地址: {}", url); continue; } }