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

流过昼夜 提交于 2019-12-07 11:26:03

问题


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:


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.




回答2:


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!



来源:https://stackoverflow.com/questions/1551053/how-do-i-get-cabal-to-bypass-my-windows-proxy-settings

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!