mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-27 23:17:20 +01:00
Fix bad certificate handling
This commit is contained in:
@@ -174,7 +174,7 @@ namespace TGServiceInterface
|
||||
/// Sets the function called when a remote login fails due to the server having an invalid SSL cert
|
||||
/// </summary>
|
||||
/// <param name="handler">The <see cref="Func{T, TResult}"/> to be called when a remote login is attempted while the server posesses a bad certificate. Passed a <see cref="string"/> of error information about the and should return <see langword="true"/> if it the connection should be made anyway</param>
|
||||
public void SetBadCertificateHandler(Func<string, bool> handler)
|
||||
public static void SetBadCertificateHandler(Func<string, bool> handler)
|
||||
{
|
||||
ServicePointManager.ServerCertificateValidationCallback = (sender, cert, chain, error) =>
|
||||
{
|
||||
@@ -196,7 +196,7 @@ namespace TGServiceInterface
|
||||
ErrorMessage = "An unknown error occurred.";
|
||||
break;
|
||||
}
|
||||
ErrorMessage = String.Format("The certificate failed to verify for {0}:{1}. {2} {3}", HTTPSURL, HTTPSPort, ErrorMessage, cert.ToString());
|
||||
ErrorMessage = String.Format("The server's certificate failed to verify! Error: {0} Cert: {1}", ErrorMessage, cert.ToString());
|
||||
return handler(ErrorMessage);
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user