From e4dad3b3c7e430ae9b7bfd872484abf4cba05358 Mon Sep 17 00:00:00 2001 From: Gilberto Polzoni Date: Sat, 2 Apr 2016 20:34:18 +0200 Subject: [PATCH 1/6] Implementation of RegExp for WebSocketService routing. See #239 --- websocket-sharp/Server/WebSocketServiceManager.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/websocket-sharp/Server/WebSocketServiceManager.cs b/websocket-sharp/Server/WebSocketServiceManager.cs index 8ed76b335..647147181 100644 --- a/websocket-sharp/Server/WebSocketServiceManager.cs +++ b/websocket-sharp/Server/WebSocketServiceManager.cs @@ -33,6 +33,8 @@ using System.Text; using System.Threading; using WebSocketSharp.Net; +using System.Linq; +using System.Text.RegularExpressions; namespace WebSocketSharp.Server { @@ -315,7 +317,12 @@ internal bool InternalTryGetServiceHost (string path, out WebSocketServiceHost h bool ret; lock (_sync) { path = HttpUtility.UrlDecode (path).TrimEndSlash (); - ret = _hosts.TryGetValue (path, out host); + + var results = from result in _hosts + where Regex.Match(path, result.Key, RegexOptions.Singleline).Success + select result; + ret = results.Count() != 0; + host = results.First().Value; } if (!ret) From 468370075c568d7fe8c9a949cce010d4d3ef240f Mon Sep 17 00:00:00 2001 From: Gilberto Polzoni Date: Sun, 3 Apr 2016 07:26:59 +0200 Subject: [PATCH 2/6] Better management in case of no match in regexp --- websocket-sharp/Server/WebSocketServiceManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/websocket-sharp/Server/WebSocketServiceManager.cs b/websocket-sharp/Server/WebSocketServiceManager.cs index 647147181..7fa51bc80 100644 --- a/websocket-sharp/Server/WebSocketServiceManager.cs +++ b/websocket-sharp/Server/WebSocketServiceManager.cs @@ -322,7 +322,7 @@ internal bool InternalTryGetServiceHost (string path, out WebSocketServiceHost h where Regex.Match(path, result.Key, RegexOptions.Singleline).Success select result; ret = results.Count() != 0; - host = results.First().Value; + host = results.FirstOrDefault().Value; } if (!ret) From cf2e774a6acfef9663b9a79635460fcc1bc325fd Mon Sep 17 00:00:00 2001 From: Gilberto Polzoni Date: Sun, 3 Apr 2016 10:32:12 +0200 Subject: [PATCH 3/6] VS2015 csproj convertion and added nuspec --- websocket-sharp/websocket-sharp.csproj | 9 +++++++-- websocket-sharp/websocket-sharp.nuspec | 16 ++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 websocket-sharp/websocket-sharp.nuspec diff --git a/websocket-sharp/websocket-sharp.csproj b/websocket-sharp/websocket-sharp.csproj index 087679547..63b4876ae 100644 --- a/websocket-sharp/websocket-sharp.csproj +++ b/websocket-sharp/websocket-sharp.csproj @@ -1,5 +1,5 @@ - - + + Debug AnyCPU @@ -12,6 +12,11 @@ v3.5 true websocket-sharp.snk + + + + + 3.5 true diff --git a/websocket-sharp/websocket-sharp.nuspec b/websocket-sharp/websocket-sharp.nuspec new file mode 100644 index 000000000..3cb131ad5 --- /dev/null +++ b/websocket-sharp/websocket-sharp.nuspec @@ -0,0 +1,16 @@ + + + + $id$ + $version$ + $title$ + $author$ + $author$ + false + $description$ + http://teamcity.loccioni.com/repository/download/Aulos_LoccioniAulosCSharp_Develop/1209:id/html/index.html + Copyright 2015 + https://trello-attachments.s3.amazonaws.com/55d5dbd19330afb229c8307e/128x128/053650646840a5f2193be3d047079bac/logo_nuget.png + https://git.loccioni.com/aulos/Loccioni-Aulos-CSharp + + \ No newline at end of file From 863700c49fe2f90955da70256a3c650f9ce03c5e Mon Sep 17 00:00:00 2001 From: Gilberto Polzoni Date: Sun, 3 Apr 2016 15:44:16 +0200 Subject: [PATCH 4/6] Added missing attribute for nuget spec --- websocket-sharp/AssemblyInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/websocket-sharp/AssemblyInfo.cs b/websocket-sharp/AssemblyInfo.cs index c85deaa45..21c03eb49 100644 --- a/websocket-sharp/AssemblyInfo.cs +++ b/websocket-sharp/AssemblyInfo.cs @@ -7,7 +7,7 @@ [assembly: AssemblyTitle("websocket-sharp")] [assembly: AssemblyDescription("A C# implementation of the WebSocket protocol client and server")] [assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] +[assembly: AssemblyCompany("sta.blockhead")] [assembly: AssemblyProduct("websocket-sharp.dll")] [assembly: AssemblyCopyright("sta.blockhead")] [assembly: AssemblyTrademark("")] From c6de54ee12d3ddc4d8e4bb7f0ac5dc7a2d8eb4bb Mon Sep 17 00:00:00 2001 From: Gilberto Polzoni Date: Mon, 18 Apr 2016 12:04:38 +0200 Subject: [PATCH 5/6] Solved bug that doesn't allow to send empty frame: - The problem appears in Chrome or Dark Websocket Terminal - Fixed assembly version --- websocket-sharp/AssemblyInfo.cs | 4 +++- websocket-sharp/WebSocketFrame.cs | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/websocket-sharp/AssemblyInfo.cs b/websocket-sharp/AssemblyInfo.cs index 21c03eb49..ecaf4e981 100644 --- a/websocket-sharp/AssemblyInfo.cs +++ b/websocket-sharp/AssemblyInfo.cs @@ -17,7 +17,9 @@ // The form "{Major}.{Minor}.*" will automatically update the build and revision, // and "{Major}.{Minor}.{Build}.*" will update just the revision. -[assembly: AssemblyVersion("1.0.2.*")] +[assembly: AssemblyVersion("1.0.2.0")] +[assembly: AssemblyFileVersion("1.0.2.0")] +[assembly: AssemblyInformationalVersion("1.0.2")] // The following attributes are used to specify the signing key for the assembly, // if desired. See the Mono documentation for more information about signing. diff --git a/websocket-sharp/WebSocketFrame.cs b/websocket-sharp/WebSocketFrame.cs index 219242c1d..859e87dbb 100644 --- a/websocket-sharp/WebSocketFrame.cs +++ b/websocket-sharp/WebSocketFrame.cs @@ -104,12 +104,12 @@ internal WebSocketFrame ( Fin fin, Opcode opcode, PayloadData payloadData, bool compressed, bool mask) { _fin = fin; - _rsv1 = opcode.IsData () && compressed ? Rsv.On : Rsv.Off; + var len = payloadData.Length; + _rsv1 = opcode.IsData () && compressed && len > 0 ? Rsv.On : Rsv.Off; _rsv2 = Rsv.Off; _rsv3 = Rsv.Off; _opcode = opcode; - var len = payloadData.Length; if (len < 126) { _payloadLength = (byte) len; _extPayloadLength = WebSocket.EmptyBytes; From 2fc1f6986fb1454ff12c9fd69f4513cb2f000830 Mon Sep 17 00:00:00 2001 From: Gilberto Polzoni Date: Mon, 18 Apr 2016 12:09:36 +0200 Subject: [PATCH 6/6] Changed version to prerelease --- websocket-sharp/AssemblyInfo.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/websocket-sharp/AssemblyInfo.cs b/websocket-sharp/AssemblyInfo.cs index ecaf4e981..15bf9a8af 100644 --- a/websocket-sharp/AssemblyInfo.cs +++ b/websocket-sharp/AssemblyInfo.cs @@ -17,9 +17,9 @@ // The form "{Major}.{Minor}.*" will automatically update the build and revision, // and "{Major}.{Minor}.{Build}.*" will update just the revision. -[assembly: AssemblyVersion("1.0.2.0")] -[assembly: AssemblyFileVersion("1.0.2.0")] -[assembly: AssemblyInformationalVersion("1.0.2")] +[assembly: AssemblyVersion("1.0.3.0")] +[assembly: AssemblyFileVersion("1.0.3.0")] +[assembly: AssemblyInformationalVersion("1.0.3-alpha")] // The following attributes are used to specify the signing key for the assembly, // if desired. See the Mono documentation for more information about signing.