2dust 2019-09-30 17:32:34 +08:00
parent 37af5f372a
commit 4eb7f312b5
4 changed files with 19 additions and 17 deletions

View File

@ -62,7 +62,7 @@ namespace v2rayN.HttpProxyHandler
{ {
string address = ctx.Request.LocalEndPoint.Address.ToString(); string address = ctx.Request.LocalEndPoint.Address.ToString();
string rstr = _responderMethod(address); string rstr = _responderMethod(address);
byte[] buf = Encoding.ASCII.GetBytes(rstr); byte[] buf = Encoding.UTF8.GetBytes(rstr);
ctx.Response.StatusCode = 200; ctx.Response.StatusCode = 200;
ctx.Response.ContentType = "application/x-ns-proxy-autoconfig"; ctx.Response.ContentType = "application/x-ns-proxy-autoconfig";
ctx.Response.ContentLength64 = buf.Length; ctx.Response.ContentLength64 = buf.Length;

View File

@ -75,7 +75,7 @@ namespace v2rayN.HttpProxyHandler
public static List<string> ParseResult(string response) public static List<string> ParseResult(string response)
{ {
byte[] bytes = Convert.FromBase64String(response); byte[] bytes = Convert.FromBase64String(response);
string content = Encoding.ASCII.GetString(bytes); string content = Encoding.UTF8.GetString(bytes);
List<string> valid_lines = new List<string>(); List<string> valid_lines = new List<string>();
using (var sr = new StringReader(content)) using (var sr = new StringReader(content))
{ {

View File

@ -1,8 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Text; using System.Text;
using v2rayN.Mode; using v2rayN.Mode;
using v2rayN.Properties; using v2rayN.Properties;
@ -28,19 +26,22 @@ namespace v2rayN.HttpProxyHandler
public static void Init(Config config) public static void Init(Config config)
{ {
if (InitServer("*")) var serverB = new HttpWebServerB(Global.pacPort, SendResponse);
{ pacPort = Global.pacPort;
pacPort = Global.pacPort;
} //if (InitServer("*"))
else if (InitServer("127.0.0.1")) //{
{ // pacPort = Global.pacPort;
pacPort = Global.pacPort; //}
} //else if (InitServer("127.0.0.1"))
else //{
{ // pacPort = Global.pacPort;
Utils.SaveLog("Webserver init failed "); //}
pacPort = 0; //else
} //{
// Utils.SaveLog("Webserver init failed ");
// pacPort = 0;
//}
} }
private static bool InitServer(string address) private static bool InitServer(string address)

View File

@ -182,6 +182,7 @@
<Compile Include="Handler\StatisticsHandler.cs" /> <Compile Include="Handler\StatisticsHandler.cs" />
<Compile Include="Handler\V2rayUpdateHandle.cs" /> <Compile Include="Handler\V2rayUpdateHandle.cs" />
<Compile Include="HttpProxyHandler\HttpWebServer.cs" /> <Compile Include="HttpProxyHandler\HttpWebServer.cs" />
<Compile Include="HttpProxyHandler\HttpWebServerB.cs" />
<Compile Include="HttpProxyHandler\PACFileWatcherHandle.cs" /> <Compile Include="HttpProxyHandler\PACFileWatcherHandle.cs" />
<Compile Include="HttpProxyHandler\PrivoxyHandler.cs" /> <Compile Include="HttpProxyHandler\PrivoxyHandler.cs" />
<Compile Include="HttpProxyHandler\PACListHandle.cs" /> <Compile Include="HttpProxyHandler\PACListHandle.cs" />