From 5650b1d8474e1ca8485bdfebe4c629e14c9e500c Mon Sep 17 00:00:00 2001 From: noisyfox Date: Tue, 13 Dec 2016 02:42:08 +1100 Subject: [PATCH] Use compiled regex --- shadowsocks-csharp/Controller/Service/HttpHandler.cs | 2 +- shadowsocks-csharp/ForwardProxy/HttpProxy.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/shadowsocks-csharp/Controller/Service/HttpHandler.cs b/shadowsocks-csharp/Controller/Service/HttpHandler.cs index 36804d4..12bb486 100644 --- a/shadowsocks-csharp/Controller/Service/HttpHandler.cs +++ b/shadowsocks-csharp/Controller/Service/HttpHandler.cs @@ -64,7 +64,7 @@ namespace Shadowsocks.Controller.Service Close(); } - private static readonly Regex HttpRequestHeaderRegex = new Regex(@"^(?[A-Z]+?) (?[^\s]+) (?HTTP/1\.\d)$"); + private static readonly Regex HttpRequestHeaderRegex = new Regex(@"^(?[A-Z]+?) (?[^\s]+) (?HTTP/1\.\d)$", RegexOptions.Compiled); private int _requestLineCount = 0; private bool _isConnect = false; diff --git a/shadowsocks-csharp/ForwardProxy/HttpProxy.cs b/shadowsocks-csharp/ForwardProxy/HttpProxy.cs index 5fe3f82..dbc8bd7 100644 --- a/shadowsocks-csharp/ForwardProxy/HttpProxy.cs +++ b/shadowsocks-csharp/ForwardProxy/HttpProxy.cs @@ -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;