Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I make an SSL-enabled HTTP request in Julia?

Tags:

http

ssl

julia

I need to make a request to an internal web service, and need to provide a custom SSL certificate chain.

In python + requests, I would set the REQUESTS_CA_BUNDLE environment variable to the path of the bundle, /etc/ssl/certs/ca-bundle.crt. What is the equivalent with Julia's HTTP.jl? It doesn't seem to be picking up the bundle automatically.

like image 241
DVNold Avatar asked Nov 02 '20 17:11

DVNold


Video Answer


2 Answers

HTTP.jl uses MbedTLS to process certificates, so I wonder if your Julia install somehow is missing that library. You might try installing MbedTLS directly for you platform and see where it looks for certificates by default.

like image 88
Bill Avatar answered Oct 21 '22 22:10

Bill


According to the docs you can pass an sslconfig object to the call. You can supply the certificate to this object:

Untested

using HTTP, MbedTLS

conf = MbedTLS.SSLConfig(cert_file, key_file)
resp = HTTP.get("https://httpbin.org/ip", sslconfig=conf)

println(resp)
like image 1
rfkortekaas Avatar answered Oct 21 '22 22:10

rfkortekaas