Project

General

Profile

Actions

Backport #8898

closed

NET::HTTP always raises an exception if http_proxy="" (empty string)

Added by rgr (Ricardo Ramalho) over 10 years ago. Updated over 10 years ago.


Description

The new URI::Generic.find_proxy code uses this environment variable, even if it's set to "". I believe it should test if it's "", and behave as if there was no proxy (nil if "").
Previous rubies behave as expected, ignoring http_proxy="" (only tested 1.9.3, 1.9.2 and ree-1.8.7)

http_proxy="" rvm use ruby 2.0.0 exec ruby -e 'require "net/http"; p Net::HTTP::Proxy(nil, nil).new("www.google.com", 80).get("/")'
/usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:883:in initialize': getaddrinfo: Name or service not known (SocketError) from /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:883:in open'
from /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:883:in block in connect' from /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/timeout.rb:52:in timeout'
from /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:882:in connect' from /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:864:in do_start'
from /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:853:in start' from /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:1372:in request'
from /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:1131:in get' from -e:1:in '

http_proxy="" rvm use ruby 1.9.3 exec ruby -e 'require "net/http"; p Net::HTTP::Proxy(nil, nil).new("www.google.com", 80).get("/")'
#<Net::HTTPOK 200 OK readbody=true>

http_proxy="" rvm use ruby 1.9.2 exec ruby -e 'require "net/http"; p Net::HTTP::Proxy(nil, nil).new("www.google.com", 80).get("/")'
#<Net::HTTPOK 200 OK readbody=true>

http_proxy="" rvm use ree-1.8.7 exec ruby -e 'require "net/http"; p Net::HTTP::Proxy(nil, nil).new("www.google.com", 80).get("/")'
#<Net::HTTPOK 200 OK readbody=true>

Actions #1

Updated by naruse (Yui NARUSE) over 10 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r42930.
Ricardo, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • lib/uri/generic.rb (URI::Generic.find_proxy): return nil if
    http_proxy environment variable is empty string.
    [ruby-core:57140] [Bug #8898]

Updated by nagachika (Tomoyuki Chikanaga) over 10 years ago

  • Backport changed from 1.9.3: UNKNOWN, 2.0.0: UNKNOWN to 1.9.3: DONTNEED, 2.0.0: REQUIRED
Actions #3

Updated by nagachika (Tomoyuki Chikanaga) over 10 years ago

  • Tracker changed from Bug to Backport
  • Project changed from Ruby master to Backport200
  • Status changed from Closed to Assigned
  • Assignee set to nagachika (Tomoyuki Chikanaga)
Actions #4

Updated by nagachika (Tomoyuki Chikanaga) over 10 years ago

  • Status changed from Assigned to Closed

This issue was solved with changeset r43062.
Ricardo, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


merge revision(s) 42930: [Backport #8898]

* lib/uri/generic.rb (URI::Generic.find_proxy): return nil if
  http_proxy environment variable is empty string.
  [ruby-core:57140] [Bug #8898]
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0