gem与代理设置

I'm behind an authenticated proxy and RubyGems doesn't seem to support username/password based authentication.

Some investigation seems to indicate that open-uri.rb doesn't support authentication. open-uri is based on Net::HTTP
which *does* support authentication so it should be relatively easy to modify open-uri to do that too. I spent about
an hour on it, but couldn't immediately get something working (open-uri is using Net::HTTP in a somewhat quirky way).

C:/>gem -v

C:/>"c:/ruby/bin/ruby.exe" "c:/ruby/bin/gem" -v
0.8.3

C:/>gem list -p http://proxy:8080 -r --backtrace

C:/>"c:/ruby/bin/ruby.exe" "c:/ruby/bin/gem" list -p http://proxy1.macbank:8080 -r --backtrace

*** REMOTE GEMS ***
Updating Gem source index for: http://gems.rubyforge.org
ERROR:  While executing gem ... (OpenURI::HTTPError)
    407 Proxy Authentication Required
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/open-uri.rb:574:in `proxy_open'
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/open-uri.rb:167:in `open_loop'
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/open-uri.rb:164:in `catch'
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/open-uri.rb:164:in `open_loop'
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/open-uri.rb:134:in `open_uri'
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/open-uri.rb:424:in `open'
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/open-uri.rb:85:in `open'
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/remote_installer.rb:96:in `read_data'
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/remote_installer.rb:34:in `fetch_path'
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/remote_installer.rb:55:in `source_index'
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/remote_installer.rb:269:in `source_index'
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/remote_installer.rb:400:in `fetch_source'
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/remote_installer.rb:391:in `source_index_hash'
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/remote_installer.rb:390:in `each'
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/remote_installer.rb:390:in `source_index_hash'
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/remote_installer.rb:370:in `search'
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/gem_commands.rb:376:in `execute'
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/gem_commands.rb:459:in `execute'
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/command.rb:49:in `invoke'
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/cmd_manager.rb:90:in `process_args'
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/cmd_manager.rb:63:in `run'
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/gem_runner.rb:9:in `run'
c:/ruby/bin/gem:11

 
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值