httparty
httparty copied to clipboard
Impossible to use Net::HTTP option for ignoring proxy set in environment
L: 73 lib/httparty/connection_adapter.rb
def connection
host = clean_host(uri.host)
if options[:http_proxyaddr]
http = Net::HTTP.new(host, uri.port, options[:http_proxyaddr], options[:http_proxyport], options[:http_proxyuser], options[:http_proxypass])
else
http = Net::HTTP.new(host, uri.port)
end
http://ruby-doc.org/stdlib-2.1.2/libdoc/net/http/rdoc/Net/HTTP.html#method-c-new
one must pass nil to proxy address to disable the usage of proxy_from_env
Solution:
drop the if statement, Net::HTTP.new will accept nil's
Pretty sure the if was added to fix some issue. Maybe it only affected older versions of ruby?
1.8.7, 1.9.3, 2.1.2 - net http changed a bit, but the concept was the same, one could and should be able to pass nil to bypass environmental proxy. It's like curl --proxy '' google.com, core feature...