Skip to content

Commit 102dc8b

Browse files
Sergey KanzhelevSergey Kanzhelev
Sergey Kanzhelev
authored and
Sergey Kanzhelev
committed
added try/catch into the callback
1 parent b64011c commit 102dc8b

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

WebTestsTools/Controllers/CertificateController.cs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,21 @@ public class CertificateController : ApiController
1515
{
1616
private static bool InternalCallback(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
1717
{
18-
WebRequest request = sender as WebRequest;
18+
try
19+
{
20+
WebRequest request = sender as WebRequest;
1921

20-
Certificate cert = new Certificate();
21-
certificates.Add(request, cert);
22+
Certificate cert = new Certificate();
23+
certificates.Add(request, cert);
2224

23-
cert.ExpirationDate = certificate.GetExpirationDateString();
24-
cert.IssuerName = certificate.Issuer;
25-
cert.Subject = certificate.Subject;
25+
cert.ExpirationDate = certificate.GetExpirationDateString();
26+
cert.IssuerName = certificate.Issuer;
27+
cert.Subject = certificate.Subject;
28+
}
29+
catch (Exception exc)
30+
{
31+
//do nothing
32+
}
2633

2734
return true;
2835
}

0 commit comments

Comments
 (0)