Merge pull request #130 from lmq8267/patch-3

替换前缀
This commit is contained in:
vnt-dev
2025-04-25 18:01:29 +08:00
committed by GitHub
+10 -1
View File
@@ -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;
}
}