Rubygem BUG

I suppose the rubyforge bug report is most appropriate, but I don’t
mind
where it’s reported, as long as I find out :slight_smile:

So here’s another one for you: --http-proxy seems to ignore the port.
gem -P http://proxy:8000 -l (and variations) barf up with:

*** REMOTE GEMS ***
c:/langs/ruby/lib/ruby/1.8/open-uri.rb:544:in proxy_open': 404 Not Found (OpenURI::HTTPError) from c:/langs/ruby/lib/ruby/1.8/open-uri.rb:167:in open_loop’
from c:/langs/ruby/lib/ruby/1.8/open-uri.rb:164:in catch' from c:/langs/ruby/lib/ruby/1.8/open-uri.rb:164:in open_loop’
from c:/langs/ruby/lib/ruby/1.8/open-uri.rb:134:in open_uri' from c:/langs/ruby/lib/ruby/1.8/open-uri.rb:422:in open’
from c:/langs/ruby/lib/ruby/1.8/open-uri.rb:85:in open' from c:/langs/ruby/lib/ruby/site_ruby/1.8/rubygems/remote_installer.rb:172:in fetch’
from
c:/langs/ruby/lib/ruby/site_ruby/1.8/rubygems/remote_installer.rb:96:in
get_caches' from c:/langs/ruby/lib/ruby/site_ruby/1.8/rubygems/remote_installer.rb:87:in each’
from
c:/langs/ruby/lib/ruby/site_ruby/1.8/rubygems/remote_installer.rb:87:in
get_caches' from c:/langs/ruby/lib/ruby/site_ruby/1.8/rubygems/remote_installer.rb:62:in search’
from c:/langs/ruby/bin/gem:622:in _list_gems' from c:/langs/ruby/bin/gem:454:in list’
from c:/langs/ruby/bin/gem:119:in `run’
from c:/langs/ruby/bin/gem:694

(and yes, the ‘proxy’ and port are correct :slight_smile:

Assaph wrote:

I suppose the rubyforge bug report is most appropriate, but I don’t mind
where it’s reported, as long as I find out :slight_smile:

So here’s another one for you: --http-proxy seems to ignore the port.
gem -P http://proxy:8000 -l (and variations) barf up with:

*** REMOTE GEMS ***
c:/langs/ruby/lib/ruby/1.8/open-uri.rb:544:in `proxy_open’: 404 Not
Found (OpenURI::HTTPError)
[…]

Hmmmm. This is what I get:

$ gem -Rl ra -P http://www-cache:8000

*** REMOTE GEMS ***
Error fetching remote gem cache: getaddrinfo: no address associated with
hostname.

I installed 0.3 to confirm this problem, but before I did that my proxy
operations were running fine. That code would have been perhaps two weeks
old.

Anyway, thanks for the report. It shouldn’t be hard to track down.

BTW, I get the same error if I:

  • put quotes around the proxy address
  • set the HTTP_PROXY environment variable and run without ‘-P’ argument

No cheers,
Gavin

Thanks, Assaph. I’ll check this when I get to work this morning (and
behind a proxy server). It was working for me last week somehow. :slight_smile:

(Also entered this in the bug tracker).

Chad

···

On 3/5/2004, at 2:19 AM, Mehr, Assaph (Assaph) wrote:

So here’s another one for you: --http-proxy seems to ignore the port.
gem -P http://proxy:8000 -l (and variations) barf up with:

