Merge pull request #4403 from Bond-009/http2

Http1AndHttp2 is the default, no need to explicitly enable it
This commit is contained in:
Anthony Lavado 2020-11-02 11:10:28 -05:00 committed by GitHub
commit f23836c6a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -290,23 +290,19 @@ namespace Jellyfin.Server
{ {
_logger.LogInformation("Kestrel listening on {IpAddress}", address); _logger.LogInformation("Kestrel listening on {IpAddress}", address);
options.Listen(address, appHost.HttpPort); options.Listen(address, appHost.HttpPort);
if (appHost.ListenWithHttps) if (appHost.ListenWithHttps)
{ {
options.Listen(address, appHost.HttpsPort, listenOptions => options.Listen(
{ address,
listenOptions.UseHttps(appHost.Certificate); appHost.HttpsPort,
listenOptions.Protocols = HttpProtocols.Http1AndHttp2; listenOptions => listenOptions.UseHttps(appHost.Certificate));
});
} }
else if (builderContext.HostingEnvironment.IsDevelopment()) else if (builderContext.HostingEnvironment.IsDevelopment())
{ {
try try
{ {
options.Listen(address, appHost.HttpsPort, listenOptions => options.Listen(address, appHost.HttpsPort, listenOptions => listenOptions.UseHttps());
{
listenOptions.UseHttps();
listenOptions.Protocols = HttpProtocols.Http1AndHttp2;
});
} }
catch (InvalidOperationException ex) catch (InvalidOperationException ex)
{ {
@ -322,21 +318,15 @@ namespace Jellyfin.Server
if (appHost.ListenWithHttps) if (appHost.ListenWithHttps)
{ {
options.ListenAnyIP(appHost.HttpsPort, listenOptions => options.ListenAnyIP(
{ appHost.HttpsPort,
listenOptions.UseHttps(appHost.Certificate); listenOptions => listenOptions.UseHttps(appHost.Certificate));
listenOptions.Protocols = HttpProtocols.Http1AndHttp2;
});
} }
else if (builderContext.HostingEnvironment.IsDevelopment()) else if (builderContext.HostingEnvironment.IsDevelopment())
{ {
try try
{ {
options.ListenAnyIP(appHost.HttpsPort, listenOptions => options.ListenAnyIP(appHost.HttpsPort, listenOptions => listenOptions.UseHttps());
{
listenOptions.UseHttps();
listenOptions.Protocols = HttpProtocols.Http1AndHttp2;
});
} }
catch (InvalidOperationException ex) catch (InvalidOperationException ex)
{ {