Handle netcoreapp cases
This commit is contained in:
parent
7db465dfc2
commit
350310aa96
|
|
@ -9,6 +9,6 @@ ARG CONFIGURATION=Debug
|
|||
|
||||
WORKDIR /app
|
||||
|
||||
COPY ./bin/${CONFIGURATION}/netcoreapp2.0/publish/ /app
|
||||
COPY ./bin/${CONFIGURATION}/netcoreapp2.2/publish/ /app
|
||||
|
||||
ENTRYPOINT [ "/usr/bin/dotnet", "/app/Http2SampleApp.dll" ]
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
dotnet publish --framework netcoreapp2.0 "$PSScriptRoot/../Http2SampleApp.csproj"
|
||||
dotnet publish --framework netcoreapp2.2 "$PSScriptRoot/../Http2SampleApp.csproj"
|
||||
|
||||
docker build -t kestrel-http2-sample (Convert-Path "$PSScriptRoot/..")
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
dotnet publish --framework netcoreapp2.0 "$DIR/../Http2SampleApp.csproj"
|
||||
dotnet publish --framework netcoreapp2.2 "$DIR/../Http2SampleApp.csproj"
|
||||
|
||||
docker build -t kestrel-http2-sample "$DIR/.."
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks>
|
||||
<TargetFrameworks>netcoreapp2.2;net461</TargetFrameworks>
|
||||
<IsPackable>false</IsPackable>
|
||||
<NoDefaultLaunchSettingsFile>true</NoDefaultLaunchSettingsFile>
|
||||
</PropertyGroup>
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal
|
|||
}
|
||||
else if (buffer.IsSingleSegment)
|
||||
{
|
||||
#if NETCOREAPP2_1
|
||||
#if NETCOREAPP2_2
|
||||
await stream.WriteAsync(buffer.First);
|
||||
#else
|
||||
var array = buffer.First.GetArray();
|
||||
|
|
@ -91,7 +91,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal
|
|||
{
|
||||
foreach (var memory in buffer)
|
||||
{
|
||||
#if NETCOREAPP2_1
|
||||
#if NETCOREAPP2_2
|
||||
await stream.WriteAsync(memory);
|
||||
#else
|
||||
var array = memory.GetArray();
|
||||
|
|
@ -133,7 +133,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal
|
|||
{
|
||||
|
||||
var outputBuffer = Input.Writer.GetMemory(MinAllocBufferSize);
|
||||
#if NETCOREAPP2_1
|
||||
#if NETCOREAPP2_2
|
||||
var bytesRead = await stream.ReadAsync(outputBuffer);
|
||||
#else
|
||||
var array = outputBuffer.GetArray();
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal
|
|||
return read;
|
||||
}
|
||||
|
||||
#if NETCOREAPP2_1
|
||||
#if NETCOREAPP2_2
|
||||
public override int Read(Span<byte> destination)
|
||||
{
|
||||
int read = _inner.Read(destination);
|
||||
|
|
@ -99,7 +99,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal
|
|||
return read;
|
||||
}
|
||||
|
||||
#if NETCOREAPP2_1
|
||||
#if NETCOREAPP2_2
|
||||
public override async ValueTask<int> ReadAsync(Memory<byte> destination, CancellationToken cancellationToken = default)
|
||||
{
|
||||
int read = await _inner.ReadAsync(destination, cancellationToken);
|
||||
|
|
@ -124,7 +124,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal
|
|||
_inner.Write(buffer, offset, count);
|
||||
}
|
||||
|
||||
#if NETCOREAPP2_1
|
||||
#if NETCOREAPP2_2
|
||||
public override void Write(ReadOnlySpan<byte> source)
|
||||
{
|
||||
Log("Write", source);
|
||||
|
|
@ -138,7 +138,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal
|
|||
return _inner.WriteAsync(buffer, offset, count, cancellationToken);
|
||||
}
|
||||
|
||||
#if NETCOREAPP2_1
|
||||
#if NETCOREAPP2_2
|
||||
public override ValueTask WriteAsync(ReadOnlyMemory<byte> source, CancellationToken cancellationToken = default)
|
||||
{
|
||||
Log("WriteAsync", source.Span);
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal
|
|||
return ReadAsyncInternal(new Memory<byte>(buffer, offset, count)).AsTask();
|
||||
}
|
||||
|
||||
#if NETCOREAPP2_1
|
||||
#if NETCOREAPP2_2
|
||||
public override ValueTask<int> ReadAsync(Memory<byte> destination, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return ReadAsyncInternal(destination);
|
||||
|
|
@ -91,7 +91,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal
|
|||
await _output.FlushAsync(cancellationToken);
|
||||
}
|
||||
|
||||
#if NETCOREAPP2_1
|
||||
#if NETCOREAPP2_2
|
||||
public override async ValueTask WriteAsync(ReadOnlyMemory<byte> source, CancellationToken cancellationToken = default)
|
||||
{
|
||||
_output.Write(source.Span);
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
|
|||
return ReadAsyncInternal(new Memory<byte>(buffer, offset, count), cancellationToken).AsTask();
|
||||
}
|
||||
|
||||
#if NETCOREAPP2_1
|
||||
#if NETCOREAPP2_2
|
||||
public override ValueTask<int> ReadAsync(Memory<byte> destination, CancellationToken cancellationToken = default)
|
||||
{
|
||||
ValidateState(cancellationToken);
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
|
|||
return _httpResponseControl.WriteAsync(new ReadOnlyMemory<byte>(buffer, offset, count), cancellationToken);
|
||||
}
|
||||
|
||||
#if NETCOREAPP2_1
|
||||
#if NETCOREAPP2_2
|
||||
public override ValueTask WriteAsync(ReadOnlyMemory<byte> source, CancellationToken cancellationToken = default)
|
||||
{
|
||||
ValidateState(cancellationToken);
|
||||
|
|
|
|||
|
|
@ -88,7 +88,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
|
||||
#if NETCOREAPP2_2
|
||||
await destination.WriteAsync(memory);
|
||||
#else
|
||||
var array = memory.GetArray();
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Https.Internal
|
|||
|
||||
try
|
||||
{
|
||||
#if NETCOREAPP2_1
|
||||
#if NETCOREAPP2_2
|
||||
// Adapt to the SslStream signature
|
||||
ServerCertificateSelectionCallback selector = null;
|
||||
if (_serverCertificateSelector != null)
|
||||
|
|
@ -197,7 +197,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Https.Internal
|
|||
timeoutFeature.CancelTimeout();
|
||||
}
|
||||
|
||||
#if NETCOREAPP2_1
|
||||
#if NETCOREAPP2_2
|
||||
feature.ApplicationProtocol = sslStream.NegotiatedApplicationProtocol.Protocol;
|
||||
context.Features.Set<ITlsApplicationProtocolFeature>(feature);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal
|
|||
|
||||
public SocketAwaitable ReceiveAsync(Memory<byte> buffer)
|
||||
{
|
||||
#if NETCOREAPP2_1
|
||||
#if NETCOREAPP2_2
|
||||
_eventArgs.SetBuffer(buffer);
|
||||
#else
|
||||
var segment = buffer.GetArray();
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal
|
|||
return SendAsync(buffers.First);
|
||||
}
|
||||
|
||||
#if NETCOREAPP2_1
|
||||
#if NETCOREAPP2_2
|
||||
if (!_eventArgs.MemoryBuffer.Equals(Memory<byte>.Empty))
|
||||
#else
|
||||
if (_eventArgs.Buffer != null)
|
||||
|
|
@ -61,7 +61,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal
|
|||
_eventArgs.BufferList = null;
|
||||
}
|
||||
|
||||
#if NETCOREAPP2_1
|
||||
#if NETCOREAPP2_2
|
||||
_eventArgs.SetBuffer(MemoryMarshal.AsMemory(memory));
|
||||
#else
|
||||
var segment = memory.GetArray();
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
|
|||
var stream = new HttpRequestStream(Mock.Of<IHttpBodyControlFeature>());
|
||||
Assert.Throws<NotSupportedException>(() => stream.BeginWrite(new byte[1], 0, 1, null, null));
|
||||
}
|
||||
#elif NETCOREAPP2_1
|
||||
#elif NETCOREAPP2_2
|
||||
#else
|
||||
#error Target framework needs to be updated
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// 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_1
|
||||
#if NETCOREAPP2_2
|
||||
using System.IO;
|
||||
using Xunit;
|
||||
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests
|
|||
{
|
||||
Assert.NotNull(connection);
|
||||
Assert.NotNull(connection.Features.Get<SslStream>());
|
||||
#if NETCOREAPP2_1
|
||||
#if NETCOREAPP2_2
|
||||
Assert.Equal("localhost", name);
|
||||
#else
|
||||
Assert.Null(name);
|
||||
|
|
@ -192,7 +192,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests
|
|||
{
|
||||
Assert.NotNull(connection);
|
||||
Assert.NotNull(connection.Features.Get<SslStream>());
|
||||
#if NETCOREAPP2_1
|
||||
#if NETCOREAPP2_2
|
||||
Assert.Equal("localhost", name);
|
||||
#else
|
||||
Assert.Null(name);
|
||||
|
|
@ -280,7 +280,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests
|
|||
{
|
||||
Assert.NotNull(connection);
|
||||
Assert.NotNull(connection.Features.Get<SslStream>());
|
||||
#if NETCOREAPP2_1
|
||||
#if NETCOREAPP2_2
|
||||
Assert.Equal("localhost", name);
|
||||
#else
|
||||
Assert.Null(name);
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ set -e
|
|||
|
||||
scriptDir=$(dirname "${BASH_SOURCE[0]}")
|
||||
PATH="$PWD/.dotnet/:$PATH"
|
||||
dotnet publish -f netcoreapp2.0 ./samples/SystemdTestApp/
|
||||
cp -R ./samples/SystemdTestApp/bin/Debug/netcoreapp2.0/publish/ $scriptDir
|
||||
dotnet publish -f netcoreapp2.2 ./samples/SystemdTestApp/
|
||||
cp -R ./samples/SystemdTestApp/bin/Debug/netcoreapp2.2/publish/ $scriptDir
|
||||
cp -R ./.dotnet/ $scriptDir
|
||||
|
||||
image=$(docker build -qf $scriptDir/Dockerfile $scriptDir)
|
||||
|
|
|
|||
Loading…
Reference in New Issue