Backport #8898

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

Added by Ricardo Ramalho 7 months ago. Updated 7 months ago.

[ruby-core:57140]
Status:Closed
Priority:Normal
Assignee:Tomoyuki Chikanaga

Description

The new URI::Generic.findproxy 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)

httpproxy="" 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("/")'
#

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("/")'
#

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("/")'
#

Associated revisions

Revision 43062
Added by Tomoyuki Chikanaga 7 months ago

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

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

History

#1 Updated by Yui NARUSE 7 months 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.findproxy): return nil if httpproxy environment variable is empty string. [Bug #8898]

#2 Updated by Tomoyuki Chikanaga 7 months ago

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

#3 Updated by Tomoyuki Chikanaga 7 months ago

  • Tracker changed from Bug to Backport
  • Project changed from ruby-trunk to Backport200
  • Status changed from Closed to Assigned
  • Assignee set to Tomoyuki Chikanaga

#4 Updated by Tomoyuki Chikanaga 7 months 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.
   [Bug #8898]

Also available in: Atom PDF