2969 - re-issed code to address when developer doesn't have certificate installed.

This commit is contained in:
BaronGreenback 2020-04-26 19:35:36 +01:00
parent d1684b1053
commit a0a5512069

View File

@ -272,17 +272,17 @@ namespace Jellyfin.Server
{
_logger.LogInformation("Kestrel listening on {IpAddress}", address);
options.Listen(address, appHost.HttpPort);
if (appHost.EnableHttps)
if (appHost.EnableHttps && appHost.Certificate != null)
{
if (appHost.Certificate != null)
options.Listen(address, appHost.HttpsPort, listenOptions =>
{
options.Listen(address, appHost.HttpsPort, listenOptions =>
{
listenOptions.UseHttps(appHost.Certificate);
listenOptions.Protocols = HttpProtocols.Http1AndHttp2;
});
}
else if (builderContext.HostingEnvironment.IsDevelopment())
listenOptions.UseHttps(appHost.Certificate);
listenOptions.Protocols = HttpProtocols.Http1AndHttp2;
});
}
else if (builderContext.HostingEnvironment.IsDevelopment())
{
try
{
options.Listen(address, appHost.HttpsPort, listenOptions =>
{
@ -290,6 +290,10 @@ namespace Jellyfin.Server
listenOptions.Protocols = HttpProtocols.Http1AndHttp2;
});
}
catch (Exception ex)
{
_logger.LogError(ex, "Error whilst listing to https - Is a development certificate installed?");
}
}
}
}
@ -298,17 +302,17 @@ namespace Jellyfin.Server
_logger.LogInformation("Kestrel listening on all interfaces");
options.ListenAnyIP(appHost.HttpPort);
if (appHost.EnableHttps)
if (appHost.EnableHttps && appHost.Certificate != null)
{
if (appHost.Certificate != null)
options.ListenAnyIP(appHost.HttpsPort, listenOptions =>
{
options.ListenAnyIP(appHost.HttpsPort, listenOptions =>
{
listenOptions.UseHttps(appHost.Certificate);
listenOptions.Protocols = HttpProtocols.Http1AndHttp2;
});
}
else if (builderContext.HostingEnvironment.IsDevelopment())
listenOptions.UseHttps(appHost.Certificate);
listenOptions.Protocols = HttpProtocols.Http1AndHttp2;
});
}
else if (builderContext.HostingEnvironment.IsDevelopment())
{
try
{
options.ListenAnyIP(appHost.HttpsPort, listenOptions =>
{
@ -316,6 +320,10 @@ namespace Jellyfin.Server
listenOptions.Protocols = HttpProtocols.Http1AndHttp2;
});
}
catch (Exception ex)
{
_logger.LogError(ex, "Error whilst listing to https - Is a development certificate installed?");
}
}
}
})