This repository has been archived by the owner on Sep 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added packages for OWIN to solve #13
- Loading branch information
Showing
19 changed files
with
692 additions
and
295 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
dist/nuget/Microsoft.AspNet.WebApi.Extensions.Compression.Server.Owin.nuspec
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?xml version="1.0"?> | ||
<package > | ||
<metadata> | ||
<id>Microsoft.AspNet.WebApi.Extensions.Compression.Server.Owin</id> | ||
<version>2.0.0</version> | ||
<title>OWIN support for Microsoft.AspNet.WebApi.Extensions.Compression.Server</title> | ||
<authors>Ove Andersen</authors> | ||
<owners>EyeCatch</owners> | ||
<description>Package for supporting OWIN when using Microsoft ASP.NET Web API Compression Support</description> | ||
<summary>Package for supporting OWIN when using Microsoft ASP.NET Web API Compression Support.</summary> | ||
<language>en-US</language> | ||
<projectUrl>https://github.com/azzlack/Microsoft.AspNet.WebApi.MessageHandlers.Compression</projectUrl> | ||
<iconUrl>http://www.eyecatch.no/favicon.ico</iconUrl> | ||
<requireLicenseAcceptance>false</requireLicenseAcceptance> | ||
<licenseUrl>http://www.eyecatch.no/licenses/apache-20/</licenseUrl> | ||
<copyright>Copyright EyeCatch 2016</copyright> | ||
<dependencies> | ||
<dependency id="Microsoft.AspNet.WebApi.Owin" version="5.2.0" /> | ||
<dependency id="Microsoft.AspNet.WebApi.Extensions.Compression.Server" version="2.0.0" /> | ||
</dependencies> | ||
<references></references> | ||
<tags>aspnet webapi aspnetwebapi http compression gzip deflate eyecatch</tags> | ||
</metadata> | ||
<files> | ||
<file src="..\..\src\Server.Owin\bin\Release\Microsoft.AspNet.WebApi.Extensions.Compression.Server.Owin.dll" target="lib\net45" /> | ||
<file src="..\..\src\Server.Owin\bin\Release\Microsoft.AspNet.WebApi.Extensions.Compression.Server.Owin.pdb" target="lib\net45" /> | ||
<file src="..\..\src\Server.Owin\**\*.cs" exclude="**\obj\**\*.*" target="src" /> | ||
</files> | ||
</package> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 0 additions & 35 deletions
35
src/Microsoft.AspNet.WebApi.MessageHandlers.Compression.sln.GhostDoc.xml
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
namespace Microsoft.AspNet.WebApi.Extensions.Compression.Server.Owin | ||
{ | ||
using Microsoft.AspNet.WebApi.Extensions.Compression.Server; | ||
using Microsoft.Owin; | ||
using System; | ||
using System.Net.Http; | ||
using System.Net.Http.Extensions.Compression.Core.Interfaces; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
|
||
public class OwinServerCompressionHandler : ServerCompressionHandler | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="OwinServerCompressionHandler" /> class. | ||
/// </summary> | ||
/// <param name="compressors">The compressors.</param> | ||
public OwinServerCompressionHandler(params ICompressor[] compressors) | ||
: base(null, 860, null, compressors) | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="OwinServerCompressionHandler" /> class. | ||
/// </summary> | ||
/// <param name="contentSizeThreshold">The content size threshold before compressing.</param> | ||
/// <param name="compressors">The compressors.</param> | ||
public OwinServerCompressionHandler(int contentSizeThreshold, params ICompressor[] compressors) | ||
: base(null, contentSizeThreshold, null, compressors) | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="OwinServerCompressionHandler" /> class. | ||
/// </summary> | ||
/// <param name="innerHandler">The inner handler.</param> | ||
/// <param name="compressors">The compressors.</param> | ||
public OwinServerCompressionHandler(HttpMessageHandler innerHandler, params ICompressor[] compressors) | ||
: base(innerHandler, 860, null, compressors) | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="OwinServerCompressionHandler" /> class. | ||
/// </summary> | ||
/// <param name="innerHandler">The inner handler.</param> | ||
/// <param name="contentSizeThreshold">The content size threshold before compressing.</param> | ||
/// <param name="compressors">The compressors.</param> | ||
public OwinServerCompressionHandler(HttpMessageHandler innerHandler, int contentSizeThreshold, params ICompressor[] compressors) | ||
: base(innerHandler, contentSizeThreshold, null, compressors) | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="OwinServerCompressionHandler" /> class. | ||
/// </summary> | ||
/// <param name="innerHandler">The inner handler.</param> | ||
/// <param name="contentSizeThreshold">The content size threshold before compressing.</param> | ||
/// <param name="enableCompression">Custom delegate to enable or disable compression.</param> | ||
/// <param name="compressors">The compressors.</param> | ||
public OwinServerCompressionHandler(HttpMessageHandler innerHandler, int contentSizeThreshold, Predicate<HttpRequestMessage> enableCompression, params ICompressor[] compressors) | ||
: base(innerHandler, contentSizeThreshold, enableCompression, compressors) | ||
{ | ||
} | ||
|
||
/// <summary>Handles the request.</summary> | ||
/// <param name="request">The request.</param> | ||
/// <param name="cancellationToken">A cancellation token to cancel operation.</param> | ||
/// <returns>A Task<HttpResponseMessage></returns> | ||
public override Task<HttpRequestMessage> HandleRequest(HttpRequestMessage request, CancellationToken cancellationToken) | ||
{ | ||
request.GetOwinContext().Response.OnSendingHeaders( | ||
response => | ||
{ | ||
((IOwinResponse)response).Environment["HeadersWritten"] = true; | ||
}, | ||
request.GetOwinContext().Response); | ||
|
||
return base.HandleRequest(request, cancellationToken); | ||
} | ||
|
||
/// <summary>Handles the response.</summary> | ||
/// <param name="request">The request.</param> | ||
/// <param name="response">The response.</param> | ||
/// <param name="cancellationToken">A cancellation token to cancel operation.</param> | ||
/// <returns>The handled response.</returns> | ||
public override async Task<HttpResponseMessage> HandleResponse(HttpRequestMessage request, HttpResponseMessage response, CancellationToken cancellationToken) | ||
{ | ||
// Check if headers are already written, and skip processing if they are | ||
if (request.GetOwinContext().Response.Environment.ContainsKey("HeadersWritten")) | ||
{ | ||
bool written; | ||
bool.TryParse(request.GetOwinContext().Response.Environment["HeadersWritten"].ToString(), out written); | ||
|
||
if (written) | ||
{ | ||
return response; | ||
} | ||
} | ||
|
||
return await base.HandleResponse(request, response, cancellationToken); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using System.Reflection; | ||
using System.Runtime.InteropServices; | ||
|
||
// General Information about an assembly is controlled through the following | ||
// set of attributes. Change these attribute values to modify the information | ||
// associated with an assembly. | ||
[assembly: AssemblyTitle("Microsoft.AspNet.WebApi.Extensions.Compression.Server.Owin")] | ||
[assembly: AssemblyDescription("OWIN support for Microsoft.AspNet.WebApi.Extensions.Compression.Server")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("EyeCatch")] | ||
[assembly: AssemblyProduct("Microsoft.AspNet.WebApi.Extensions.Compression.Server.Owin")] | ||
[assembly: AssemblyCopyright("Copyright © EyeCatch 2016")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
// Setting ComVisible to false makes the types in this assembly not visible | ||
// to COM components. If you need to access a type in this assembly from | ||
// COM, set the ComVisible attribute to true on that type. | ||
[assembly: ComVisible(false)] | ||
|
||
// The following GUID is for the ID of the typelib if this project is exposed to COM | ||
[assembly: Guid("daa0a504-7ed7-4906-9d6b-fb566ae47084")] | ||
|
||
// Version information for an assembly consists of the following four values: | ||
// | ||
// Major Version | ||
// Minor Version | ||
// Build Number | ||
// Revision | ||
// | ||
// You can specify all the values or you can default the Build and Revision Numbers | ||
// by using the '*' as shown below: | ||
// [assembly: AssemblyVersion("1.0.*")] | ||
[assembly: AssemblyVersion("1.0.0.0")] | ||
[assembly: AssemblyFileVersion("1.0.0.0")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{DAA0A504-7ED7-4906-9D6B-FB566AE47084}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>Microsoft.AspNet.WebApi.Extensions.Compression.Server.Owin</RootNamespace> | ||
<AssemblyName>Microsoft.AspNet.WebApi.Extensions.Compression.Server.Owin</AssemblyName> | ||
<TargetFrameworkVersion>v4.5</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 Condition="'$(Configuration)|$(Platform)' == 'Test|AnyCPU'"> | ||
<DebugSymbols>true</DebugSymbols> | ||
<OutputPath>bin\Test\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<DebugType>full</DebugType> | ||
<PlatformTarget>AnyCPU</PlatformTarget> | ||
<ErrorReport>prompt</ErrorReport> | ||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="Microsoft.Owin, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\Microsoft.Owin.3.0.1\lib\net45\Microsoft.Owin.dll</HintPath> | ||
<Private>True</Private> | ||
</Reference> | ||
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\Newtonsoft.Json.6.0.4\lib\net45\Newtonsoft.Json.dll</HintPath> | ||
<Private>True</Private> | ||
</Reference> | ||
<Reference Include="Owin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f0ebd12fd5e55cc5, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath> | ||
<Private>True</Private> | ||
</Reference> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Net.Http.Formatting, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll</HintPath> | ||
<Private>True</Private> | ||
</Reference> | ||
<Reference Include="System.Web.Http, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\Microsoft.AspNet.WebApi.Core.5.2.3\lib\net45\System.Web.Http.dll</HintPath> | ||
<Private>True</Private> | ||
</Reference> | ||
<Reference Include="System.Web.Http.Owin, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\Microsoft.AspNet.WebApi.Owin.5.2.3\lib\net45\System.Web.Http.Owin.dll</HintPath> | ||
<Private>True</Private> | ||
</Reference> | ||
<Reference Include="System.Xml.Linq" /> | ||
<Reference Include="System.Data.DataSetExtensions" /> | ||
<Reference Include="Microsoft.CSharp" /> | ||
<Reference Include="System.Data" /> | ||
<Reference Include="System.Net.Http" /> | ||
<Reference Include="System.Xml" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="OwinServerCompressionHandler.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\Core\Core.csproj"> | ||
<Project>{b7534554-ab6c-44ac-bf34-424dbe596216}</Project> | ||
<Name>Core</Name> | ||
</ProjectReference> | ||
<ProjectReference Include="..\Server\Server.csproj"> | ||
<Project>{ee709c23-849d-43c5-9f47-0b8d8ddb43d8}</Project> | ||
<Name>Server</Name> | ||
</ProjectReference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="app.config" /> | ||
<None Include="packages.config" /> | ||
</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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<configuration> | ||
<runtime> | ||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> | ||
<dependentAssembly> | ||
<assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" /> | ||
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" /> | ||
</dependentAssembly> | ||
</assemblyBinding> | ||
</runtime> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net45" /> | ||
<package id="Microsoft.AspNet.WebApi.Core" version="5.2.3" targetFramework="net45" /> | ||
<package id="Microsoft.AspNet.WebApi.Owin" version="5.2.3" targetFramework="net45" /> | ||
<package id="Microsoft.Owin" version="3.0.1" targetFramework="net45" /> | ||
<package id="Newtonsoft.Json" version="6.0.4" targetFramework="net45" /> | ||
<package id="Owin" version="1.0" targetFramework="net45" /> | ||
</packages> |
Oops, something went wrong.