Skip to content

Commit 04e8b01

Browse files
authored
Tratcher/syncruntime (#19206)
* Consume the internalized System.Net.Quic sources (#19156) * Consume the internalized System.Net.Quic sources * More changes from rebase * Remove Console.WriteLine * Additional code sync
1 parent 4ccb7d5 commit 04e8b01

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+5422
-14
lines changed

src/Servers/Kestrel/Core/src/Microsoft.AspNetCore.Server.Kestrel.Core.csproj

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<Description>Core components of ASP.NET Core Kestrel cross-platform web server.</Description>
@@ -16,7 +16,9 @@
1616
<Compile Include="$(SharedSourceRoot)CertificateGeneration\**\*.cs" />
1717
<Compile Include="$(SharedSourceRoot)ValueTaskExtensions\**\*.cs" />
1818
<Compile Include="$(SharedSourceRoot)UrlDecoder\**\*.cs" />
19-
<Compile Include="$(SharedSourceRoot)runtime\**\*.cs" LinkBase="Shared\runtime\" />
19+
<Compile Include="$(SharedSourceRoot)runtime\*.cs" Link="Shared\runtime\%(Filename)%(Extension)"/>
20+
<Compile Include="$(SharedSourceRoot)runtime\Http2\**\*.cs" Link="Shared\runtime\Http2\%(Filename)%(Extension)"/>
21+
<Compile Include="$(SharedSourceRoot)runtime\Http3\**\*.cs" Link="Shared\runtime\Http3\%(Filename)%(Extension)"/>
2022
<Compile Include="$(SharedSourceRoot)ServerInfrastructure\**\*.cs" LinkBase="Shared\" />
2123
<Compile Include="$(RepoRoot)src\Shared\TaskToApm.cs" Link="Internal\TaskToApm.cs" />
2224
</ItemGroup>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information.
4+
5+
internal static partial class Interop
6+
{
7+
internal static class Libraries
8+
{
9+
// Compare to https://github.com/dotnet/runtime/blob/63c88901df460c47eaffc6b970c4b5f0aeaf0a88/src/libraries/Common/src/Interop/Linux/Interop.Libraries.cs#L10
10+
internal const string MsQuic = "msquic";
11+
}
12+
}
Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,26 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<Description>Libuv transport for the ASP.NET Core Kestrel cross-platform web server.</Description>
4+
<Description>Quic transport for the ASP.NET Core Kestrel cross-platform web server.</Description>
55
<TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
66
<GenerateDocumentationFile>true</GenerateDocumentationFile>
77
<PackageTags>aspnetcore;kestrel</PackageTags>
88
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
9-
<NoWarn>CS1591;$(NoWarn)</NoWarn>
9+
<NoWarn>CS1591;CS0436;$(NoWarn)</NoWarn><!-- Conflicts between internal and public Quic APIs -->
1010
<IsShippingPackage>false</IsShippingPackage>
1111
</PropertyGroup>
1212

1313
<ItemGroup>
1414
<Compile Include="$(RepoRoot)src\Shared\Buffers.MemoryPool\*.cs" LinkBase="MemoryPool" />
1515
<Compile Include="$(KestrelSharedSourceRoot)\CorrelationIdGenerator.cs" Link="Internal\CorrelationIdGenerator.cs" />
1616
<Compile Include="$(SharedSourceRoot)ServerInfrastructure\DuplexPipe.cs" Link="Internal\DuplexPipe.cs" />
17+
<Compile Include="$(SharedSourceRoot)runtime\NetEventSource.Common.cs" Link="Shared\runtime\%(Filename)%(Extension)"/>
18+
<Compile Include="$(SharedSourceRoot)runtime\SR.Quic.cs" Link="Shared\runtime\%(Filename)%(Extension)"/>
19+
<Compile Include="$(SharedSourceRoot)runtime\Quic\**\*.cs" Link="Shared\runtime\Quic\%(Filename)%(Extension)" />
1720
<Compile Include="$(KestrelSharedSourceRoot)\TransportConnection.cs" Link="Internal\TransportConnection.cs" />
1821
<Compile Include="$(KestrelSharedSourceRoot)\TransportConnection.Generated.cs" Link="Internal\TransportConnection.Generated.cs" />
1922
<Compile Include="$(KestrelSharedSourceRoot)\TransportConnection.FeatureCollection.cs" Link="Internal\TransportConnection.FeatureCollection.cs" />
23+
<Compile Include="$(RepoRoot)src\Shared\TaskToApm.cs" Link="Internal\TaskToApm.cs" />
2024
</ItemGroup>
2125

2226
<ItemGroup>
@@ -26,4 +30,11 @@
2630
<Reference Include="Microsoft.Extensions.Options" />
2731
</ItemGroup>
2832

33+
<ItemGroup>
34+
<EmbeddedResource Include="$(SharedSourceRoot)runtime\SR.resx" Link="Shared\runtime\SR.resx">
35+
<ManifestResourceName>System.Net.Quic.SR</ManifestResourceName>
36+
<Generator></Generator>
37+
</EmbeddedResource>
38+
</ItemGroup>
39+
2940
</Project>

src/Shared/runtime/Http2/Hpack/HPackDecoder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace System.Net.Http.HPack
1212
{
1313
internal class HPackDecoder
1414
{
15-
private enum State
15+
private enum State : byte
1616
{
1717
Ready,
1818
HeaderFieldIndex,

src/Shared/runtime/Http2/Hpack/HeaderField.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,8 @@ public HeaderField(ReadOnlySpan<byte> name, ReadOnlySpan<byte> value)
2121
// We should revisit our allocation strategy here so we don't need to allocate per entry
2222
// and we have a cap to how much allocation can happen per dynamic table
2323
// (without limiting the number of table entries a server can provide within the table size limit).
24-
Name = new byte[name.Length];
25-
name.CopyTo(Name);
26-
27-
Value = new byte[value.Length];
28-
value.CopyTo(Value);
24+
Name = name.ToArray();
25+
Value = value.ToArray();
2926
}
3027

3128
public byte[] Name { get; }

src/Shared/runtime/Http3/QPack/QPackDecoder.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,10 @@ private void OnByte(byte b, IHttpHeadersHandler handler)
269269

270270
if (_integerDecoder.BeginTryDecode((byte)prefixInt, LiteralHeaderFieldWithoutNameReferencePrefix, out intResult))
271271
{
272+
if (intResult == 0)
273+
{
274+
throw new QPackDecodingException(SR.Format(SR.net_http_invalid_header_name, ""));
275+
}
272276
OnStringLength(intResult, State.HeaderName);
273277
}
274278
else
@@ -303,6 +307,10 @@ private void OnByte(byte b, IHttpHeadersHandler handler)
303307
case State.HeaderNameLength:
304308
if (_integerDecoder.TryDecode(b, out intResult))
305309
{
310+
if (intResult == 0)
311+
{
312+
throw new QPackDecodingException(SR.Format(SR.net_http_invalid_header_name, ""));
313+
}
306314
OnStringLength(intResult, nextState: State.HeaderName);
307315
}
308316
break;

0 commit comments

Comments
 (0)