Stubborn 403 trying to use gems with proxy on windows cygwin

Hey all,

We’re on windows, using cygwin, behind a firewall with a proxy and
having difficulty (understatement) installing rails. It seems that no
combination of http proxy parameters and environment variables will get
this to work, all of them result in the output copied below. At the same
time, wget will download any of the listed files just file (with the
http_proxy env variable set).

Any ideas? Thanks a bunch!
Najati

cygwin:/cygdrive/c/path> gem install rails --debug
Exception NameError' at /usr/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:161 - uninitialized constant Gem::Comma nds::InstallCommand ExceptionGem::LoadError’ at
/usr/lib/ruby/site_ruby/1.8/rubygems.rb:826 - Could not find RubyGem
test-unit (>= 0)

Exception `Gem::LoadError’ at
/usr/lib/ruby/site_ruby/1.8/rubygems.rb:826 - Could not find RubyGem
sources (> 0.0.1)

Exception Gem::RemoteFetcher::FetchError' at /usr/lib/ruby/site_ruby/1.8/rubygems/remote_fetcher.rb:290 - bad response Forbidden 403 (http://gems.rubyforge.org/latest_specs.4.8.gz) ExceptionGem::RemoteFetcher::FetchError’ at
/usr/lib/ruby/site_ruby/1.8/rubygems/remote_fetcher.rb:168 - bad
response
Forbidden 403 (http://gems.rubyforge.org/latest_specs.4.8.gz)
Exception Gem::RemoteFetcher::FetchError' at /usr/lib/ruby/site_ruby/1.8/rubygems/remote_fetcher.rb:290 - bad response Forbidden 403 (http://gems.rubyforge.org/specs.4.8.gz) ExceptionGem::RemoteFetcher::FetchError’ at
/usr/lib/ruby/site_ruby/1.8/rubygems/remote_fetcher.rb:168 - bad
response
Forbidden 403 (http://gems.rubyforge.org/specs.4.8.gz)
Exception Gem::RemoteFetcher::FetchError' at /usr/lib/ruby/site_ruby/1.8/rubygems/remote_fetcher.rb:290 - bad response Forbidden 403 (http://gems.rubyforge.org/yaml) ExceptionGem::RemoteFetcher::FetchError’ at
/usr/lib/ruby/site_ruby/1.8/rubygems/remote_fetcher.rb:168 - bad
response
Forbidden 403 (http://gems.rubyforge.org/yaml)
ERROR: http://gems.rubyforge.org/ does not appear to be a repository
Exception Gem::RemoteFetcher::FetchError' at /usr/lib/ruby/site_ruby/1.8/rubygems/spec_fetcher.rb:155 - bad response Fo rbidden 403 (http://gems.rubyforge.org/yaml) ExceptionGem::GemNotFoundException’ at
/usr/lib/ruby/site_ruby/1.8/rubygems/dependency_installer.rb:200 - could
not fi
nd gem rails locally or in a repository
ERROR: could not find gem rails locally or in a repository
cygwin:/cygdrive/c/path>

Najati I. wrote:

[some nonsense …]
Forbidden 403 (http://gems.rubyforge.org/latest_specs.4.8.gz)
[nonsense continues …]

So it seems as though my proxy is filtering based on User-Agent. I got
gem to install rails by changing gem’s remote_fetcher.rb. In def request
you’ll find

ua = "RubyGems/#{Gem::RubyGemsVersion} #{Gem::Platform.local}"
ua << " Ruby/#{RUBY_VERSION} (#{RUBY_RELEASE_DATE}"
ua << " patchlevel #{RUBY_PATCHLEVEL}" if defined? RUBY_PATCHLEVEL
ua << ")"

I replaced all of this with a blatant lie:

ua = "Wget/1.9.1"

and gem worked just fine, so it seems.

I know there are others around the World Wide Web that are having
similar issues. Without knowing how many of them are caused by this
issue: maybe it would be worth the little bit of effort to make
User-Agent a gem parameter?

Live long and prosper,
Najati