Update shared Http3 code (#32133)
authorJustin Kotalik <jkotalik12@gmail.com>
Tue, 11 Feb 2020 22:48:55 +0000 (14:48 -0800)
committerGitHub <noreply@github.com>
Tue, 11 Feb 2020 22:48:55 +0000 (14:48 -0800)
src/libraries/Common/src/System/Net/Http/Http2/IHttpHeadersHandler.cs
src/libraries/Common/src/System/Net/Http/Http3/QPack/HeaderField.cs
src/libraries/Common/src/System/Net/Http/Http3/QPack/QPackDecoder.cs

index 311afa8..11a7e34 100644 (file)
@@ -2,6 +2,7 @@
 // The .NET Foundation licenses this file to you under the MIT license.
 // See the LICENSE file in the project root for more information.
 
+// Don't ever change this unless we are explicitly trying to remove IHttpHeadersHandler as public API.
 #if KESTREL
 using System;
 
index 5f9e34a..1259438 100644 (file)
@@ -8,8 +8,8 @@ namespace System.Net.Http.QPack
     {
         public HeaderField(byte[] name, byte[] value)
         {
-            Name = new byte[name.Length];
-            Value = new byte[value.Length];
+            Name = name;
+            Value = value;
         }
 
         public byte[] Name { get; }
index e8c4006..dfde487 100644 (file)
@@ -7,6 +7,10 @@ using System.Diagnostics;
 using System.Net.Http.HPack;
 using System.Numerics;
 
+#if KESTREL
+using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http;
+#endif
+
 namespace System.Net.Http.QPack
 {
     internal class QPackDecoder : IDisposable
@@ -220,7 +224,7 @@ namespace System.Net.Http.QPack
                     }
                     break;
                 case State.CompressedHeaders:
-                    switch (BitOperations.LeadingZeroCount(b))
+                    switch (BitOperations.LeadingZeroCount(b) - 24)
                     {
                         case 0: // Indexed Header Field
                             prefixInt = IndexedHeaderFieldPrefixMask & b;
@@ -402,6 +406,8 @@ namespace System.Net.Http.QPack
             {
                 Debug.Assert(index >= 0 && index <= H3StaticTable.Instance.Count, $"The index should be a valid static index here. {nameof(QPackDecoder)} should have previously thrown if it read a dynamic index.");
                 handler.OnStaticIndexedHeader(index, headerValueSpan);
+                _index = null;
+
                 return;
             }
             else