parent
87629bbad9
commit
6d442c1e3d
|
|
@ -74,27 +74,13 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal
|
|||
}
|
||||
else if (buffer.IsSingleSegment)
|
||||
{
|
||||
#if NETCOREAPP2_1
|
||||
await stream.WriteAsync(buffer.First);
|
||||
#elif NETSTANDARD2_0
|
||||
var array = buffer.First.GetArray();
|
||||
await stream.WriteAsync(array.Array, array.Offset, array.Count);
|
||||
#else
|
||||
#error TFMs need to be updated
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var memory in buffer)
|
||||
{
|
||||
#if NETCOREAPP2_1
|
||||
await stream.WriteAsync(memory);
|
||||
#elif NETSTANDARD2_0
|
||||
var array = memory.GetArray();
|
||||
await stream.WriteAsync(array.Array, array.Offset, array.Count);
|
||||
#else
|
||||
#error TFMs need to be updated
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -131,14 +117,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal
|
|||
{
|
||||
|
||||
var outputBuffer = Input.Writer.GetMemory(MinAllocBufferSize);
|
||||
#if NETCOREAPP2_1
|
||||
var bytesRead = await stream.ReadAsync(outputBuffer);
|
||||
#elif NETSTANDARD2_0
|
||||
var array = outputBuffer.GetArray();
|
||||
var bytesRead = await stream.ReadAsync(array.Array, array.Offset, array.Count);
|
||||
#else
|
||||
#error TFMs need to be updated
|
||||
#endif
|
||||
Input.Writer.Advance(bytesRead);
|
||||
|
||||
if (bytesRead == 0)
|
||||
|
|
|
|||
|
|
@ -83,17 +83,12 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal
|
|||
return read;
|
||||
}
|
||||
|
||||
#if NETCOREAPP2_1
|
||||
public override int Read(Span<byte> destination)
|
||||
{
|
||||
int read = _inner.Read(destination);
|
||||
Log("Read", destination.Slice(0, read));
|
||||
return read;
|
||||
}
|
||||
#elif NETSTANDARD2_0
|
||||
#else
|
||||
#error TFMs need to be updated
|
||||
#endif
|
||||
|
||||
public async override Task<int> ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
|
||||
{
|
||||
|
|
@ -102,17 +97,12 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal
|
|||
return read;
|
||||
}
|
||||
|
||||
#if NETCOREAPP2_1
|
||||
public override async ValueTask<int> ReadAsync(Memory<byte> destination, CancellationToken cancellationToken = default)
|
||||
{
|
||||
int read = await _inner.ReadAsync(destination, cancellationToken);
|
||||
Log("ReadAsync", destination.Span.Slice(0, read));
|
||||
return read;
|
||||
}
|
||||
#elif NETSTANDARD2_0
|
||||
#else
|
||||
#error TFMs need to be updated
|
||||
#endif
|
||||
|
||||
public override long Seek(long offset, SeekOrigin origin)
|
||||
{
|
||||
|
|
@ -130,16 +120,11 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal
|
|||
_inner.Write(buffer, offset, count);
|
||||
}
|
||||
|
||||
#if NETCOREAPP2_1
|
||||
public override void Write(ReadOnlySpan<byte> source)
|
||||
{
|
||||
Log("Write", source);
|
||||
_inner.Write(source);
|
||||
}
|
||||
#elif NETSTANDARD2_0
|
||||
#else
|
||||
#error TFMs need to be updated
|
||||
#endif
|
||||
|
||||
public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
|
||||
{
|
||||
|
|
@ -147,16 +132,11 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal
|
|||
return _inner.WriteAsync(buffer, offset, count, cancellationToken);
|
||||
}
|
||||
|
||||
#if NETCOREAPP2_1
|
||||
public override ValueTask WriteAsync(ReadOnlyMemory<byte> source, CancellationToken cancellationToken = default)
|
||||
{
|
||||
Log("WriteAsync", source.Span);
|
||||
return _inner.WriteAsync(source, cancellationToken);
|
||||
}
|
||||
#elif NETSTANDARD2_0
|
||||
#else
|
||||
#error TFMs need to be updated
|
||||
#endif
|
||||
|
||||
private void Log(string method, ReadOnlySpan<byte> buffer)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -69,15 +69,10 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal
|
|||
return ReadAsyncInternal(new Memory<byte>(buffer, offset, count)).AsTask();
|
||||
}
|
||||
|
||||
#if NETCOREAPP2_1
|
||||
public override ValueTask<int> ReadAsync(Memory<byte> destination, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return ReadAsyncInternal(destination);
|
||||
}
|
||||
#elif NETSTANDARD2_0
|
||||
#else
|
||||
#error TFMs need to be updated
|
||||
#endif
|
||||
|
||||
public override void Write(byte[] buffer, int offset, int count)
|
||||
{
|
||||
|
|
@ -94,16 +89,11 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal
|
|||
await _output.FlushAsync(cancellationToken);
|
||||
}
|
||||
|
||||
#if NETCOREAPP2_1
|
||||
public override async ValueTask WriteAsync(ReadOnlyMemory<byte> source, CancellationToken cancellationToken = default)
|
||||
{
|
||||
_output.Write(source.Span);
|
||||
await _output.FlushAsync(cancellationToken);
|
||||
}
|
||||
#elif NETSTANDARD2_0
|
||||
#else
|
||||
#error TFMs need to be updated
|
||||
#endif
|
||||
|
||||
public override void Flush()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -111,17 +111,12 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
|
|||
return ReadAsyncInternal(new Memory<byte>(buffer, offset, count), cancellationToken).AsTask();
|
||||
}
|
||||
|
||||
#if NETCOREAPP2_1
|
||||
public override ValueTask<int> ReadAsync(Memory<byte> destination, CancellationToken cancellationToken = default)
|
||||
{
|
||||
ValidateState(cancellationToken);
|
||||
|
||||
return ReadAsyncInternal(destination, cancellationToken);
|
||||
}
|
||||
#elif NETSTANDARD2_0
|
||||
#else
|
||||
#error TFMs need to be updated
|
||||
#endif
|
||||
|
||||
private async ValueTask<int> ReadAsyncInternal(Memory<byte> buffer, CancellationToken cancellationToken)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -112,17 +112,12 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
|
|||
return _httpResponseControl.WriteAsync(new ReadOnlyMemory<byte>(buffer, offset, count), cancellationToken);
|
||||
}
|
||||
|
||||
#if NETCOREAPP2_1
|
||||
public override ValueTask WriteAsync(ReadOnlyMemory<byte> source, CancellationToken cancellationToken = default)
|
||||
{
|
||||
ValidateState(cancellationToken);
|
||||
|
||||
return new ValueTask(_httpResponseControl.WriteAsync(source, cancellationToken));
|
||||
}
|
||||
#elif NETSTANDARD2_0
|
||||
#else
|
||||
#error TFMs need to be updated
|
||||
#endif
|
||||
|
||||
public void StartAcceptingWrites()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -145,15 +145,10 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
|
|||
return _requestStream.ReadAsync(buffer, offset, count, cancellationToken);
|
||||
}
|
||||
|
||||
#if NETCOREAPP2_1
|
||||
public override ValueTask<int> ReadAsync(Memory<byte> destination, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return _requestStream.ReadAsync(destination, cancellationToken);
|
||||
}
|
||||
#elif NETSTANDARD2_0
|
||||
#else
|
||||
#error TFMs need to be updated
|
||||
#endif
|
||||
|
||||
public override Task CopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken)
|
||||
{
|
||||
|
|
@ -165,15 +160,10 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
|
|||
return _responseStream.WriteAsync(buffer, offset, count, cancellationToken);
|
||||
}
|
||||
|
||||
#if NETCOREAPP2_1
|
||||
public override ValueTask WriteAsync(ReadOnlyMemory<byte> source, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return _responseStream.WriteAsync(source, cancellationToken);
|
||||
}
|
||||
#elif NETSTANDARD2_0
|
||||
#else
|
||||
#error TFMs need to be updated
|
||||
#endif
|
||||
|
||||
public override long Seek(long offset, SeekOrigin origin)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -113,15 +113,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
|
|||
// REVIEW: This *could* be slower if 2 things are true
|
||||
// - The WriteAsync(ReadOnlyMemory<byte>) isn't overridden on the destination
|
||||
// - We change the Kestrel Memory Pool to not use pinned arrays but instead use native memory
|
||||
|
||||
#if NETCOREAPP2_1
|
||||
await destination.WriteAsync(memory, cancellationToken);
|
||||
#elif NETSTANDARD2_0
|
||||
var array = memory.GetArray();
|
||||
await destination.WriteAsync(array.Array, array.Offset, array.Count, cancellationToken);
|
||||
#else
|
||||
#error TFMs need to be updated
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -131,7 +131,6 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Https.Internal
|
|||
|
||||
try
|
||||
{
|
||||
#if NETCOREAPP2_1
|
||||
// Adapt to the SslStream signature
|
||||
ServerCertificateSelectionCallback selector = null;
|
||||
if (_serverCertificateSelector != null)
|
||||
|
|
@ -172,22 +171,6 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Https.Internal
|
|||
}
|
||||
|
||||
await sslStream.AuthenticateAsServerAsync(sslOptions, CancellationToken.None);
|
||||
#elif NETSTANDARD2_0 // No ALPN support
|
||||
var serverCert = _serverCertificate;
|
||||
if (_serverCertificateSelector != null)
|
||||
{
|
||||
context.Features.Set(sslStream);
|
||||
serverCert = _serverCertificateSelector(context.ConnectionContext, null);
|
||||
if (serverCert != null)
|
||||
{
|
||||
EnsureCertificateIsAllowedForServerAuth(serverCert);
|
||||
}
|
||||
}
|
||||
await sslStream.AuthenticateAsServerAsync(serverCert, certificateRequired,
|
||||
_options.SslProtocols, _options.CheckCertificateRevocation);
|
||||
#else
|
||||
#error TFMs need to be updated
|
||||
#endif
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
|
|
@ -206,13 +189,8 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Https.Internal
|
|||
timeoutFeature.CancelTimeout();
|
||||
}
|
||||
|
||||
#if NETCOREAPP2_1
|
||||
feature.ApplicationProtocol = sslStream.NegotiatedApplicationProtocol.Protocol;
|
||||
context.Features.Set<ITlsApplicationProtocolFeature>(feature);
|
||||
#elif NETSTANDARD2_0 // No ALPN support
|
||||
#else
|
||||
#error TFMs need to be updated
|
||||
#endif
|
||||
feature.ClientCertificate = ConvertToX509Certificate2(sslStream.RemoteCertificate);
|
||||
feature.CipherAlgorithm = sslStream.CipherAlgorithm;
|
||||
feature.CipherStrength = sslStream.CipherStrength;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// 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.
|
||||
|
||||
using System;
|
||||
|
|
@ -68,13 +68,8 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure
|
|||
public override Task<int> ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
|
||||
=> _inner.ReadAsync(buffer, offset, count, cancellationToken);
|
||||
|
||||
#if NETCOREAPP2_1
|
||||
public override ValueTask<int> ReadAsync(Memory<byte> destination, CancellationToken cancellationToken = default)
|
||||
=> _inner.ReadAsync(destination, cancellationToken);
|
||||
#elif NETSTANDARD2_0
|
||||
#else
|
||||
#error TFMs need to be updated
|
||||
#endif
|
||||
|
||||
public override int ReadByte()
|
||||
=> _inner.ReadByte();
|
||||
|
|
@ -91,13 +86,8 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure
|
|||
public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
|
||||
=> _inner.WriteAsync(buffer, offset, count, cancellationToken);
|
||||
|
||||
#if NETCOREAPP2_1
|
||||
public override ValueTask WriteAsync(ReadOnlyMemory<byte> source, CancellationToken cancellationToken = default)
|
||||
=> _inner.WriteAsync(source, cancellationToken);
|
||||
#elif NETSTANDARD2_0
|
||||
#else
|
||||
#error TFMs need to be updated
|
||||
#endif
|
||||
|
||||
public override void WriteByte(byte value)
|
||||
=> _inner.WriteByte(value);
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<Description>Core components of ASP.NET Core Kestrel cross-platform web server.</Description>
|
||||
<TargetFrameworks>netstandard2.0;netcoreapp2.1</TargetFrameworks>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<PackageTags>aspnetcore;kestrel</PackageTags>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// 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.
|
||||
|
||||
using System;
|
||||
|
|
@ -85,18 +85,6 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
|
|||
await Assert.ThrowsAsync<NotSupportedException>(() => stream.WriteAsync(new byte[1], 0, 1));
|
||||
}
|
||||
|
||||
#if NET461
|
||||
[Fact]
|
||||
public void BeginWriteThrows()
|
||||
{
|
||||
var stream = new HttpRequestStream(Mock.Of<IHttpBodyControlFeature>());
|
||||
Assert.Throws<NotSupportedException>(() => stream.BeginWrite(new byte[1], 0, 1, null, null));
|
||||
}
|
||||
#elif NETCOREAPP2_2
|
||||
#else
|
||||
#error Target framework needs to be updated
|
||||
#endif
|
||||
|
||||
[Fact]
|
||||
// Read-only streams should support Flush according to https://github.com/dotnet/corefx/pull/27327#pullrequestreview-98384813
|
||||
public void FlushDoesNotThrow()
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>netcoreapp2.2;net461</TargetFrameworks>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<Description>ASP.NET Core Kestrel cross-platform web server.</Description>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<PackageTags>aspnetcore;kestrel</PackageTags>
|
||||
<NoWarn>CS1591;$(NoWarn)</NoWarn>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// 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 NETCOREAPP2_2
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
|
@ -57,7 +56,3 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests
|
|||
}
|
||||
}
|
||||
}
|
||||
#elif NET461
|
||||
#else
|
||||
#error Target framework needs to be updated
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>netcoreapp2.2;net461</TargetFrameworks>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<Description>Transport abstractions for the ASP.NET Core Kestrel cross-platform web server.</Description>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<PackageTags>aspnetcore;kestrel</PackageTags>
|
||||
<NoWarn>CS1570;CS1571;CS1572;CS1573;CS1574;CS1591;$(NoWarn)</NoWarn>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<Description>Libuv transport for the ASP.NET Core Kestrel cross-platform web server.</Description>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<PackageTags>aspnetcore;kestrel</PackageTags>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>netcoreapp2.2;net461</TargetFrameworks>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<ServerGarbageCollection>true</ServerGarbageCollection>
|
||||
</PropertyGroup>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// 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.
|
||||
|
||||
using System;
|
||||
|
|
@ -15,13 +15,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal
|
|||
|
||||
public SocketAwaitableEventArgs WaitForDataAsync()
|
||||
{
|
||||
#if NETCOREAPP2_1
|
||||
_awaitableEventArgs.SetBuffer(Memory<byte>.Empty);
|
||||
#elif NETSTANDARD2_0
|
||||
_awaitableEventArgs.SetBuffer(Array.Empty<byte>(), 0, 0);
|
||||
#else
|
||||
#error TFMs need to be updated
|
||||
#endif
|
||||
|
||||
if (!_socket.ReceiveAsync(_awaitableEventArgs))
|
||||
{
|
||||
|
|
@ -33,15 +27,8 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal
|
|||
|
||||
public SocketAwaitableEventArgs ReceiveAsync(Memory<byte> buffer)
|
||||
{
|
||||
#if NETCOREAPP2_1
|
||||
_awaitableEventArgs.SetBuffer(buffer);
|
||||
#elif NETSTANDARD2_0
|
||||
var segment = buffer.GetArray();
|
||||
|
||||
_awaitableEventArgs.SetBuffer(segment.Array, segment.Offset, segment.Count);
|
||||
#else
|
||||
#error TFMs need to be updated
|
||||
#endif
|
||||
if (!_socket.ReceiveAsync(_awaitableEventArgs))
|
||||
{
|
||||
_awaitableEventArgs.Complete();
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// 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.
|
||||
|
||||
using System;
|
||||
|
|
@ -26,13 +26,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal
|
|||
return SendAsync(buffers.First);
|
||||
}
|
||||
|
||||
#if NETCOREAPP2_1
|
||||
if (!_awaitableEventArgs.MemoryBuffer.Equals(Memory<byte>.Empty))
|
||||
#elif NETSTANDARD2_0
|
||||
if (_awaitableEventArgs.Buffer != null)
|
||||
#else
|
||||
#error TFMs need to be updated
|
||||
#endif
|
||||
{
|
||||
_awaitableEventArgs.SetBuffer(null, 0, 0);
|
||||
}
|
||||
|
|
@ -55,15 +49,8 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal
|
|||
_awaitableEventArgs.BufferList = null;
|
||||
}
|
||||
|
||||
#if NETCOREAPP2_1
|
||||
_awaitableEventArgs.SetBuffer(MemoryMarshal.AsMemory(memory));
|
||||
#elif NETSTANDARD2_0
|
||||
var segment = memory.GetArray();
|
||||
|
||||
_awaitableEventArgs.SetBuffer(segment.Array, segment.Offset, segment.Count);
|
||||
#else
|
||||
#error TFMs need to be updated
|
||||
#endif
|
||||
if (!_socket.SendAsync(_awaitableEventArgs))
|
||||
{
|
||||
_awaitableEventArgs.Complete();
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<Description>Managed socket transport for the ASP.NET Core Kestrel cross-platform web server.</Description>
|
||||
<TargetFrameworks>netstandard2.0;netcoreapp2.1</TargetFrameworks>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<PackageTags>aspnetcore;kestrel</PackageTags>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<OutputType>Exe</OutputType>
|
||||
<ServerGarbageCollection>true</ServerGarbageCollection>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>netcoreapp2.2;net461</TargetFrameworks>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<IsPackable>false</IsPackable>
|
||||
<NoDefaultLaunchSettingsFile>true</NoDefaultLaunchSettingsFile>
|
||||
</PropertyGroup>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>netcoreapp2.2;net461</TargetFrameworks>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<IsPackable>false</IsPackable>
|
||||
<NoDefaultLaunchSettingsFile>true</NoDefaultLaunchSettingsFile>
|
||||
</PropertyGroup>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>netcoreapp2.2;net461</TargetFrameworks>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<IsPackable>false</IsPackable>
|
||||
<NoDefaultLaunchSettingsFile>true</NoDefaultLaunchSettingsFile>
|
||||
</PropertyGroup>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>netcoreapp2.2;net461</TargetFrameworks>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<IsPackable>false</IsPackable>
|
||||
<NoDefaultLaunchSettingsFile>true</NoDefaultLaunchSettingsFile>
|
||||
</PropertyGroup>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>netcoreapp2.2;net461</TargetFrameworks>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<IsPackable>false</IsPackable>
|
||||
<NoDefaultLaunchSettingsFile>true</NoDefaultLaunchSettingsFile>
|
||||
</PropertyGroup>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// 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.
|
||||
|
||||
using System;
|
||||
|
|
@ -140,7 +140,6 @@ namespace Microsoft.AspNetCore.Testing
|
|||
_innerStream.Close();
|
||||
}
|
||||
|
||||
#if NETCOREAPP2_2
|
||||
public override int Read(Span<byte> buffer)
|
||||
{
|
||||
return _innerStream.Read(buffer);
|
||||
|
|
@ -165,10 +164,6 @@ namespace Microsoft.AspNetCore.Testing
|
|||
{
|
||||
_innerStream.CopyTo(destination, bufferSize);
|
||||
}
|
||||
#elif NET461
|
||||
#else
|
||||
#error TFMs need to be updated
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
// 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 NETCOREAPP2_2
|
||||
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
|
|
@ -95,7 +93,3 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests.Http2
|
|||
}
|
||||
}
|
||||
}
|
||||
#elif NET461 // No ALPN support
|
||||
#else
|
||||
#error TFMs need updating
|
||||
#endif
|
||||
|
|
@ -1,8 +1,6 @@
|
|||
// 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 NETCOREAPP2_2
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
|
|
@ -146,7 +144,3 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests.Http2
|
|||
}
|
||||
}
|
||||
}
|
||||
#elif NET461 // No ALPN support
|
||||
#else
|
||||
#error TFMs need updating
|
||||
#endif
|
||||
|
|
@ -1,8 +1,6 @@
|
|||
// 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 NETCOREAPP2_2
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.IO.Pipelines;
|
||||
|
|
@ -126,7 +124,3 @@ namespace Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests.Http2
|
|||
}
|
||||
}
|
||||
}
|
||||
#elif NET461 // No ALPN support
|
||||
#else
|
||||
#error TFMs need updating
|
||||
#endif
|
||||
|
|
@ -182,13 +182,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests
|
|||
{
|
||||
Assert.NotNull(connection);
|
||||
Assert.NotNull(connection.Features.Get<SslStream>());
|
||||
#if NETCOREAPP2_2
|
||||
Assert.Equal("localhost", name);
|
||||
#elif NET461
|
||||
Assert.Null(name);
|
||||
#else
|
||||
#error TFMs need to be updated
|
||||
#endif
|
||||
selectorCalled++;
|
||||
return _x509Certificate2;
|
||||
}
|
||||
|
|
@ -224,13 +218,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests
|
|||
{
|
||||
Assert.NotNull(connection);
|
||||
Assert.NotNull(connection.Features.Get<SslStream>());
|
||||
#if NETCOREAPP2_2
|
||||
Assert.Equal("localhost", name);
|
||||
#elif NET461
|
||||
Assert.Null(name);
|
||||
#else
|
||||
#error TFMs need to be updated
|
||||
#endif
|
||||
selectorCalled++;
|
||||
if (selectorCalled == 1)
|
||||
{
|
||||
|
|
@ -314,13 +302,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests
|
|||
{
|
||||
Assert.NotNull(connection);
|
||||
Assert.NotNull(connection.Features.Get<SslStream>());
|
||||
#if NETCOREAPP2_2
|
||||
Assert.Equal("localhost", name);
|
||||
#elif NET461
|
||||
Assert.Null(name);
|
||||
#else
|
||||
#error TFMs need to be updated
|
||||
#endif
|
||||
selectorCalled++;
|
||||
return _x509Certificate2;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>netcoreapp2.2;net461</TargetFrameworks>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<ServerGarbageCollection>true</ServerGarbageCollection>
|
||||
<TestGroupName>InMemory.FunctionalTests</TestGroupName>
|
||||
</PropertyGroup>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// 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 NETCOREAPP2_2
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
|
|
@ -135,8 +133,3 @@ namespace Interop.FunctionalTests
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#elif NET461 // No ALPN support
|
||||
#else
|
||||
#error TFMs need updating
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<ServerGarbageCollection>true</ServerGarbageCollection>
|
||||
<TestGroupName>Interop.FunctionalTests</TestGroupName>
|
||||
<WarningsNotAsErrors>CS8002;$(WarningsNotAsErrors)</WarningsNotAsErrors>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>netcoreapp2.2;net461</TargetFrameworks>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<ServerGarbageCollection>true</ServerGarbageCollection>
|
||||
<TestGroupName>Libuv.BindTests</TestGroupName>
|
||||
</PropertyGroup>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>netcoreapp2.2;net461</TargetFrameworks>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<DefineConstants Condition="$([MSBuild]::IsOSPlatform('OSX'))">$(DefineConstants);MACOS</DefineConstants>
|
||||
<ServerGarbageCollection>true</ServerGarbageCollection>
|
||||
<!-- Put this project into its own test group to avoid running parallel with other test projects. Libuv does not play nice with other test assemblies. -->
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>netcoreapp2.2;net461</TargetFrameworks>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<ServerGarbageCollection>true</ServerGarbageCollection>
|
||||
<TestGroupName>Sockets.BindTests</TestGroupName>
|
||||
</PropertyGroup>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>netcoreapp2.2;net461</TargetFrameworks>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<DefineConstants Condition="$([MSBuild]::IsOSPlatform('OSX'))">$(DefineConstants);MACOS</DefineConstants>
|
||||
<ServerGarbageCollection>true</ServerGarbageCollection>
|
||||
<TestGroupName>Sockets.FunctionalTests</TestGroupName>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<OutputType>Exe</OutputType>
|
||||
<IsPackable>false</IsPackable>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
|
|
|
|||
Loading…
Reference in New Issue