From 4eb7f312b50ed8eb59377046931213f1b0c443e7 Mon Sep 17 00:00:00 2001 From: 2dust Date: Mon, 30 Sep 2019 17:32:34 +0800 Subject: [PATCH] d --- .../v2rayN/HttpProxyHandler/HttpWebServer.cs | 2 +- .../v2rayN/HttpProxyHandler/PACListHandle.cs | 2 +- .../HttpProxyHandler/PACServerHandle.cs | 31 ++++++++++--------- v2rayN/v2rayN/v2rayN.csproj | 1 + 4 files changed, 19 insertions(+), 17 deletions(-) diff --git a/v2rayN/v2rayN/HttpProxyHandler/HttpWebServer.cs b/v2rayN/v2rayN/HttpProxyHandler/HttpWebServer.cs index f906da12..906f26d9 100644 --- a/v2rayN/v2rayN/HttpProxyHandler/HttpWebServer.cs +++ b/v2rayN/v2rayN/HttpProxyHandler/HttpWebServer.cs @@ -62,7 +62,7 @@ namespace v2rayN.HttpProxyHandler { string address = ctx.Request.LocalEndPoint.Address.ToString(); string rstr = _responderMethod(address); - byte[] buf = Encoding.ASCII.GetBytes(rstr); + byte[] buf = Encoding.UTF8.GetBytes(rstr); ctx.Response.StatusCode = 200; ctx.Response.ContentType = "application/x-ns-proxy-autoconfig"; ctx.Response.ContentLength64 = buf.Length; diff --git a/v2rayN/v2rayN/HttpProxyHandler/PACListHandle.cs b/v2rayN/v2rayN/HttpProxyHandler/PACListHandle.cs index 0fe8d066..2d021a3b 100644 --- a/v2rayN/v2rayN/HttpProxyHandler/PACListHandle.cs +++ b/v2rayN/v2rayN/HttpProxyHandler/PACListHandle.cs @@ -75,7 +75,7 @@ namespace v2rayN.HttpProxyHandler public static List ParseResult(string response) { byte[] bytes = Convert.FromBase64String(response); - string content = Encoding.ASCII.GetString(bytes); + string content = Encoding.UTF8.GetString(bytes); List valid_lines = new List(); using (var sr = new StringReader(content)) { diff --git a/v2rayN/v2rayN/HttpProxyHandler/PACServerHandle.cs b/v2rayN/v2rayN/HttpProxyHandler/PACServerHandle.cs index 29af2ed2..67c5d09e 100644 --- a/v2rayN/v2rayN/HttpProxyHandler/PACServerHandle.cs +++ b/v2rayN/v2rayN/HttpProxyHandler/PACServerHandle.cs @@ -1,8 +1,6 @@ using System; using System.Collections.Generic; using System.IO; -using System.Net; -using System.Net.Sockets; using System.Text; using v2rayN.Mode; using v2rayN.Properties; @@ -28,19 +26,22 @@ namespace v2rayN.HttpProxyHandler public static void Init(Config config) { - if (InitServer("*")) - { - pacPort = Global.pacPort; - } - else if (InitServer("127.0.0.1")) - { - pacPort = Global.pacPort; - } - else - { - Utils.SaveLog("Webserver init failed "); - pacPort = 0; - } + var serverB = new HttpWebServerB(Global.pacPort, SendResponse); + pacPort = Global.pacPort; + + //if (InitServer("*")) + //{ + // pacPort = Global.pacPort; + //} + //else if (InitServer("127.0.0.1")) + //{ + // pacPort = Global.pacPort; + //} + //else + //{ + // Utils.SaveLog("Webserver init failed "); + // pacPort = 0; + //} } private static bool InitServer(string address) diff --git a/v2rayN/v2rayN/v2rayN.csproj b/v2rayN/v2rayN/v2rayN.csproj index d2b769bd..5ad74255 100644 --- a/v2rayN/v2rayN/v2rayN.csproj +++ b/v2rayN/v2rayN/v2rayN.csproj @@ -182,6 +182,7 @@ +