Browse Source

Use compiled regex

tags/3.4.1
noisyfox 8 years ago
parent
commit
5650b1d847
2 changed files with 2 additions and 2 deletions
  1. +1
    -1
      shadowsocks-csharp/Controller/Service/HttpHandler.cs
  2. +1
    -1
      shadowsocks-csharp/ForwardProxy/HttpProxy.cs

+ 1
- 1
shadowsocks-csharp/Controller/Service/HttpHandler.cs View File

@@ -64,7 +64,7 @@ namespace Shadowsocks.Controller.Service
Close();
}

private static readonly Regex HttpRequestHeaderRegex = new Regex(@"^(?<method>[A-Z]+?) (?<path>[^\s]+) (?<tail>HTTP/1\.\d)$");
private static readonly Regex HttpRequestHeaderRegex = new Regex(@"^(?<method>[A-Z]+?) (?<path>[^\s]+) (?<tail>HTTP/1\.\d)$", RegexOptions.Compiled);

private int _requestLineCount = 0;
private bool _isConnect = false;


+ 1
- 1
shadowsocks-csharp/ForwardProxy/HttpProxy.cs View File

@@ -165,7 +165,7 @@ namespace Shadowsocks.ForwardProxy
st.innerState.ex = ex;
}

private static readonly Regex HttpRespondHeaderRegex = new Regex(@"^(HTTP/1\.\d) (\d{3}) (.+)$");
private static readonly Regex HttpRespondHeaderRegex = new Regex(@"^(HTTP/1\.\d) (\d{3}) (.+)$", RegexOptions.Compiled);
private int _respondLineCount = 0;
private bool _established = false;



Loading…
Cancel
Save