Method: Gem::Net::HTTP::Persistent#proxy=
- Defined in:
- lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb
#proxy=(proxy) ⇒ Object
Sets the proxy server. The proxy may be the Gem::URI of the proxy server, the symbol :ENV which will read the proxy from the environment or nil to disable use of a proxy. See #proxy_from_env for details on setting the proxy from the environment.
If the proxy Gem::URI is set after requests have been made, the next request will shut-down and re-open all connections.
The no_proxy query parameter can be used to specify hosts which shouldn’t be reached via proxy; if set it should be a comma separated list of hostname suffixes, optionally with :port appended, for example example.com,some.host:8080.
764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 |
# File 'lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb', line 764 def proxy= proxy @proxy_uri = case proxy when :ENV then proxy_from_env when Gem::URI::HTTP then proxy when nil then # ignore else raise ArgumentError, 'proxy must be :ENV or a Gem::URI::HTTP' end @no_proxy.clear if @proxy_uri then @proxy_args = [ @proxy_uri.hostname, @proxy_uri.port, unescape(@proxy_uri.user), unescape(@proxy_uri.password), ] @proxy_connection_id = [nil, *@proxy_args].join ':' if @proxy_uri.query then @no_proxy = CGI.parse(@proxy_uri.query)['no_proxy'].join(',').downcase.split(',').map { |x| x.strip }.reject { |x| x.empty? } end end reconnect reconnect_ssl end |