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.");
}
}
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)
{
},
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);
}