Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

RubyGems NO_PROXY auto-detection without http_configuration gem

View rubygems-1.8.5-no_proxy.patch
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
--- rubygems-1.8.5/lib/rubygems/remote_fetcher.rb.orig 2011-07-20 00:28:13.000000000 +0900
+++ rubygems-1.8.5/lib/rubygems/remote_fetcher.rb 2011-07-20 01:09:59.000000000 +0900
@@ -69,6 +69,7 @@
when URI::HTTP then proxy
else URI.parse(proxy)
end
+ @no_proxy = (ENV['NO_PROXY'] || ENV['no_proxy'] || 'localhost, 127.0.0.1').split(/\s*,\s*/)
@user_agent = user_agent
end
@@ -296,10 +297,17 @@
# Creates or an HTTP connection based on +uri+, or retrieves an existing
# connection, using a proxy if needed.
+ def out_of_no_proxy?(uri)
+ @no_proxy.each do |host_addr|
+ return false if uri.host.match(Regexp.quote(host_addr) + '$')
+ end
+ return true
+ end
+
def connection_for(uri)
net_http_args = [uri.host, uri.port]
- if @proxy_uri then
+ if @proxy_uri and out_of_no_proxy?(uri) then
net_http_args += [
@proxy_uri.host,
@proxy_uri.port,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.