Replace cURL with HTTP library for GHC tarball download #23

Closed
tmhedberg opened this Issue Mar 20, 2013 · 4 comments

2 participants

@tmhedberg
Owner

9664443 introduced the ability to download a GHC binary tarball for usage in a new hsenv sandbox. The download is performed by calling out to an external curl binary.

While curl is ubiquitous, it might be better not to rely on external dependencies that cannot automatically be pulled down via cabal-install. Consider replacing the usage of curl with a Haskell HTTP library such as http-streams.

@adinapoli

I prefer http-conduit, just because it relies on "tsl" instead of "HsOpenSSL" and it's slightly less verbose SSL side. Instead, if we don't need SSL, http-stream might be a good pick, even though is still in its infancy and can be dangerous.

@tmhedberg
Owner

We're only talking about downloading GHC tarballs here, which I don't believe requires SSL. In any case, while it's worth considering the various library options, I don't think the choice of underlying SSL library matters that much, as those details should normally be abstracted away beneath the HTTP library's interface.

@adinapoli

Yep, I guessed that, but my preference would still be towards http-conduit, for maturity reasons :)

@adinapoli

@tmhedberg I came up with a really elegant implementation using http-streams:

downloadFile :: URL -> FilePath -> IO ()
downloadFile url name = get url $ \_ inStream -> do
  S.withFileAsOutput name (S.connect inStream)

Committing and PRing in 20 mins or so :)

@tmhedberg tmhedberg pushed a commit that closed this issue Jul 18, 2013
Alfredo Di Napoli Fixes #23 9399fbf
@tmhedberg tmhedberg closed this in 9399fbf Jul 18, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment