Downloading files over TLS

ikod geller.garry at gmail.com
Fri Jun 26 11:10:27 UTC 2020


On Friday, 26 June 2020 at 10:12:09 UTC, Jacob Carlborg wrote:
> Downloading files over TLS. This seems that it's something that 
> should be quite simple to do. My high level goals are 
> cross-platform and easy distribution. I don't need anything 
> fancy just a simple API like this:
>
> download("https://url.com", "/local/file");
>
....

> Is there anything obvious I'm missing or why does this seem so 
> difficult? Do I have too high expectations and requirements?
>
> [1] https://code.dlang.org/packages/requests
> [2] https://code.dlang.org/packages/vibe-d
> [3] https://code.dlang.org/packages/hunt
> [4] https://code.dlang.org/packages/arsd-official%3Ahttp
> [5] 
> https://developer.apple.com/documentation/security/secure_transport
> [6] https://developer.apple.com/documentation/network
> [7] 
> https://developer.apple.com/documentation/foundation/nsurlsession
> [8] https://code.dlang.org/packages/botan
>
> --
> /Jacob Carlborg

Hello,

re `requests` - it uses dlopen (and variants for OSX and Windows, 
see 
https://github.com/ikod/dlang-requests/blob/master/source/requests/ssl_adapter.d#L50). The reason for dlopen is simple - compatibility with both openssl ver 1.0 and 1.1 (which have incompatible interfaces). To solve this problem I expose common interface for Requests internal needs, and detect and use different underlying openssl interfaces depending on library version.

I'm sure it is possible to detect library version at build time, 
and then use static linking. It just require some time investment 
to find most acceptable solution on how to do this.

Re Windows - I'd be happy to use native SecureChannel but I have 
zero windows programming experience. I'm completely open for any 
help in this field.

Bottom line - problem with SSL/TLS libraries lies in 
incompatibility between platforms and even inside the single 
library.



More information about the Digitalmars-d-learn mailing list