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