*** REMOTE GEMS ***
c:/langs/ruby/lib/ruby/1.8/open-uri.rb:544:in proxy_open': 404 Not Found (OpenURI::HTTPError) from c:/langs/ruby/lib/ruby/1.8/open-uri.rb:167:in open_loop’
from c:/langs/ruby/lib/ruby/1.8/open-uri.rb:164:in catch' from c:/langs/ruby/lib/ruby/1.8/open-uri.rb:164:in open_loop’
from c:/langs/ruby/lib/ruby/1.8/open-uri.rb:134:in open_uri' from c:/langs/ruby/lib/ruby/1.8/open-uri.rb:422:in open’
from c:/langs/ruby/lib/ruby/1.8/open-uri.rb:85:in open' from c:/langs/ruby/lib/ruby/site_ruby/1.8/rubygems/remote_installer.rb:172: in fetch’
from
c:/langs/ruby/lib/ruby/site_ruby/1.8/rubygems/remote_installer.rb:96:in
get_caches' from c:/langs/ruby/lib/ruby/site_ruby/1.8/rubygems/remote_installer.rb:87:in each’
from
c:/langs/ruby/lib/ruby/site_ruby/1.8/rubygems/remote_installer.rb:87:in
get_caches' from c:/langs/ruby/lib/ruby/site_ruby/1.8/rubygems/remote_installer.rb:62:in search’
from c:/langs/ruby/bin/gem:622:in _list_gems' from c:/langs/ruby/bin/gem:454:in list’
from c:/langs/ruby/bin/gem:119:in `run’
from c:/langs/ruby/bin/gem:694

(snipped)

I didn’t get a chance to finish today, but at this point, it looks like
there is a small bug in the open-uri.rb library. Specifically, the bug
appears to be in URI::HTTP.proxy_open where the following happens:

require ‘net/http’
resp = nil
Net::HTTP.start(self.host, self.port) {|http|
^^^^^^^

The value here ends up getting set in the “Host” HTTP header. This
means “Host” gets set to the proxy host, which is not correct. From
the HTTP 1.1 RFC (RFC 2616)[1]

The Host request-header field specifies the Internet host and port
number of the resource being requested, as obtained from the original
URI given by the user or referring resource…

In the open-uri library, the resource being requested is not the
proxy server, but that’s what is getting set in the “Host” header.

I will try to make a patch over the next couple of days, but I’m
traveling (again) and will have limited time.

Chad

[1]HTTP/1.1: Header Field Definitions

···

On 3/5/2004, at 2:19 AM, Mehr, Assaph (Assaph) wrote:

I suppose the rubyforge bug report is most appropriate, but I don’t
mind
where it’s reported, as long as I find out :slight_smile:

So here’s another one for you: --http-proxy seems to ignore the port.
gem -P http://proxy:8000 -l (and variations) barf up with:

*** REMOTE GEMS ***
c:/langs/ruby/lib/ruby/1.8/open-uri.rb:544:in proxy_open': 404 Not Found (OpenURI::HTTPError) from c:/langs/ruby/lib/ruby/1.8/open-uri.rb:167:in open_loop’
from c:/langs/ruby/lib/ruby/1.8/open-uri.rb:164:in catch' from c:/langs/ruby/lib/ruby/1.8/open-uri.rb:164:in open_loop’
from c:/langs/ruby/lib/ruby/1.8/open-uri.rb:134:in open_uri' from c:/langs/ruby/lib/ruby/1.8/open-uri.rb:422:in open’
from c:/langs/ruby/lib/ruby/1.8/open-uri.rb:85:in `open’
from

In article 41F691C2-9D52-11D8-BFE9-000A95BDA42A@chadfowler.com,
Chad Fowler chad@chadfowler.com writes:

The value here ends up getting set in the “Host” HTTP header. This
means “Host” gets set to the proxy host, which is not correct. From
the HTTP 1.1 RFC (RFC 2616)[1]

The bug is already fixed. The latest CVS version set Host: field for
original resource.

···


Tanaka Akira

Thank you, Tanaka!

Chad

···

On 4/5/2004, at 1:02 AM, Tanaka Akira wrote:

In article 41F691C2-9D52-11D8-BFE9-000A95BDA42A@chadfowler.com,
Chad Fowler chad@chadfowler.com writes:

The value here ends up getting set in the “Host” HTTP header. This
means “Host” gets set to the proxy host, which is not correct. From
the HTTP 1.1 RFC (RFC 2616)[1]

The bug is already fixed. The latest CVS version set Host: field for
original resource.