Skip to content
This repository was archived by the owner on Dec 20, 2018. It is now read-only.

netcoreapp2.0 #228

Merged
merged 5 commits into from
May 5, 2017
Merged
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
2 changes: 1 addition & 1 deletion build/dependencies.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<AspNetCoreVersion>2.0.0-preview1-*</AspNetCoreVersion>
<CoreFxVersion>4.3.0</CoreFxVersion>
<InternalAspNetCoreSdkVersion>2.0.0-*</InternalAspNetCoreSdkVersion>
<InternalAspNetCoreSdkVersion>2.1.0-*</InternalAspNetCoreSdkVersion>
<MoqVersion>4.7.1</MoqVersion>
<NETStandardImplicitPackageVersion>$(BundledNETStandardPackageVersion)</NETStandardImplicitPackageVersion>
<TestSdkVersion>15.0.0</TestSdkVersion>
Expand Down
2 changes: 1 addition & 1 deletion samples/HttpOverridesSample/HttpOverridesSample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Import Project="..\..\build\dependencies.props" />

<PropertyGroup>
<TargetFrameworks>net46;netcoreapp2.0</TargetFrameworks>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Import Project="..\..\build\dependencies.props" />

<PropertyGroup>
<TargetFrameworks>net46;netcoreapp2.0</TargetFrameworks>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Import Project="..\..\build\dependencies.props" />

<PropertyGroup>
<TargetFrameworks>net46;netcoreapp2.0</TargetFrameworks>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion samples/RewriteSample/RewriteSample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Import Project="..\..\build\dependencies.props" />

<PropertyGroup>
<TargetFrameworks>net46;netcoreapp2.0</TargetFrameworks>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
7 changes: 2 additions & 5 deletions src/Microsoft.AspNetCore.Buffering/BufferingWriteStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public override Task WriteAsync(byte[] buffer, int offset, int count, Cancellati
return _innerStream.WriteAsync(buffer, offset, count, cancellationToken);
}
}
#if NET46
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep these APIs


public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
{
if (_isBuffering)
Expand All @@ -184,10 +184,7 @@ public override void EndWrite(IAsyncResult asyncResult)
_innerStream.EndWrite(asyncResult);
}
}
#elif NETSTANDARD1_3
#else
#error target frameworks need to be updated
#endif

public override void Flush()
{
_isBuffering = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<PropertyGroup>
<VersionPrefix>0.3.0</VersionPrefix>
<Description>ASP.NET Core middleware for buffering response bodies.</Description>
<TargetFrameworks>net46;netstandard1.3</TargetFrameworks>
<TargetFramework>netcoreapp2.0</TargetFramework>
<NoWarn>$(NoWarn);CS1591</NoWarn>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageTags>aspnetcore;buffer;buffering</PackageTags>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<Description>ASP.NET Core basic middleware for supporting HTTP method overrides. Includes:
* X-Forwarded-* headers to forward headers from a proxy.
* HTTP method override header.</Description>
<TargetFramework>netstandard1.3</TargetFramework>
<TargetFramework>netcoreapp2.0</TargetFramework>
<NoWarn>$(NoWarn);CS1591</NoWarn>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageTags>aspnetcore;proxy;headers;xforwarded</PackageTags>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ public override void Write(byte[] buffer, int offset, int count)
}
}

#if NET46
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert

public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, Object state)
{
var tcs = new TaskCompletionSource<object>(state);
Expand Down Expand Up @@ -184,10 +183,6 @@ public override void EndWrite(IAsyncResult asyncResult)
var task = (Task)asyncResult;
task.GetAwaiter().GetResult();
}
#elif NETSTANDARD1_3
#else
#error target frameworks need to be updated
#endif

public override async Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@

using System;
using System.Collections.ObjectModel;
#if NETSTANDARD1_3
using System.Reflection;
#endif

namespace Microsoft.AspNetCore.ResponseCompression
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,7 @@ public bool SupportsFlush
{
get
{
#if NET46
return false;
#elif NETSTANDARD1_3
return true;
#else
#error target frameworks need to be updated
#endif
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<PropertyGroup>
<VersionPrefix>2.0.0</VersionPrefix>
<Description>ASP.NET Core middleware for HTTP Response compression.</Description>
<TargetFrameworks>net46;netstandard1.3</TargetFrameworks>
<TargetFramework>netcoreapp2.0</TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageTags>aspnetcore</PackageTags>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Support for custom URL rewrite rules
* Support for running IIS URL Rewrite module rules
* Support for running Apache mod_rewrite rules.</Description>
<TargetFramework>netstandard1.3</TargetFramework>
<TargetFramework>netcoreapp2.0</TargetFramework>
<NoWarn>$(NoWarn);CS1591</NoWarn>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageTags>aspnetcore;urlrewrite;mod_rewrite</PackageTags>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
<Import Project="..\..\build\common.props" />

<PropertyGroup>
<TargetFrameworks>netcoreapp2.0;net46</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
<Import Project="..\..\build\common.props" />

<PropertyGroup>
<TargetFrameworks>netcoreapp2.0;net46</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ public async Task SendFileAsync_IsPassedToUnderlyingStream_WhenDisableResponseBu
Assert.Equal(File.ReadAllBytes(path), written);
}

#if NET46
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert

[Theory]
[InlineData(true)]
[InlineData(false)]
Expand All @@ -133,10 +132,6 @@ public void BeginWrite_IsPassedToUnderlyingStream_WhenDisableResponseBuffering(b

Assert.Equal(buffer, written);
}
#elif NETCOREAPP2_0
#else
#error Target framework needs to be updated
#endif

private class MockResponseCompressionProvider: IResponseCompressionProvider
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
<Import Project="..\..\build\common.props" />

<PropertyGroup>
<TargetFrameworks>netcoreapp2.0;net46</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -505,16 +505,9 @@ public async Task TrickleWriteAndFlush_FlushesEachWrite()

var response = await client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead);

#if NET46 // Flush not supported, compression disabled
Assert.NotNull(response.Headers.GetValues(HeaderNames.ContentMD5));
Assert.Empty(response.Content.Headers.ContentEncoding);
#elif NETCOREAPP2_0 // Flush supported, compression enabled
IEnumerable<string> contentMD5 = null;
Assert.False(response.Headers.TryGetValues(HeaderNames.ContentMD5, out contentMD5));
Assert.Single(response.Content.Headers.ContentEncoding, "gzip");
#else
#error Target frameworks need to be updated.
#endif

var body = await response.Content.ReadAsStreamAsync();

Expand Down Expand Up @@ -570,16 +563,9 @@ public async Task TrickleWriteAndFlushAsync_FlushesEachWrite()

var response = await client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead);

#if NET46 // Flush not supported, compression disabled
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this work?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flush is supported on core

Assert.NotNull(response.Headers.GetValues(HeaderNames.ContentMD5));
Assert.Empty(response.Content.Headers.ContentEncoding);
#elif NETCOREAPP2_0 // Flush supported, compression enabled
IEnumerable<string> contentMD5 = null;
Assert.False(response.Headers.TryGetValues(HeaderNames.ContentMD5, out contentMD5));
Assert.Single(response.Content.Headers.ContentEncoding, "gzip");
#else
#error Target framework needs to be updated
#endif

var body = await response.Content.ReadAsStreamAsync();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
<Import Project="..\..\build\common.props" />

<PropertyGroup>
<TargetFrameworks>netcoreapp2.0;net46</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down