ruby - 在 Windows 上使用 gem 时为 "bad response Proxy Authentication"

标签 ruby windows-xp rubygems

当我尝试添加源时:

C:\>gem source --verbose --add http://gemcutter.org

GET http://gemcutter.org/specs.4.8.gz
407 Proxy Authentication Required
Error fetching http://gemcutter.org:
    bad response Proxy Authentication Required 407 (http://gemcutter.org/specs.4.8.gz)

附注我的 Windows XP 客户端通过代理访问网络,所以我尝试了:

C:\>gem -v
1.8.10

C:\>gem source --verbose --http-proxy http://192.168.10.24:3128 --add http://gemcutter.org

但返回相同的错误。我该如何解决?

最佳答案

您需要以某种方式将代理用户名和密码放在那里。

在 *nix 机器上,gem 查找名为 HTTP_PROXY 的环境变量。您也可以在 Windows 上设置此变量。

在运行 gem 命令之前运行 SET HTTP_PROXY=http://%USER%:%PASSWORD%@192.168.10.24:3128


另一种可能性是在您的计算机本身上安装另一个“代理”。参见 How do I update Ruby Gems from behind a Proxy (ISA-NTLM)http://ntlmaps.sourceforge.net/有关详细信息。


您也许可以使用 rubysspi .参见说明 here .

关于ruby - 在 Windows 上使用 gem 时为 "bad response Proxy Authentication",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7830981/

相关文章:

ruby-on-rails - 如何在 Active Record 中正确使用多态关联的连接

ruby-on-rails - 通过 Post 在 Rails 中发送 JSON 对象

Javascript 和 Windows

带有 native 扩展的 Ruby gem 不适用于 AWS Lambda

ruby - 检查 Ruby Gem 的可用性

Ruby - 将字符串转换为日期

html - Rails - 使用 Active Storage 在新选项卡中打开图像

c++ - 如何修复我的 "self-deleting".exe 以防止提前删除自身?

windows-xp - 如何告诉 "windows security center"我是 "antivirus"?

ruby - NoMethodError - `type' :String: 的未定义方法 "string"