Skip to content

Commit

Permalink
Subprotocol Support
Browse files Browse the repository at this point in the history
Adds subprotocol support to close issue #45. Allows you to set a
SubProtocol string array on the server and client. Conforms to RFC6455
spec; client closes if subprotocol is invalid, and chooses based on
priority from first listed. Tested with chrome subprotocols.
  • Loading branch information
ajacksified committed Oct 17, 2012
1 parent d50174a commit 7fd6169
Show file tree
Hide file tree
Showing 17 changed files with 1,866 additions and 1,705 deletions.
5 changes: 5 additions & 0 deletions Alchemy.sln.DotSettings.user
@@ -0,0 +1,5 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeInspection/Highlighting/AnalysisEnabled/@EntryValue">SOLUTION</s:String>
<s:Boolean x:Key="/Default/Housekeeping/UnitTestingMru/UnitTestSessionPersistentData/=A8BEAF6DE74F4EC5BDE42EBCE8C19510/@KeyIndexDefined">True</s:Boolean>
<s:String x:Key="/Default/Housekeeping/UnitTestingMru/UnitTestSessionPersistentData/=A8BEAF6DE74F4EC5BDE42EBCE8C19510/Name/@EntryValue">ClientSendDataConcurrent</s:String>
<s:String x:Key="/Default/Housekeeping/UnitTestingMru/UnitTestSessionPersistentData/=A8BEAF6DE74F4EC5BDE42EBCE8C19510/XmlSerializedElements/@EntryValue">&lt;Session&gt;&lt;Elements&gt;&lt;UnitTestElement Provider="nUnit" Id="Alchemy.ClientServer" type="NUnitTestFixtureElement" Project="D7B6AB15-5986-4FDC-ADA8-9EF14DF8F26D" /&gt;&lt;UnitTestElement Provider="nUnit" Id="Alchemy.ClientServerSubProtocol" type="NUnitTestFixtureElement" Project="D7B6AB15-5986-4FDC-ADA8-9EF14DF8F26D" /&gt;&lt;UnitTestElement Provider="nUnit" Id="Alchemy.Handlers.WebSocket.hybi00.DataFrameTest" type="NUnitTestFixtureElement" Project="D62E2F92-A930-44D9-90FB-864CAF837BAE" /&gt;&lt;UnitTestElement Provider="nUnit" Id="Alchemy.Handlers.WebSocket.rfc6455.DataFrameTest" type="NUnitTestFixtureElement" Project="D62E2F92-A930-44D9-90FB-864CAF837BAE" /&gt;&lt;UnitTestElement Provider="nUnit" Id="Alchemy.Handlers.WebSocket.hybi00.DataFrameTest.BackAndForthBig" ParentId="Alchemy.Handlers.WebSocket.hybi00.DataFrameTest" type="NUnitTestElement" TypeName="Alchemy.Handlers.WebSocket.hybi00.DataFrameTest" MethodName="BackAndForthBig" Project="D62E2F92-A930-44D9-90FB-864CAF837BAE" /&gt;&lt;UnitTestElement Provider="nUnit" Id="Alchemy.Handlers.WebSocket.rfc6455.DataFrameTest.BackAndForthBig" ParentId="Alchemy.Handlers.WebSocket.rfc6455.DataFrameTest" type="NUnitTestElement" TypeName="Alchemy.Handlers.WebSocket.rfc6455.DataFrameTest" MethodName="BackAndForthBig" Project="D62E2F92-A930-44D9-90FB-864CAF837BAE" /&gt;&lt;UnitTestElement Provider="nUnit" Id="Alchemy.Handlers.WebSocket.rfc6455.DataFrameTest.BackAndForthMedium" ParentId="Alchemy.Handlers.WebSocket.rfc6455.DataFrameTest" type="NUnitTestElement" TypeName="Alchemy.Handlers.WebSocket.rfc6455.DataFrameTest" MethodName="BackAndForthMedium" Project="D62E2F92-A930-44D9-90FB-864CAF837BAE" /&gt;&lt;UnitTestElement Provider="nUnit" Id="Alchemy.Handlers.WebSocket.hybi00.DataFrameTest.BackAndForthMedium" ParentId="Alchemy.Handlers.WebSocket.hybi00.DataFrameTest" type="NUnitTestElement" TypeName="Alchemy.Handlers.WebSocket.hybi00.DataFrameTest" MethodName="BackAndForthMedium" Project="D62E2F92-A930-44D9-90FB-864CAF837BAE" /&gt;&lt;UnitTestElement Provider="nUnit" Id="Alchemy.Handlers.WebSocket.rfc6455.DataFrameTest.BackAndForthSmall" ParentId="Alchemy.Handlers.WebSocket.rfc6455.DataFrameTest" type="NUnitTestElement" TypeName="Alchemy.Handlers.WebSocket.rfc6455.DataFrameTest" MethodName="BackAndForthSmall" Project="D62E2F92-A930-44D9-90FB-864CAF837BAE" /&gt;&lt;UnitTestElement Provider="nUnit" Id="Alchemy.Handlers.WebSocket.hybi00.DataFrameTest.BackAndForthSmall" ParentId="Alchemy.Handlers.WebSocket.hybi00.DataFrameTest" type="NUnitTestElement" TypeName="Alchemy.Handlers.WebSocket.hybi00.DataFrameTest" MethodName="BackAndForthSmall" Project="D62E2F92-A930-44D9-90FB-864CAF837BAE" /&gt;&lt;UnitTestElement Provider="nUnit" Id="Alchemy.ClientServer.ClientConnect" ParentId="Alchemy.ClientServer" type="NUnitTestElement" TypeName="Alchemy.ClientServer" MethodName="ClientConnect" Project="D7B6AB15-5986-4FDC-ADA8-9EF14DF8F26D" /&gt;&lt;UnitTestElement Provider="nUnit" Id="Alchemy.ClientServer.ClientSendData" ParentId="Alchemy.ClientServer" type="NUnitTestElement" TypeName="Alchemy.ClientServer" MethodName="ClientSendData" Project="D7B6AB15-5986-4FDC-ADA8-9EF14DF8F26D" /&gt;&lt;UnitTestElement Provider="nUnit" Id="Alchemy.ClientServer.ClientSendDataConcurrent" ParentId="Alchemy.ClientServer" type="NUnitTestElement" TypeName="Alchemy.ClientServer" MethodName="ClientSendDataConcurrent" Project="D7B6AB15-5986-4FDC-ADA8-9EF14DF8F26D" /&gt;&lt;UnitTestElement Provider="nUnit" Id="Alchemy.ClientServerSubProtocol.ClientShoulConnectWithSecondaryValidProtocol" ParentId="Alchemy.ClientServerSubProtocol" type="NUnitTestElement" TypeName="Alchemy.ClientServerSubProtocol" MethodName="ClientShoulConnectWithSecondaryValidProtocol" Project="D7B6AB15-5986-4FDC-ADA8-9EF14DF8F26D" /&gt;&lt;UnitTestElement Provider="nUnit" Id="Alchemy.ClientServerSubProtocol.ClientShoulConnectWithValidProtocol" ParentId="Alchemy.ClientServerSubProtocol" type="NUnitTestElement" TypeName="Alchemy.ClientServerSubProtocol" MethodName="ClientShoulConnectWithValidProtocol" Project="D7B6AB15-5986-4FDC-ADA8-9EF14DF8F26D" /&gt;&lt;UnitTestElement Provider="nUnit" Id="Alchemy.ClientServerSubProtocol.ClientShouldNotConnectWithInvalidProtocol" ParentId="Alchemy.ClientServerSubProtocol" type="NUnitTestElement" TypeName="Alchemy.ClientServerSubProtocol" MethodName="ClientShouldNotConnectWithInvalidProtocol" Project="D7B6AB15-5986-4FDC-ADA8-9EF14DF8F26D" /&gt;&lt;/Elements&gt;&lt;/Session&gt;</s:String></wpf:ResourceDictionary>
204 changes: 102 additions & 102 deletions src/Alchemy/Alchemy.csproj
@@ -1,103 +1,103 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{45486CDE-86A3-4769-952F-E0821BF79493}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Alchemy</RootNamespace>
<AssemblyName>Alchemy</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
<CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
<CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Web" />
<Reference Include="System.XML" />
</ItemGroup>
<ItemGroup>
<Compile Include="AccessPolicyServer.cs" />
<Compile Include="Classes\Context.cs" />
<Compile Include="Handlers\Authentication.cs" />
<Compile Include="Handlers\IAuthentication.cs" />
<Compile Include="Handlers\WebSocket\DataFrame.cs" />
<Compile Include="Handlers\WebSocket\hybi00\DataFrame.cs" />
<Compile Include="Handlers\WebSocket\hybi10\DataFrame.cs" />
<Compile Include="Classes\Header.cs" />
<Compile Include="Classes\Response.cs" />
<Compile Include="Classes\UserContext.cs" />
<Compile Include="Handlers\Handler.cs" />
<Compile Include="Handlers\WebSocket\hybi00\Handler.cs" />
<Compile Include="Handlers\WebSocket\hybi00\Handshakes.cs" />
<Compile Include="Handlers\WebSocket\hybi00\Authentication.cs" />
<Compile Include="Handlers\WebSocket\hybi10\FrameHeader.cs" />
<Compile Include="Handlers\WebSocket\hybi10\Authentication.cs" />
<Compile Include="Handlers\WebSocket\hybi10\Handshakes.cs" />
<Compile Include="Handlers\WebSocket\hybi10\Handler.cs" />
<Compile Include="Handlers\WebSocket\WebSocketHandler.cs" />
<Compile Include="TcpServer.cs" />
<Compile Include="WebSocketClient.cs" />
<Compile Include="WebSocketServer.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Alchemy.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{45486CDE-86A3-4769-952F-E0821BF79493}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Alchemy</RootNamespace>
<AssemblyName>Alchemy</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
<CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
<CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Web" />
<Reference Include="System.XML" />
</ItemGroup>
<ItemGroup>
<Compile Include="AccessPolicyServer.cs" />
<Compile Include="Classes\Context.cs" />
<Compile Include="Handlers\Authentication.cs" />
<Compile Include="Handlers\IAuthentication.cs" />
<Compile Include="Handlers\WebSocket\DataFrame.cs" />
<Compile Include="Handlers\WebSocket\hybi00\DataFrame.cs" />
<Compile Include="Handlers\WebSocket\rfc6455\DataFrame.cs" />
<Compile Include="Classes\Header.cs" />
<Compile Include="Classes\Response.cs" />
<Compile Include="Classes\UserContext.cs" />
<Compile Include="Handlers\Handler.cs" />
<Compile Include="Handlers\WebSocket\hybi00\Handler.cs" />
<Compile Include="Handlers\WebSocket\hybi00\Handshakes.cs" />
<Compile Include="Handlers\WebSocket\hybi00\Authentication.cs" />
<Compile Include="Handlers\WebSocket\rfc6455\FrameHeader.cs" />
<Compile Include="Handlers\WebSocket\rfc6455\Authentication.cs" />
<Compile Include="Handlers\WebSocket\rfc6455\Handshakes.cs" />
<Compile Include="Handlers\WebSocket\rfc6455\Handler.cs" />
<Compile Include="Handlers\WebSocket\WebSocketHandler.cs" />
<Compile Include="TcpServer.cs" />
<Compile Include="WebSocketClient.cs" />
<Compile Include="WebSocketServer.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Alchemy.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

0 comments on commit 7fd6169

Please sign in to comment.