Thread overview
Starting a HTTPS session with D
Feb 12, 2015
Kadir Erdem Demir
Feb 12, 2015
Vladimir Panteleev
Feb 12, 2015
Kadir Erdem Demir
Aug 18, 2015
sigod
February 12, 2015
Hi

We have a network traffic logger module at office.
We need to a tool which creates simple traffic with different protocols and test our product's output to see if we parse the headers correctly or not.

And of course I proposed writing this tool with D!!!

When it comes to create a HTTP session it is very easy

auto content = get("dlang.org");

But I couldn't find any examples about https. Do I have to use a C library like libcurl for it. Or is there a native way do solve my problem.

Regards
Erdem
February 12, 2015
On Thursday, 12 February 2015 at 12:11:27 UTC, Kadir Erdem Demir wrote:
> Hi
>
> We have a network traffic logger module at office.
> We need to a tool which creates simple traffic with different protocols and test our product's output to see if we parse the headers correctly or not.
>
> And of course I proposed writing this tool with D!!!
>
> When it comes to create a HTTP session it is very easy
>
> auto content = get("dlang.org");
>
> But I couldn't find any examples about https. Do I have to use a C library like libcurl for it. Or is there a native way do solve my problem.

No, you can keep using std.net.curl.

You just need to tell curl how to verify server certificates.

On Windows, if you are using the curl library included with DMD 2.066.1, curl will use the Windows certificate store. Otherwise, you need to provide a trusted CA bundle:

auto http = HTTP();
http.handle.set(CurlOption.cainfo, "path/to/ca-bundle.crt");

Or, to completely disable verification:

http.handle.set(CurlOption.ssl_verifypeer, false);

Then:

get("https://dlang.org", http);
February 12, 2015
> get("https://dlang.org", http);

It works as I wanted, thanks a lot .

Regards
Erdem
August 18, 2015
On Thursday, 12 February 2015 at 12:34:21 UTC, Vladimir Panteleev wrote:
> On Windows, if you are using the curl library included with DMD 2.066.1, curl will use the Windows certificate store.

Did this changed? I use 2.068.0 and still have problems with SSL.

Sorry for necroposting.