D-Programming-Language/phobos — pull request #1043 by dnewbie (2012-12-29 19:56:04+00:00)
Title: Set CA certificate

import std.net.curl, std.stdio;
void main()
{
auto http = HTTP("https://openssl.org");
http.perform();
}

If I run this on Windows, I get the following error

std.net.curl.CurlException@std\net\curl.d(3449): Peer certificate cannot be authenticated with given CA certificates on handle 2349950
----------------
0x0043AE0C
0x0043AC97
0x0040D295
0x00409840
0x00409876
0x00409479
0x0040603C
0x76CA33AA in BaseThreadInitThunk
0x77999EF2 in RtlInitializeExceptionChain
0x77999EC5 in RtlInitializeExceptionChain
----------------

This can be solved by adding a new property to HTTP

@property void caInfo(const(char)[] caFile)
{
p.curl.set(CurlOption.cainfo, caFile);
}

Usage:
auto http = HTTP("https://openssl.org");
http.caInfo = r"C:\path\curl-ca-bundle.crt";
http.perform();