Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RegExp in Service path for url routing. See #239 #240

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions websocket-sharp/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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("")]
Expand All @@ -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.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.
Expand Down
9 changes: 8 additions & 1 deletion websocket-sharp/Server/WebSocketServiceManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
using System.Text;
using System.Threading;
using WebSocketSharp.Net;
using System.Linq;
using System.Text.RegularExpressions;

namespace WebSocketSharp.Server
{
Expand Down Expand Up @@ -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.FirstOrDefault().Value;
}

if (!ret)
Expand Down
4 changes: 2 additions & 2 deletions websocket-sharp/WebSocketFrame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
9 changes: 7 additions & 2 deletions websocket-sharp/websocket-sharp.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="3.5" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
Expand All @@ -12,6 +12,11 @@
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>websocket-sharp.snk</AssemblyOriginatorKeyFile>
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>3.5</OldToolsVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down
16 changes: 16 additions & 0 deletions websocket-sharp/websocket-sharp.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0"?>
<package >
<metadata>
<id>$id$</id>
<version>$version$</version>
<title>$title$</title>
<authors>$author$</authors>
<owners>$author$</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>$description$</description>
<releaseNotes>http://teamcity.loccioni.com/repository/download/Aulos_LoccioniAulosCSharp_Develop/1209:id/html/index.html</releaseNotes>
<copyright>Copyright 2015</copyright>
<iconUrl>https://trello-attachments.s3.amazonaws.com/55d5dbd19330afb229c8307e/128x128/053650646840a5f2193be3d047079bac/logo_nuget.png</iconUrl>
<projectUrl>https://git.loccioni.com/aulos/Loccioni-Aulos-CSharp</projectUrl>
</metadata>
</package>