Encode the alt-svc header after pseudo-headers ("All pseudo-header fields MUST appear...
authorCory Nelson <phrosty@gmail.com>
Mon, 21 Sep 2020 18:29:23 +0000 (11:29 -0700)
committerGitHub <noreply@github.com>
Mon, 21 Sep 2020 18:29:23 +0000 (11:29 -0700)
src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/Http3RequestStream.cs

index 27829f0..6cb2509 100644 (file)
@@ -519,9 +519,6 @@ namespace System.Net.Http
                 BufferBytes(_connection.Pool._http3EncodedAuthorityHostHeader);
             }
 
-            // The only way to reach H3 is to upgrade via an Alt-Svc header, so we can encode Alt-Used for every connection.
-            BufferBytes(_connection.AltUsedEncodedHeaderBytes);
-
             Debug.Assert(request.RequestUri != null);
             string pathAndQuery = request.RequestUri.PathAndQuery;
             if (pathAndQuery == "/")
@@ -533,6 +530,9 @@ namespace System.Net.Http
                 BufferLiteralHeaderWithStaticNameReference(H3StaticTable.PathSlash, pathAndQuery);
             }
 
+            // The only way to reach H3 is to upgrade via an Alt-Svc header, so we can encode Alt-Used for every connection.
+            BufferBytes(_connection.AltUsedEncodedHeaderBytes);
+
             if (request.HasHeaders)
             {
                 // H3 does not support Transfer-Encoding: chunked.