tags:

views:

430

answers:

2

When retrieving packages with Cabal, I frequently get errors with this message:

user error (Codec.Compression.Zlib: premature end of compressed stream)

It looks like Cabal is using my Windows Networking proxy settings (for Privoxy).

From digging around Google, Cabal or its libraries appear to have (had) a problem in this area.

Possible solutions I can see are:

  1. Turn off proxying while using Cabal (not very keen on this one); or

  2. Get a patch and start hacking. I'm hesitant to go down this path, as I'm a complete Haskell noob and I'm not yet comfortable with Darcs; or

  3. Give it the magic "can I haz no proxy" parameter. Hence the question.

+1  A: 

If I'm reading http://darcs.haskell.org/cabal-install/Distribution/Client/HttpUtils.hs correctly, you should be able to set the environment variable HTTP_PROXY to an invalid value (would "" work?) to get it to go direct.

SamB
Thanks for that. I'm on the road at the moment, hope to try it out over Easter.
Brent.Longborough
OK, tested. I followed your guidelines and eventually got it to work. I've accepted your answer, +1, and posted my solution based on your tip. Thanks again.
Brent.Longborough
+1  A: 

Following @SamB's advice, and experimenting a bit, the solution I am now using is:

export HTTP_PROXY="::"

Here's part of the experimental log:

Try @SamB's solution:

[12:10:35z ~]:export HTTP_PROXY=""
[12:11:47z ~]:set|grep HTTP
HTTP_PROXY=
[12:11:50z ~]:cabal update
Downloading the latest package list from hackage.haskell.org
cabal.exe: connect: failed (Connection refused (WSAECONNREFUSED))

Try a "reasonable person's" solution:

[12:11:54z ~]:export HTTP_PROXY="None"
[12:12:02z ~]:set|grep HTTP
HTTP_PROXY=None
[12:12:04z ~]:cabal update
Downloading the latest package list from hackage.haskell.org
cabal.exe: user error [\]
           (openTCPConnection: host lookup failure for "None")

Try an "unreasonable person's" solution:

[12:23:44z ~]:export HTTP_PROXY="::"
[12:24:00z ~]:set|grep HTTP
HTTP_PROXY=::
[12:24:04z ~]:cabal update
Downloading the latest package list from hackage.haskell.org
Warning: invalid http proxy uri: "::"
Warning: proxy uri must be http with a hostname
Warning: ignoring http proxy, trying a direct connection
Note: there is a new version of cabal-install available.
To upgrade, run: cabal install cabal-install
[12:24:34z ~]:

Yay!

Brent.Longborough
I'm not sure why you call that an "unreasonable person's" solution -- I *did* say you should try an invalid value :-).
SamB