Flowdock
method

no_proxy?

Importance_0
v2_6_3 - Show latest stable - 0 notes - Class: ConnectionPools
no_proxy?(host, env_no_proxy) private

No documentation

This method has no description. You can help the Ruby community by adding new notes.

Hide source
# File lib/rubygems/request/connection_pools.rb, line 52
  def no_proxy?(host, env_no_proxy)
    host = host.downcase

    env_no_proxy.any? do |pattern|
      env_no_proxy_pattern = pattern.downcase.dup

      # Remove dot in front of pattern for wildcard matching
      env_no_proxy_pattern[0] = "" if env_no_proxy_pattern[0] == "."

      host_tokens = host.split(".")
      pattern_tokens = env_no_proxy_pattern.split(".")

      intersection = (host_tokens - pattern_tokens) | (pattern_tokens - host_tokens)

      # When we do the split into tokens we miss a dot character, so add it back if we need it
      missing_dot = intersection.length > 0 ? 1 : 0
      start = intersection.join(".").size + missing_dot

      no_proxy_host = host[start..-1]

      env_no_proxy_pattern == no_proxy_host
    end
  end
Register or log in to add new notes.