diff --git a/v2rayN/v2rayN/Forms/MainForm.cs b/v2rayN/v2rayN/Forms/MainForm.cs index bef32c86..1ac1e578 100644 --- a/v2rayN/v2rayN/Forms/MainForm.cs +++ b/v2rayN/v2rayN/Forms/MainForm.cs @@ -9,6 +9,7 @@ using v2rayN.Handler; using v2rayN.HttpProxyHandler; using v2rayN.Mode; using v2rayN.Base; +using System.Net; namespace v2rayN.Forms { @@ -1366,7 +1367,14 @@ namespace v2rayN.Forms AppendText(true, args.GetException().Message); }; - downloadHandle3.WebDownloadString(url); + IWebProxy proxy = null; + + if (config.index >= 0 && config.vmess.Count > 0) + { + proxy = new WebProxy(Global.Loopback, config.GetLocalPort(Global.InboundHttp)); + } + + downloadHandle3.WebDownloadString(url, proxy); AppendText(false, $"{hashCode}{UIRes.I18N("MsgStartGettingSubscriptions")}"); } diff --git a/v2rayN/v2rayN/Handler/DownloadHandle.cs b/v2rayN/v2rayN/Handler/DownloadHandle.cs index 68f5d9db..54849eb6 100644 --- a/v2rayN/v2rayN/Handler/DownloadHandle.cs +++ b/v2rayN/v2rayN/Handler/DownloadHandle.cs @@ -188,7 +188,7 @@ namespace v2rayN.Handler /// DownloadString /// /// - public void WebDownloadString(string url) + public void WebDownloadString(string url, IWebProxy proxy = null) { string source = string.Empty; try @@ -196,6 +196,12 @@ namespace v2rayN.Handler SetSecurityProtocol(); WebClientEx ws = new WebClientEx(); + + if (proxy != null) + { + ws.Proxy = proxy; + } + ws.DownloadStringCompleted += Ws_DownloadStringCompleted; ws.DownloadStringAsync(new Uri(url)); }