From 4e82a19b5ade2f5ada60763d266c61b661cc44e1 Mon Sep 17 00:00:00 2001 From: jayki Date: Wed, 26 Jul 2017 09:36:17 +0200 Subject: [PATCH] fix #1292 quick&dirty This will fix issue #1292 proxy-localhost quick& dirty. Not the nice way, but works. Happy to see commits to make this look good. --- lib/user_agent.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/user_agent.rb b/lib/user_agent.rb index 1f835840ad40..53e211274c3c 100644 --- a/lib/user_agent.rb +++ b/lib/user_agent.rb @@ -280,8 +280,11 @@ def self.get_http(uri, options) if proxy_password.blank? proxy_password = nil end - - http = Net::HTTP::Proxy(proxy_host, proxy_port, proxy_username, proxy_password).new(uri.host, uri.port) + if (!uri.host.include?("127.0.0.1") && !uri.host.include?("localhost")) + http = Net::HTTP::Proxy(proxy_host, proxy_port, proxy_username, proxy_password).new(uri.host, uri.port) + else + http = Net::HTTP.new(uri.host, uri.port) + end else http = Net::HTTP.new(uri.host, uri.port) end