开发者

How do I get Cabal to bypass my Windows proxy settings?

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 que开发者_如何学Gostion.


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.


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!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