We have a Julia application that communicates with other services over REST APIs. These services use mutual TLS for authentication, which in turn requires the use of client side TLS certificates. We found that LibCURL was the best way to do HTTPS with client certificates, but with a very C like interface, it was hard for Julia developers to use.
This led us to build CurlHTTP, which is a very Julia like interface for doing HTTP(S) with LibCURL.
LibCURL.jl and HTTP.jl are the two primary ways to write HTTP clients in Julia. They both have their pros and cons.
HTTP.jl
While HTTP.jl has a very easy to use interface to access the majority of features, including cookie handling and streaming, it suddenly becomes very complicated when you try to use TLS client certificates. HTTP.jl also doesn't have the ability to do multiple downloads in parallel on a single execution thread.
LibCURL.jl
LibCURL makes it very easy to do mutual TLS, supporting client and server TLS certificates with well documented APIs, and has a well documented multiple download interface, but it provides a fairly low level API, and is primarily suited to developers familiar with writing applications in C.
For our use case, we decided to build a higher level Julia wrapper around LibCURL's HTTP functionality (similar to what SMTPClient.jl does for SMTP over LibCURL), while making some of curl's more complicated features easy to use in a Julian way.
CurlHTTP.jl
The result is CurlHTTP.jl, which provides a high level HTTP interface to LibCURL, supporting single and multiple downloads, mutual TLS, and data streaming.
Talk Structure
This talk will first briefly cover the features of CurlHTTP and how to use it.
We will then spend a little more time going into some of the nuances and gotchas we faced while developing this library, particularly with passing Julian data types through the C interface and back to our callbacks, and with dealing with memory management in a clean way.