Remove net451 as a cross-compile target
This commit is contained in:
parent
0586fd136f
commit
53946e9856
|
|
@ -1,6 +1,6 @@
|
|||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.26202.1
|
||||
VisualStudioVersion = 15.0.26228.9
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{99D5E5F3-88F5-4CCF-8D8C-717C8925DF09}"
|
||||
EndProject
|
||||
|
|
@ -34,6 +34,7 @@ EndProject
|
|||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{85914BA9-4168-48C5-9C3F-E2E8B1479A6E}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
build\common.props = build\common.props
|
||||
build\dependencies.props = build\dependencies.props
|
||||
build\Key.snk = build\Key.snk
|
||||
EndProjectSection
|
||||
EndProject
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
<CoreFxVersion>4.3.0</CoreFxVersion>
|
||||
<NetStandardImplicitPackageVersion>1.6.1</NetStandardImplicitPackageVersion>
|
||||
<RuntimeFrameworkVersion>2.0.0-*</RuntimeFrameworkVersion>
|
||||
<SystemNetHttpVersion>4.3.1</SystemNetHttpVersion>
|
||||
<TestSdkVersion>15.0.0</TestSdkVersion>
|
||||
<XunitVersion>2.2.0</XunitVersion>
|
||||
</PropertyGroup>
|
||||
|
|
|
|||
|
|
@ -3,16 +3,13 @@
|
|||
<Import Project="..\..\build\dependencies.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net451;netcoreapp2.0</TargetFrameworks>
|
||||
<TargetFrameworks>net46;netcoreapp2.0</TargetFrameworks>
|
||||
<OutputType>Exe</OutputType>
|
||||
<ServerGarbageCollection>true</ServerGarbageCollection>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\Microsoft.AspNetCore.Server.HttpSys\Microsoft.AspNetCore.Server.HttpSys.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="$(AspNetCoreVersion)" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
|||
|
|
@ -3,16 +3,13 @@
|
|||
<Import Project="..\..\build\dependencies.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net451;netcoreapp2.0</TargetFrameworks>
|
||||
<TargetFrameworks>net46;netcoreapp2.0</TargetFrameworks>
|
||||
<OutputType>Exe</OutputType>
|
||||
<ServerGarbageCollection>true</ServerGarbageCollection>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\Microsoft.AspNetCore.Server.HttpSys\Microsoft.AspNetCore.Server.HttpSys.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="$(AspNetCoreVersion)" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<Description>ASP.NET Core HTTP server that uses the Windows HTTP Server API.</Description>
|
||||
<TargetFrameworks>net451;netstandard1.3</TargetFrameworks>
|
||||
<TargetFrameworks>net46;netstandard1.3</TargetFrameworks>
|
||||
<NoWarn>$(NoWarn);CS1591</NoWarn>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
|
|
@ -16,11 +16,11 @@
|
|||
<PackageReference Include="Microsoft.Extensions.RuntimeEnvironment.Sources" Version="$(AspNetCoreVersion)" PrivateAssets="All" />
|
||||
<PackageReference Include="Microsoft.Extensions.TaskCache.Sources" Version="$(AspNetCoreVersion)" PrivateAssets="All" />
|
||||
<PackageReference Include="Microsoft.Net.Http.Headers" Version="$(AspNetCoreVersion)" />
|
||||
<PackageReference Include="System.Threading.Overlapped" Version="$(CoreFxVersion)" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.3' ">
|
||||
<PackageReference Include="System.Security.Principal.Windows" Version="$(CoreFxVersion)" />
|
||||
<PackageReference Include="System.Threading.Overlapped" Version="$(CoreFxVersion)" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
namespace Microsoft.AspNetCore.Server.HttpSys
|
||||
{
|
||||
#if NET451
|
||||
#if NET46
|
||||
/// <devdoc>
|
||||
/// <para>
|
||||
/// Specifies the address families that an instance of the <see cref="System.Net.Sockets.Socket"/>
|
||||
|
|
|
|||
|
|
@ -1,88 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
#if !NETSTANDARD1_3 // TODO: Temp copy. Remove once we target net46.
|
||||
using System;
|
||||
namespace System.Threading
|
||||
{
|
||||
internal struct DeferredDisposableLifetime<T> where T : class, IDeferredDisposable
|
||||
{
|
||||
private int _count;
|
||||
public bool AddRef(T obj)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
int num = Volatile.Read(ref this._count);
|
||||
if (num < 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
int num2 = checked(num + 1);
|
||||
if (Interlocked.CompareExchange(ref this._count, num2, num) == num)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
throw new ObjectDisposedException(typeof(T).ToString());
|
||||
}
|
||||
public void Release(T obj)
|
||||
{
|
||||
int num2;
|
||||
int num3;
|
||||
while (true)
|
||||
{
|
||||
int num = Volatile.Read(ref this._count);
|
||||
if (num > 0)
|
||||
{
|
||||
num2 = num - 1;
|
||||
if (Interlocked.CompareExchange(ref this._count, num2, num) == num)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
num3 = num + 1;
|
||||
if (Interlocked.CompareExchange(ref this._count, num3, num) == num)
|
||||
{
|
||||
goto Block_3;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (num2 == 0)
|
||||
{
|
||||
obj.OnFinalRelease(false);
|
||||
}
|
||||
return;
|
||||
Block_3:
|
||||
if (num3 == -1)
|
||||
{
|
||||
obj.OnFinalRelease(true);
|
||||
}
|
||||
}
|
||||
public void Dispose(T obj)
|
||||
{
|
||||
int num2;
|
||||
while (true)
|
||||
{
|
||||
int num = Volatile.Read(ref this._count);
|
||||
if (num < 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
num2 = -1 - num;
|
||||
if (Interlocked.CompareExchange(ref this._count, num2, num) == num)
|
||||
{
|
||||
goto Block_1;
|
||||
}
|
||||
}
|
||||
return;
|
||||
Block_1:
|
||||
if (num2 == -1)
|
||||
{
|
||||
obj.OnFinalRelease(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
#if !NETSTANDARD1_3 // TODO: Temp copy. Remove once we target net46.
|
||||
using System;
|
||||
namespace System.Threading
|
||||
{
|
||||
internal interface IDeferredDisposable
|
||||
{
|
||||
void OnFinalRelease(bool disposed);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
#if !NETSTANDARD1_3 // TODO: Temp copy. Remove once we target net46.
|
||||
using System;
|
||||
namespace System.Threading
|
||||
{
|
||||
internal sealed class PreAllocatedOverlapped : IDisposable, IDeferredDisposable
|
||||
{
|
||||
internal readonly ThreadPoolBoundHandleOverlapped _overlapped;
|
||||
private DeferredDisposableLifetime<PreAllocatedOverlapped> _lifetime;
|
||||
public PreAllocatedOverlapped(IOCompletionCallback callback, object state, object pinData)
|
||||
{
|
||||
if (callback == null)
|
||||
{
|
||||
throw new ArgumentNullException("callback");
|
||||
}
|
||||
this._overlapped = new ThreadPoolBoundHandleOverlapped(callback, state, pinData, this);
|
||||
}
|
||||
internal bool AddRef()
|
||||
{
|
||||
return this._lifetime.AddRef(this);
|
||||
}
|
||||
internal void Release()
|
||||
{
|
||||
this._lifetime.Release(this);
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
this._lifetime.Dispose(this);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
~PreAllocatedOverlapped()
|
||||
{
|
||||
if (!Environment.HasShutdownStarted)
|
||||
{
|
||||
this.Dispose();
|
||||
}
|
||||
}
|
||||
unsafe void IDeferredDisposable.OnFinalRelease(bool disposed)
|
||||
{
|
||||
if (disposed)
|
||||
{
|
||||
Overlapped.Free(this._overlapped._nativeOverlapped);
|
||||
return;
|
||||
}
|
||||
this._overlapped._boundHandle = null;
|
||||
this._overlapped._completed = false;
|
||||
*this._overlapped._nativeOverlapped = default(NativeOverlapped);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
@ -1,146 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
#if !NETSTANDARD1_3 // TODO: Temp copy. Remove once we target net46.
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
namespace System.Threading
|
||||
{
|
||||
internal sealed class ThreadPoolBoundHandle : IDisposable
|
||||
{
|
||||
private readonly SafeHandle _handle;
|
||||
private bool _isDisposed;
|
||||
public SafeHandle Handle
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._handle;
|
||||
}
|
||||
}
|
||||
private ThreadPoolBoundHandle(SafeHandle handle)
|
||||
{
|
||||
this._handle = handle;
|
||||
}
|
||||
public static ThreadPoolBoundHandle BindHandle(SafeHandle handle)
|
||||
{
|
||||
if (handle == null)
|
||||
{
|
||||
throw new ArgumentNullException("handle");
|
||||
}
|
||||
if (handle.IsClosed || handle.IsInvalid)
|
||||
{
|
||||
throw new ArgumentException("Invalid Handle", "handle");
|
||||
}
|
||||
try
|
||||
{
|
||||
ThreadPool.BindHandle(handle);
|
||||
}
|
||||
catch (Exception expr_38)
|
||||
{
|
||||
if (expr_38.HResult == -2147024890)
|
||||
{
|
||||
throw new ArgumentException("Invalid Handle", "handle");
|
||||
}
|
||||
if (expr_38.HResult == -2147024809)
|
||||
{
|
||||
throw new ArgumentException("Already Bound", "handle");
|
||||
}
|
||||
throw;
|
||||
}
|
||||
return new ThreadPoolBoundHandle(handle);
|
||||
}
|
||||
|
||||
public unsafe NativeOverlapped* AllocateNativeOverlapped(IOCompletionCallback callback, object state, object pinData)
|
||||
{
|
||||
if (callback == null)
|
||||
{
|
||||
throw new ArgumentNullException("callback");
|
||||
}
|
||||
this.EnsureNotDisposed();
|
||||
return new ThreadPoolBoundHandleOverlapped(callback, state, pinData, null)
|
||||
{
|
||||
_boundHandle = this
|
||||
}._nativeOverlapped;
|
||||
}
|
||||
|
||||
public unsafe NativeOverlapped* AllocateNativeOverlapped(PreAllocatedOverlapped preAllocated)
|
||||
{
|
||||
if (preAllocated == null)
|
||||
{
|
||||
throw new ArgumentNullException("preAllocated");
|
||||
}
|
||||
this.EnsureNotDisposed();
|
||||
preAllocated.AddRef();
|
||||
NativeOverlapped* nativeOverlapped;
|
||||
try
|
||||
{
|
||||
ThreadPoolBoundHandleOverlapped expr_21 = preAllocated._overlapped;
|
||||
if (expr_21._boundHandle != null)
|
||||
{
|
||||
throw new ArgumentException("Already Allocated", "preAllocated");
|
||||
}
|
||||
expr_21._boundHandle = this;
|
||||
nativeOverlapped = expr_21._nativeOverlapped;
|
||||
}
|
||||
catch
|
||||
{
|
||||
preAllocated.Release();
|
||||
throw;
|
||||
}
|
||||
return nativeOverlapped;
|
||||
}
|
||||
|
||||
public unsafe void FreeNativeOverlapped(NativeOverlapped* overlapped)
|
||||
{
|
||||
if (overlapped == null)
|
||||
{
|
||||
throw new ArgumentNullException("overlapped");
|
||||
}
|
||||
ThreadPoolBoundHandleOverlapped overlappedWrapper = ThreadPoolBoundHandle.GetOverlappedWrapper(overlapped, this);
|
||||
if (overlappedWrapper._boundHandle != this)
|
||||
{
|
||||
throw new ArgumentException("Wrong bound handle", "overlapped");
|
||||
}
|
||||
if (overlappedWrapper._preAllocated != null)
|
||||
{
|
||||
overlappedWrapper._preAllocated.Release();
|
||||
return;
|
||||
}
|
||||
Overlapped.Free(overlapped);
|
||||
}
|
||||
|
||||
public unsafe static object GetNativeOverlappedState(NativeOverlapped* overlapped)
|
||||
{
|
||||
if (overlapped == null)
|
||||
{
|
||||
throw new ArgumentNullException("overlapped");
|
||||
}
|
||||
return ThreadPoolBoundHandle.GetOverlappedWrapper(overlapped, null)._userState;
|
||||
}
|
||||
private unsafe static ThreadPoolBoundHandleOverlapped GetOverlappedWrapper(NativeOverlapped* overlapped, ThreadPoolBoundHandle expectedBoundHandle)
|
||||
{
|
||||
ThreadPoolBoundHandleOverlapped result;
|
||||
try
|
||||
{
|
||||
result = (ThreadPoolBoundHandleOverlapped)Overlapped.Unpack(overlapped);
|
||||
}
|
||||
catch (NullReferenceException ex)
|
||||
{
|
||||
throw new ArgumentException("Already freed", "overlapped", ex);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
this._isDisposed = true;
|
||||
}
|
||||
private void EnsureNotDisposed()
|
||||
{
|
||||
if (this._isDisposed)
|
||||
{
|
||||
throw new ObjectDisposedException(base.GetType().ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
#if !NETSTANDARD1_3 // TODO: Temp copy. Remove once we target net46.
|
||||
using System;
|
||||
namespace System.Threading
|
||||
{
|
||||
internal sealed class ThreadPoolBoundHandleOverlapped : Overlapped
|
||||
{
|
||||
private readonly IOCompletionCallback _userCallback;
|
||||
internal readonly object _userState;
|
||||
internal PreAllocatedOverlapped _preAllocated;
|
||||
internal unsafe NativeOverlapped* _nativeOverlapped;
|
||||
internal ThreadPoolBoundHandle _boundHandle;
|
||||
internal bool _completed;
|
||||
public unsafe ThreadPoolBoundHandleOverlapped(IOCompletionCallback callback, object state, object pinData, PreAllocatedOverlapped preAllocated)
|
||||
{
|
||||
this._userCallback = callback;
|
||||
this._userState = state;
|
||||
this._preAllocated = preAllocated;
|
||||
this._nativeOverlapped = base.Pack(new IOCompletionCallback(ThreadPoolBoundHandleOverlapped.CompletionCallback), pinData);
|
||||
this._nativeOverlapped->OffsetLow = 0;
|
||||
this._nativeOverlapped->OffsetHigh = 0;
|
||||
}
|
||||
private unsafe static void CompletionCallback(uint errorCode, uint numBytes, NativeOverlapped* nativeOverlapped)
|
||||
{
|
||||
ThreadPoolBoundHandleOverlapped expr_0B = (ThreadPoolBoundHandleOverlapped)Overlapped.Unpack(nativeOverlapped);
|
||||
if (expr_0B._completed)
|
||||
{
|
||||
throw new InvalidOperationException("Native Overlapped reused");
|
||||
}
|
||||
expr_0B._completed = true;
|
||||
if (expr_0B._boundHandle == null)
|
||||
{
|
||||
throw new InvalidOperationException("Already freed");
|
||||
}
|
||||
expr_0B._userCallback.Invoke(errorCode, numBytes, nativeOverlapped);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
@ -9,7 +9,6 @@ using System.Threading.Tasks;
|
|||
using Microsoft.AspNetCore.Http.Features.Authentication;
|
||||
using Microsoft.AspNetCore.Testing.xunit;
|
||||
using Xunit;
|
||||
using AuthenticationSchemes = Microsoft.AspNetCore.Server.HttpSys.AuthenticationSchemes;
|
||||
|
||||
namespace Microsoft.AspNetCore.Server.HttpSys
|
||||
{
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys
|
|||
private async Task<string> SendRequestAsync(string uri,
|
||||
X509Certificate cert = null)
|
||||
{
|
||||
#if NET452
|
||||
#if NET46
|
||||
var handler = new WebRequestHandler();
|
||||
#elif NETCOREAPP2_0
|
||||
var handler = new WinHttpHandler();
|
||||
|
|
@ -122,7 +122,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys
|
|||
|
||||
private async Task<string> SendRequestAsync(string uri, string upload)
|
||||
{
|
||||
#if NET452
|
||||
#if NET46
|
||||
var handler = new WebRequestHandler();
|
||||
#elif NETCOREAPP2_0
|
||||
var handler = new WinHttpHandler();
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys.Listener
|
|||
private async Task<string> SendRequestAsync(string uri,
|
||||
X509Certificate cert = null)
|
||||
{
|
||||
#if NET452
|
||||
#if NET46
|
||||
WebRequestHandler handler = new WebRequestHandler();
|
||||
#elif NETCOREAPP2_0
|
||||
WinHttpHandler handler = new WinHttpHandler();
|
||||
|
|
@ -129,7 +129,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys.Listener
|
|||
|
||||
private async Task<string> SendRequestAsync(string uri, string upload)
|
||||
{
|
||||
#if NET452
|
||||
#if NET46
|
||||
WebRequestHandler handler = new WebRequestHandler();
|
||||
#elif NETCOREAPP2_0
|
||||
WinHttpHandler handler = new WinHttpHandler();
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys.Listener
|
|||
Assert.Equal("Hello World", response);
|
||||
}
|
||||
}
|
||||
#if NET452
|
||||
#if NET46
|
||||
[ConditionalFact]
|
||||
public async Task RequestBody_ReadBeginEnd_Success()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys.Listener
|
|||
var context = await server.AcceptAsync(Utilities.DefaultTimeout);
|
||||
context.Response.Headers["Content-lenGth"] = " 30 ";
|
||||
var stream = context.Response.Body;
|
||||
#if NET452
|
||||
#if NET46
|
||||
stream.EndWrite(stream.BeginWrite(new byte[10], 0, 10, null, null));
|
||||
#elif NETCOREAPP2_0
|
||||
await stream.WriteAsync(new byte[10], 0, 10);
|
||||
|
|
@ -131,7 +131,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys.Listener
|
|||
var context = await server.AcceptAsync(Utilities.DefaultTimeout);
|
||||
context.Response.Headers["Content-lenGth"] = " 20 ";
|
||||
context.Dispose();
|
||||
#if NET452
|
||||
#if NET46
|
||||
// HttpClient retries the request because it didn't get a response.
|
||||
context = await server.AcceptAsync(Utilities.DefaultTimeout);
|
||||
context.Response.Headers["Content-lenGth"] = " 20 ";
|
||||
|
|
@ -287,7 +287,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys.Listener
|
|||
var writeTask = context.Response.Body.WriteAsync(new byte[10], 0, 10, cts.Token);
|
||||
Assert.True(writeTask.IsCanceled);
|
||||
context.Dispose();
|
||||
#if NET452
|
||||
#if NET46
|
||||
// .NET 4.5 HttpClient automatically retries a request if it does not get a response.
|
||||
context = await server.AcceptAsync(Utilities.DefaultTimeout);
|
||||
cts = new CancellationTokenSource();
|
||||
|
|
@ -319,7 +319,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys.Listener
|
|||
var writeTask = context.Response.Body.WriteAsync(new byte[10], 0, 10, cts.Token);
|
||||
Assert.True(writeTask.IsCanceled);
|
||||
context.Dispose();
|
||||
#if NET452
|
||||
#if NET46
|
||||
// .NET 4.5 HttpClient automatically retries a request if it does not get a response.
|
||||
context = await server.AcceptAsync(Utilities.DefaultTimeout);
|
||||
cts = new CancellationTokenSource();
|
||||
|
|
|
|||
|
|
@ -223,7 +223,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys.Listener
|
|||
Assert.Equal("Microsoft-HTTPAPI/2.0", response.Headers["Server"]);
|
||||
#if NETCOREAPP2_0 // WebHeaderCollection.GetValues() not available in CoreCLR.
|
||||
Assert.Equal("custom1, and custom2, custom3", response.Headers["WWW-Authenticate"]);
|
||||
#elif NET452
|
||||
#elif NET46
|
||||
Assert.Equal(new string[] { "custom1, and custom2", "custom3" }, response.Headers.GetValues("WWW-Authenticate"));
|
||||
#else
|
||||
#error Target framework needs to be updated
|
||||
|
|
@ -254,7 +254,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys.Listener
|
|||
Assert.Equal("Microsoft-HTTPAPI/2.0", response.Headers["Server"]);
|
||||
#if NETCOREAPP2_0 // WebHeaderCollection.GetValues() not available in CoreCLR.
|
||||
Assert.Equal("custom1, and custom2, custom3", response.Headers["Custom-Header1"]);
|
||||
#elif NET452
|
||||
#elif NET46
|
||||
Assert.Equal(new string[] { "custom1, and custom2", "custom3" }, response.Headers.GetValues("Custom-Header1"));
|
||||
#else
|
||||
#error Target framework needs to be updated
|
||||
|
|
|
|||
|
|
@ -362,7 +362,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys.Listener
|
|||
var writeTask = context.Response.SendFileAsync(AbsoluteFilePath, 0, null, cts.Token);
|
||||
Assert.True(writeTask.IsCanceled);
|
||||
context.Dispose();
|
||||
#if NET452
|
||||
#if NET46
|
||||
// .NET 4.5 HttpClient automatically retries a request if it does not get a response.
|
||||
context = await server.AcceptAsync(Utilities.DefaultTimeout);
|
||||
cts = new CancellationTokenSource();
|
||||
|
|
@ -394,7 +394,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys.Listener
|
|||
var writeTask = context.Response.SendFileAsync(AbsoluteFilePath, 0, null, cts.Token);
|
||||
Assert.True(writeTask.IsCanceled);
|
||||
context.Dispose();
|
||||
#if NET452
|
||||
#if NET46
|
||||
// .NET 4.5 HttpClient automatically retries a request if it does not get a response.
|
||||
context = await server.AcceptAsync(Utilities.DefaultTimeout);
|
||||
cts = new CancellationTokenSource();
|
||||
|
|
|
|||
|
|
@ -186,7 +186,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys.Listener
|
|||
context.Abort();
|
||||
Assert.True(canceled.WaitOne(interval), "Aborted");
|
||||
Assert.True(ct.IsCancellationRequested, "IsCancellationRequested");
|
||||
#if NET452
|
||||
#if NET46
|
||||
// HttpClient re-tries the request because it doesn't know if the request was received.
|
||||
context = await server.AcceptAsync(Utilities.DefaultTimeout);
|
||||
context.Abort();
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys.Listener
|
|||
{
|
||||
try
|
||||
{
|
||||
#if NET452
|
||||
#if NET46
|
||||
return !string.IsNullOrEmpty(System.DirectoryServices.ActiveDirectory.Domain.GetComputerDomain().Name);
|
||||
#elif NETCOREAPP2_0
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.Internal;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
|
@ -25,8 +24,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys.Listener
|
|||
static Utilities()
|
||||
{
|
||||
var win8Version = new Version(6, 2);
|
||||
|
||||
#if NET452
|
||||
#if NET46
|
||||
IsWin8orLater = (Environment.OSVersion.Version >= win8Version);
|
||||
#elif NETCOREAPP2_0
|
||||
IsWin8orLater = (new Version(RuntimeEnvironment.OperatingSystemVersion) >= win8Version);
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<Import Project="..\..\build\common.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>netcoreapp2.0;net452</TargetFrameworks>
|
||||
<TargetFrameworks>netcoreapp2.0;net46</TargetFrameworks>
|
||||
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
|
||||
|
|
@ -16,9 +16,10 @@
|
|||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(TestSdkVersion)" />
|
||||
<PackageReference Include="xunit" Version="$(XunitVersion)" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="$(XunitVersion)" />
|
||||
<PackageReference Include="System.Net.Http" Version="$(SystemNetHttpVersion)" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == 'net452' ">
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == 'net46' ">
|
||||
<Reference Include="System.DirectoryServices" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Net.Http.WebRequest" />
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys
|
|||
Assert.Equal("Hello World", response);
|
||||
}
|
||||
}
|
||||
#if NET452
|
||||
#if NET46
|
||||
[ConditionalFact]
|
||||
public async Task RequestBody_ReadBeginEnd_Success()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys
|
|||
{
|
||||
httpContext.Response.Headers["Content-lenGth"] = " 30 ";
|
||||
Stream stream = httpContext.Response.Body;
|
||||
#if NET452
|
||||
#if NET46
|
||||
stream.EndWrite(stream.BeginWrite(new byte[10], 0, 10, null, null));
|
||||
#elif NETCOREAPP2_0
|
||||
await stream.WriteAsync(new byte[10], 0, 10);
|
||||
|
|
@ -223,7 +223,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys
|
|||
Assert.Equal(new byte[10], await response.Content.ReadAsByteArrayAsync());
|
||||
}
|
||||
}
|
||||
#if NET452
|
||||
#if NET46
|
||||
[ConditionalFact]
|
||||
public async Task ResponseBody_BeginWrite_TriggersOnStarting()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys
|
|||
Assert.Equal("Microsoft-HTTPAPI/2.0", response.Headers["Server"]);
|
||||
#if NETCOREAPP2_0 // WebHeaderCollection.GetValues() not available in CoreCLR.
|
||||
Assert.Equal("custom1, and custom2, custom3", response.Headers["WWW-Authenticate"]);
|
||||
#elif NET452
|
||||
#elif NET46
|
||||
Assert.Equal(new string[] { "custom1, and custom2", "custom3" }, response.Headers.GetValues("WWW-Authenticate"));
|
||||
#else
|
||||
#error Target framework needs to be updated
|
||||
|
|
@ -113,7 +113,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys
|
|||
Assert.Equal("Microsoft-HTTPAPI/2.0", response.Headers["Server"]);
|
||||
#if NETCOREAPP2_0 // WebHeaderCollection.GetValues() not available in CoreCLR.
|
||||
Assert.Equal("custom1, and custom2, custom3", response.Headers["Custom-Header1"]);
|
||||
#elif NET452
|
||||
#elif NET46
|
||||
Assert.Equal(new string[] { "custom1, and custom2", "custom3" }, response.Headers.GetValues("Custom-Header1"));
|
||||
#else
|
||||
#error Target framework needs to be updated
|
||||
|
|
|
|||
|
|
@ -3,15 +3,12 @@
|
|||
<Import Project="..\..\build\common.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>netcoreapp2.0;net452</TargetFrameworks>
|
||||
<TargetFrameworks>netcoreapp2.0;net46</TargetFrameworks>
|
||||
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\Microsoft.AspNetCore.Server.HttpSys\Microsoft.AspNetCore.Server.HttpSys.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(TestSdkVersion)" />
|
||||
<PackageReference Include="xunit" Version="$(XunitVersion)" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="$(XunitVersion)" />
|
||||
|
|
|
|||
Loading…
Reference in New Issue