DVNold
DVNold

Reputation: 929

How can I make an SSL-enabled HTTP request in 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.

Upvotes: 7

Views: 733

Answers (2)

rfkortekaas
rfkortekaas

Reputation: 6474

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)

Upvotes: 1

Bill
Bill

Reputation: 6086

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.

Upvotes: 1

Related Questions