When to use HTTP.jl vs Downloads standard lib

Hi all, I noticed in the Julia docs that there is a standard module called Downloads which implements a request function. Apparently you can make HTTP requests, complete with headers and HTTP/2 support, because Downloads uses libcurl as a backend.

Not knowing this existed, I have been using HTTP.jl for most of my HTTP-related needs. What are the pros and cons of Downloads vs HTTP.jl? Are there particular situations (for example, Genie.jl apps) where one might be more advantageous than the other?

From what I can tell, HTTP.jl is implemented in pure Julia, which I like from a philosophical perspective. But Downloads uses libcurl – possibly the most universal HTTP library out there – and thus supports a greater variety of modern features, including SFTP and HTTP/2 (HTTP/3?).

1 Like

There are some issues with Downloads.jl and curl/libcurl and they are typically quite hard to debug.
The last one where I have been involved you can see in this thread: How to use Downloads.download() with SFTP? .
There have been others e.g. when you are behind a proxy. Another one, which I remember is, that libcurl ignores the .curlrc file, which is documented but still surprising, when you don’t know it.

The main problem is, that the issues I was aware of with Download and libcurl have been difficult to solve.

For the benefit of Julia (Download is also used with Pkg) it would be great to always use Download.jl and with that ironing out all issues which are still there.

But, if someone has a hard issue with using Download and it’s easily solved by using HTTP.jl and self handling of the protocols, well, why not?

1 Like