Reputation: 91
I would like to know how to include a cert file when sending requests in HTTP.jl.
In Python, using Requests
it would look like this,
requests.get(url, params=payload, verify=cert_file)
The documentation mentions SSL certs, but is unclear.
Upvotes: 1
Views: 425
Reputation: 6086
It really is poorly documented, and in similar cases I've had to look at the source code to MbedTLS (within the site https://tls.mbed.org/), which is what the package HTTP.jl calls for certificates.
MbedTLS in turn looks for the systems's installed certificates, so if you install the certificate for your user, HTTP.jl should use it for https. I realize this may not help your specific need, which may require something like this (untested):
using HTTP, MbedTLS
conf = MbedTLS.SSLConfig(cert_file, key_file)
resp = HTTP.get("https://httpbin.org/ip", sslconfig=conf)
println(resp)
itself.
If you have to go back to the MbedTLS source as I did, I suggest you look at the example at https://github.com/JuliaLang/MbedTLS.jl and the source at https://github.com/JuliaLang/MbedTLS.jl/blob/master/src/MbedTLS.jl, especially the function SSLConfig(cert_file, key_file) on line 103.
Upvotes: 1