如何让 Cabal 绕过我的 Windows 代理设置?

发布于 2024-08-07 07:04:28 字数 402 浏览 8 评论 0原文

当使用 Cabal 检索包时,我经常收到以下错误消息:

用户错误(编解码器.压缩.Zlib: 压缩流提前结束)

看起来 Cabal 正在使用我的 Windows 网络代理设置(针对 Privoxy)。

通过对 Google 的挖掘,Cabal 或其库似乎存在问题 在这个区域。

我能看到的可能的解决方案是:

  1. 使用 Cabal 时关闭代理(不太热衷于这个);或

  2. 获取补丁并开始黑客攻击。我在犹豫要不要走这条路 因为我是一个彻头彻尾的 Haskell 菜鸟,而且我还不太熟悉 Darcs;或

  3. 给它神奇的“我可以没有代理吗”参数。因此问题就来了。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

娇女薄笑 2024-08-14 07:04:28

如果我正在阅读 http://darcs.haskell.org/cabal -install/Distribution/Client/HttpUtils.hs 正确,您应该能够将环境变量 HTTP_PROXY 设置为无效值(“”会起作用吗?)以使其直接运行。

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.

错々过的事 2024-08-14 07:04:28

遵循@SamB的建议并进行一些实验,我现在使用的解决方案是:

export HTTP_PROXY="::"

这是实验日志的一部分:

尝试@SamB的解决方案:

[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))

尝试“合理的人”的解决方案:

[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")

尝试“不合理的人”的解决方案:

[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 ~]:

耶!

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!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文