[patch] #562: cabal-install update fails going through a HTTP proxy

Duncan Coutts duncan at haskell.org
Fri Sep 18 20:17:46 EDT 2009

On Sat, 2009-09-19 at 00:50 +0300, Valery V. Vorotyntsev wrote:
> Dear Cabal maintainers,

Thanks very much for investigating this Valery. It's great that you have
shed some light on this previously mysterious bug.

> The bug is not in HTTP API, but in the way cabal-install uses it.
> The type of HTTP response body is polymorphic within `HTTP' library
> (rspBody :: Response a -> a) but it is specialized to Lazy.ByteString by
> cabal-install's `getHTTP' function (Distribution/Client/HttpUtils.hs).
> Once the type of response body is changed to _strict_ ByteString, files
> get downloaded through proxy completely.

But that is exactly what makes me think it's a bug in the HTTP library.
The HTTP library provides instances for String, strict ByteString and
lazy ByteString. With one instance provided by the HTTP library your
test program fails and with the other it works.

It not completely implausible that it could be the fault of the way we
use the HTTP library. For example if we were holding onto the lazy
ByteString for a long period without demanding all of it then perhaps
that could upset the network flow by causing timeouts or something,
however I don't think anything like that is going on here. The code
pretty swiftly takes the response and writes the content out to disk.

As I mentioned in the Cabal ticket, I'd be very interested in hearing
Sigbjorn's diagnosis before considering whether we want to work around
the problem by switching to strict ByteString. If at all possible I
would prefer to stick to lazy ByteString.


More information about the cabal-devel mailing list