From e0f8ba1cf5e9044d1e4af2afee2c82a8e24cf4f3 Mon Sep 17 00:00:00 2001 From: zzzgydi Date: Wed, 20 Mar 2024 20:54:24 +0800 Subject: [PATCH] fix: window test error --- src/windows.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/windows.rs b/src/windows.rs index f65b4d7..ad4c733 100644 --- a/src/windows.rs +++ b/src/windows.rs @@ -118,9 +118,15 @@ impl Sysproxy { .unwrap_or("".into()); let server = server.as_str(); - let socket = SocketAddr::from_str(server).or(Err(Error::ParseStr(server.to_string())))?; - let host = socket.ip().to_string(); - let port = socket.port(); + let (host, port) = if server.is_empty() { + ("".into(), 0) + } else { + let socket = + SocketAddr::from_str(server).or(Err(Error::ParseStr(server.to_string())))?; + let host = socket.ip().to_string(); + let port = socket.port(); + (host, port) + }; let bypass = cur_var.get_value("ProxyOverride").unwrap_or("".into());