From b31adbd5057d73bf2baaacdb67aa6d1151ecffd0 Mon Sep 17 00:00:00 2001 From: Joao Matos Silva Date: Wed, 15 Feb 2017 16:26:55 +0000 Subject: [PATCH] Allow to skip the CA certificate Validation. This fixes #6 --- src/Tinify/Client.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Tinify/Client.cs b/src/Tinify/Client.cs index eaa84f4..f9bc139 100755 --- a/src/Tinify/Client.cs +++ b/src/Tinify/Client.cs @@ -21,12 +21,14 @@ public class Client HttpClient client; - public Client(string key, string appIdentifier = null, string proxy = null) + public Client(string key, string appIdentifier = null, string proxy = null, bool validateServerCertificate = true) { - var handler = new HttpClientHandler() + var handler = new HttpClientHandler(); + + if (validateServerCertificate) { - ServerCertificateCustomValidationCallback = Internal.SSL.ValidationCallback - }; + handler.ServerCertificateCustomValidationCallback = Internal.SSL.ValidationCallback; + } if (proxy != null) {