未验证 提交 8fb75deb 编写于 作者: M Marie Píchová 提交者: GitHub

Fixed :scheme header for H/2 with PlaintextStreamFilter (#71057)

上级 925e26ed
......@@ -103,7 +103,7 @@ private async Task ReadPrefixAsync()
await _connectionStream.WriteAsync("HTTP/2.0 400 Bad Request\r\n\r\n"u8.ToArray());
_connectionSocket.Shutdown(SocketShutdown.Send);
// If WinHTTP doesn't support streaming a request without a length then it will fallback
// to HTTP/1.1. Throwing an exception to detect this case in WinHttpHandler tests.
// to HTTP/1.1. Throwing an exception to detect this case in WinHttpHandler tests.
throw new Exception("HTTP/1.1 request sent to HTTP/2 connection.");
}
}
......
......@@ -1424,7 +1424,7 @@ private void WriteHeaders(HttpRequestMessage request, ref ArrayBuffer headerBuff
WriteIndexedHeader(H2StaticTable.MethodGet, normalizedMethod.Method, ref headerBuffer);
}
WriteIndexedHeader(_stream is SslStream ? H2StaticTable.SchemeHttps : H2StaticTable.SchemeHttp, ref headerBuffer);
WriteIndexedHeader(_pool.IsSecure ? H2StaticTable.SchemeHttps : H2StaticTable.SchemeHttp, ref headerBuffer);
if (request.HasHeaders && request.Headers.Host != null)
{
......
......@@ -3193,7 +3193,12 @@ public async Task PlaintextStreamFilter_SimpleDelegatingStream_Success(bool useS
},
async server =>
{
await server.AcceptConnectionSendResponseAndCloseAsync(content: "foo");
HttpRequestData request = await server.AcceptConnectionSendResponseAndCloseAsync(content: "foo");
if (request.Version == HttpVersion20.Value)
{
HttpHeaderData schemeHeader = Assert.Single(request.Headers, headerData => headerData.Name == ":scheme");
Assert.Equal(useSsl ? "https" : "http", schemeHeader.Value);
}
}, options: options);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册