From a6a8b091cb6d6240b4aba17f5564e0cf5cbe5940 Mon Sep 17 00:00:00 2001 From: Kexy Biscuit Date: Wed, 16 Oct 2019 00:19:21 +0800 Subject: [PATCH 1/2] Format the proxy host name used in GfwListUpdater. Directly create a WebProxy with IPAddress.IPv6Loopback.ToString() throws UriFormatException. Format the proxy host name to satisfy WebProxy. --- shadowsocks-csharp/Controller/Service/GfwListUpdater.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/shadowsocks-csharp/Controller/Service/GfwListUpdater.cs b/shadowsocks-csharp/Controller/Service/GfwListUpdater.cs index d6f77345f..376b43a3c 100644 --- a/shadowsocks-csharp/Controller/Service/GfwListUpdater.cs +++ b/shadowsocks-csharp/Controller/Service/GfwListUpdater.cs @@ -94,7 +94,9 @@ public void UpdatePACFromGFWList(Configuration config) if (config.enabled) { http.Proxy = new WebProxy( - config.isIPv6Enabled ? IPAddress.IPv6Loopback.ToString() : IPAddress.Loopback.ToString(), + config.isIPv6Enabled + ? $"http://[{IPAddress.IPv6Loopback.ToString()}]" + : $"http://{IPAddress.Loopback.ToString()}", config.localPort); } http.DownloadStringCompleted += http_DownloadStringCompleted; From e2f1564b6df1c4da2fd5f1478bb51eda5c47cb0e Mon Sep 17 00:00:00 2001 From: Kexy Biscuit Date: Wed, 16 Oct 2019 01:02:25 +0800 Subject: [PATCH 2/2] Remove http:// part in proxy host name. Microsoft Docs is misleading, as always. dotnet/samples#1644 --- shadowsocks-csharp/Controller/Service/GfwListUpdater.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shadowsocks-csharp/Controller/Service/GfwListUpdater.cs b/shadowsocks-csharp/Controller/Service/GfwListUpdater.cs index 376b43a3c..3520014fd 100644 --- a/shadowsocks-csharp/Controller/Service/GfwListUpdater.cs +++ b/shadowsocks-csharp/Controller/Service/GfwListUpdater.cs @@ -95,8 +95,8 @@ public void UpdatePACFromGFWList(Configuration config) { http.Proxy = new WebProxy( config.isIPv6Enabled - ? $"http://[{IPAddress.IPv6Loopback.ToString()}]" - : $"http://{IPAddress.Loopback.ToString()}", + ? $"[{IPAddress.IPv6Loopback.ToString()}]" + : IPAddress.Loopback.ToString(), config.localPort); } http.DownloadStringCompleted += http_DownloadStringCompleted;