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

Sync shared code from runtime #19328

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all 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
7 changes: 2 additions & 5 deletions src/Shared/runtime/Http3/QPack/QPackEncoder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ private static bool EncodeHeaderBlockPrefix(Span<byte> destination, out int byte
return true;
}

// TODO these are fairly hard coded for the first two bytes to be zero.
public bool BeginEncode(IEnumerable<KeyValuePair<string, string>> headers, Span<byte> buffer, out int length)
{
_enumerator = headers.GetEnumerator();
Expand All @@ -350,11 +351,7 @@ public bool BeginEncode(IEnumerable<KeyValuePair<string, string>> headers, Span<
buffer[0] = 0;
buffer[1] = 0;

bool doneEncode = Encode(buffer.Slice(2), out length);

// Add two for the first two bytes.
length += 2;
return doneEncode;
return Encode(buffer.Slice(2), out length);
}

public bool BeginEncode(int statusCode, IEnumerable<KeyValuePair<string, string>> headers, Span<byte> buffer, out int length)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

Expand Down Expand Up @@ -143,6 +143,12 @@ static MsQuicApi()

OperatingSystem ver = Environment.OSVersion;

if (ver.Platform == PlatformID.Win32NT && ver.Version < new Version(10, 0, 19041, 0))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Justin, I didn't realize you'd removed this in aspnet. This PR won't work then. I'll keep it long enough to figure out the CLA, but go ahead and merge your other PR.

{
IsQuicSupported = false;
return;
}

// TODO: try to initialize TLS 1.3 in SslStream.

try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -402,15 +402,15 @@ internal override int Read(Span<byte> buffer)
{
ThrowIfDisposed();

return ReadAsync(buffer.ToArray()).GetAwaiter().GetResult();
return ReadAsync(buffer.ToArray()).AsTask().GetAwaiter().GetResult();
}

internal override void Write(ReadOnlySpan<byte> buffer)
{
ThrowIfDisposed();

// TODO: optimize this.
WriteAsync(buffer.ToArray()).GetAwaiter().GetResult();
WriteAsync(buffer.ToArray()).AsTask().GetAwaiter().GetResult();
}

// MsQuic doesn't support explicit flushing
Expand Down