Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
Patch Available
Description
The CreateHttpClientHandler() factory method of THttpTransport should be virtual instead of static. This allows overriding the method and manipulating the returned handler. Amongst others, one possible use case could be to relax the SSL/TLS validation checks intentionally for some custom purpose, like so:
public class TCustomizedHttpTransport : THttpTransport { public override HttpClientHandler CreateHttpClientHandler(X509Certificate[] certs = null) { var handler = base.CreateHttpClientHandler(certificates); handler.ServerCertificateCustomValidationCallback = MyCallback; return handler; } private bool MyCallback(object s, X509Certificate crt, X509Chain ch, SslPolicyErrors e) { var other_errors = e & (~SslPolicyErrors.RemoteCertificateNameMismatch); return (SslPolicyErrors.None == other_errors); } }
Attachments
Issue Links
- links to