Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

process more TLS frames at one when available #50815

Merged
merged 16 commits into from
Jun 24, 2021
Merged
Show file tree
Hide file tree
Changes from 13 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
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ private static unsafe extern PAL_SSLStreamStatus SSLStreamRead(
out int bytesRead);
internal static unsafe PAL_SSLStreamStatus SSLStreamRead(
SafeSslHandle sslHandle,
Span<byte> buffer,
ReadOnlySpan<byte> buffer,
wfurt marked this conversation as resolved.
Show resolved Hide resolved
out int bytesRead)
{
fixed (byte* bufferPtr = buffer)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,16 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Buffers;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Net.Http;
using System.Net.Security;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security.Authentication;
using System.Security.Authentication.ExtendedProtection;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using Microsoft.Win32.SafeHandles;

internal static partial class Interop
Expand Down
127 changes: 0 additions & 127 deletions src/libraries/Common/tests/System/Net/Http/SchSendAuxRecordHttpTest.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,6 @@ public sealed class PlatformHandler_HttpClientHandler_Proxy_Test : HttpClientHan
public PlatformHandler_HttpClientHandler_Proxy_Test(ITestOutputHelper output) : base(output) { }
}

public sealed class PlatformHandler_SchSendAuxRecordHttpTest : SchSendAuxRecordHttpTest
{
public PlatformHandler_SchSendAuxRecordHttpTest(ITestOutputHelper output) : base(output) { }
}

public sealed class PlatformHandler_HttpClientHandlerTest : HttpClientHandlerTest
{
public PlatformHandler_HttpClientHandlerTest(ITestOutputHelper output) : base(output) { }
Expand Down Expand Up @@ -299,13 +294,6 @@ public sealed class PlatformHandler_HttpClientHandler_Proxy_Http2_Test : HttpCli
public PlatformHandler_HttpClientHandler_Proxy_Http2_Test(ITestOutputHelper output) : base(output) { }
}

public sealed class PlatformHandler_SchSendAuxRecordHttp_Http2_Test : SchSendAuxRecordHttpTest
{
protected override Version UseVersion => HttpVersion20.Value;

public PlatformHandler_SchSendAuxRecordHttp_Http2_Test(ITestOutputHelper output) : base(output) { }
}

[ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.IsWindows10Version1607OrGreater))]
public sealed class PlatformHandler_HttpClientHandler_Http2_Test : HttpClientHandlerTest
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,6 @@
Link="Common\System\Net\Http\RepeatedFlushContent.cs" />
<Compile Include="$(CommonTestPath)System\Net\Http\ResponseStreamTest.cs"
Link="Common\System\Net\Http\ResponseStreamTest.cs" />
<Compile Include="$(CommonTestPath)System\Net\Http\SchSendAuxRecordHttpTest.cs"
Link="Common\System\Net\Http\SchSendAuxRecordHttpTest.cs" />
<Compile Include="$(CommonTestPath)System\Net\Http\SyncBlockingContent.cs"
Link="Common\System\Net\Http\SyncBlockingContent.cs" />
<Compile Include="$(CommonTestPath)System\Net\Http\ThrowingContent.cs"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -982,11 +982,6 @@ public async Task Http2GetAsync_TrailingHeaders_NoData_EmptyResponseObserved()
}
}

public sealed class SocketsHttpHandler_SchSendAuxRecordHttpTest : SchSendAuxRecordHttpTest
{
public SocketsHttpHandler_SchSendAuxRecordHttpTest(ITestOutputHelper output) : base(output) { }
}

[SkipOnPlatform(TestPlatforms.Browser, "Tests hang with chrome. To be investigated")]
public sealed class SocketsHttpHandler_HttpClientHandlerTest : HttpClientHandlerTest
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,6 @@
Link="Common\System\Net\Http\RepeatedFlushContent.cs" />
<Compile Include="$(CommonTestPath)System\Net\Http\ResponseStreamTest.cs"
Link="Common\System\Net\Http\ResponseStreamTest.cs" />
<Compile Include="$(CommonTestPath)System\Net\Http\SchSendAuxRecordHttpTest.cs"
Link="Common\System\Net\Http\SchSendAuxRecordHttpTest.cs" />
<Compile Include="SyncHttpHandlerTest.cs" />
<Compile Include="TelemetryTest.cs" />
<Compile Include="StreamContentTest.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ internal sealed partial class NetEventSource : EventSource
/// <param name="buffer">The buffer to be logged.</param>
/// <param name="memberName">The calling member.</param>
[NonEvent]
public static void DumpBuffer(object thisOrContextObject, ReadOnlyMemory<byte> buffer, [CallerMemberName] string? memberName = null)
public static void DumpBuffer(object thisOrContextObject, ReadOnlySpan<byte> buffer, [CallerMemberName] string? memberName = null)
{
if (Log.IsEnabled())
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,7 @@ is non-zero.
--*/
internal SecurityStatusPal Encrypt(ReadOnlyMemory<byte> buffer, ref byte[] output, out int resultSize)
{
if (NetEventSource.Log.IsEnabled()) NetEventSource.DumpBuffer(this, buffer);
if (NetEventSource.Log.IsEnabled()) NetEventSource.DumpBuffer(this, buffer.Span);

byte[] writeBuffer = output;

Expand All @@ -903,24 +903,12 @@ internal SecurityStatusPal Encrypt(ReadOnlyMemory<byte> buffer, ref byte[] outpu
return secStatus;
}

internal SecurityStatusPal Decrypt(byte[]? payload, ref int offset, ref int count)
internal SecurityStatusPal Decrypt(Span<byte> buffer, out int outputOffset, out int outputCount)
{
if ((uint)offset > (uint)(payload == null ? 0 : payload.Length))
{
Debug.Fail("Argument 'offset' out of range.");
throw new ArgumentOutOfRangeException(nameof(offset));
}

if ((uint)count > (uint)(payload == null ? 0 : payload.Length - offset))
{
Debug.Fail("Argument 'count' out of range.");
throw new ArgumentOutOfRangeException(nameof(count));
}

SecurityStatusPal status = SslStreamPal.DecryptMessage(_securityContext!, payload!, ref offset, ref count);
SecurityStatusPal status = SslStreamPal.DecryptMessage(_securityContext!, buffer, out outputOffset, out outputCount);
if (NetEventSource.Log.IsEnabled() && status.ErrorCode == SecurityStatusPalErrorCode.OK)
{
NetEventSource.DumpBuffer(this, payload!, offset, count);
NetEventSource.DumpBuffer(this, buffer.Slice(outputOffset, outputCount));
}

return status;
Expand Down
Loading