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

Also available in: Atom PDF

Like0
Like0Like0Like0Like0