The following call is made in our code base:
require 'open-uri'
open(url, :proxy => nil)
However, when the call is made, Open uri uses the http_proxy environment variable to make the call, which is effectively blocked by our firewall. According to the docs when passing nil or false to the proxy option, the environment variables should be ignored as well, but this doesn't seem to be the case.
If we either switch to Ruby version 1.8.7 or unset the environment variable, the call is made successfully without the proxy. The problem is that we need to use a proxy for calls to the internet, but we cannot use them for internal calls (which is the case here) due to our firewall configuration.
Any help would be greatly appreciated!
I can reproduce what you described
I've digged the code, and I think I've found the problem.
So far
open-urimanage correctly the proxy. For instance, inOpenURI.open_loop, it correctly considers that theproxyis set tonil(see open-uri.rb#195But when it creates a
Net::HTTPinstance intoOpenURI.open_httpit doesn't pass
p_addr = nil. According the source code and doc forHTTP.newAbove the doc says
I've patched
open-uri.rbby replacing the line 291 byNow, it behaves as expected.
just filled an issue in Ruby bug tracker about that.