Sync H2 namespace updates (#710)
authorChris Ross <Tratcher@Outlook.com>
Tue, 10 Dec 2019 23:36:42 +0000 (15:36 -0800)
committerGitHub <noreply@github.com>
Tue, 10 Dec 2019 23:36:42 +0000 (15:36 -0800)
src/libraries/Common/src/System/Net/Http/Http2/Hpack/HPackDecoder.cs
src/libraries/Common/src/System/Net/Http/Http2/Hpack/StatusCodes.cs
src/libraries/Common/src/System/Net/Http/Http2/IHttpHeadersHandler.cs
src/libraries/Common/tests/Tests/System/Net/Http2/HPackDecoderTest.cs

index 19e6f34..93c4bfe 100644 (file)
@@ -4,6 +4,9 @@
 
 using System.Buffers;
 using System.Diagnostics;
+#if KESTREL
+using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http;
+#endif
 
 namespace System.Net.Http.HPack
 {
index 602a3c0..f302e73 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (c) .NET Foundation. All rights reserved.
+// Copyright (c) .NET Foundation. All rights reserved.
 // Licensed under the Apache License, Version 2.0.
 // See THIRD-PARTY-NOTICES.TXT in the project root for license information.
 
@@ -9,6 +9,8 @@ namespace System.Net.Http.HPack
 {
     internal static class StatusCodes
     {
+        // This uses C# compiler's ability to refer to static data directly. For more information see https://vcsjones.dev/2019/02/01/csharp-readonly-span-bytes-static
+
         private static ReadOnlySpan<byte> BytesStatus100 => new byte[] { (byte)'1', (byte)'0', (byte)'0' };
         private static ReadOnlySpan<byte> BytesStatus101 => new byte[] { (byte)'1', (byte)'0', (byte)'1' };
         private static ReadOnlySpan<byte> BytesStatus102 => new byte[] { (byte)'1', (byte)'0', (byte)'2' };
index f86dc9f..256dde1 100644 (file)
@@ -2,11 +2,22 @@
 // The .NET Foundation licenses this file to you under the MIT license.
 // See the LICENSE file in the project root for more information.
 
+#if KESTREL
+using System;
+
+namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
+#else
 namespace System.Net.Http
+#endif
 {
-    internal interface IHttpHeadersHandler
+#if KESTREL
+    public
+#else
+    internal
+#endif
+    interface IHttpHeadersHandler
     {
         void OnHeader(ReadOnlySpan<byte> name, ReadOnlySpan<byte> value);
         void OnHeadersComplete(bool endStream);
     }
-}
\ No newline at end of file
+}
index 01dd76c..9e80a50 100644 (file)
@@ -8,6 +8,9 @@ using System.Collections.Generic;
 using System.Text;
 using System.Net.Http.HPack;
 using Xunit;
+#if KESTREL
+using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http;
+#endif
 
 namespace System.Net.Http.Unit.Tests.HPack
 {