Class: Gem::RemoteFetcher

Class | Gem::RemoteFetcher
In: | lib/rubygems/remote_fetcher.rb
Parent: | Object

RemoteFetcher handles the details of fetching gems and gem information from a remote source.

### Methods

connection_for download escape fetch_path fetch_size fetcher get_proxy_from_env new normalize_uri open_uri_or_path request reset unescape

### Included Modules

Gem::UserInteraction

### Classes and Modules

Class Gem::RemoteFetcher::FetchError

### Public Class methods

fetcher()

Cached RemoteFetcher instance.

new(proxy = nil)

Initialize a remote fetcher using the source URI and possible proxy information.

`proxy`

- [String]: explicit specification of proxy; overrides any environment

                variable setting

- nil: respect environment variables (HTTP_PROXY, HTTP_PROXY_USER,

           HTTP_PROXY_PASS)

- `:no_proxy`: ignore environment variables and _don‘t_ use a proxy

### Public Instance methods

connection_for(uri)

Creates or an HTTP connection based on `uri`, or retrieves an existing connection, using a proxy if needed.

download(spec, source_uri, install_dir = Gem.dir)

Moves the gem `spec` from `source_uri` to the cache dir unless it is already there. If the source_uri is local the gem cache dir copy is always replaced.

escape(str)
fetch_path(uri, mtime = nil, head = false)

Downloads `uri` and returns it as a String.

fetch_size(uri)

Returns the size of `uri` in bytes.

get_proxy_from_env()

Returns an HTTP proxy URI if one is set in the environment variables.

normalize_uri(uri)

Normalize the URI by adding "http://" if it is missing.

open_uri_or_path(uri, last_modified = nil, head = false, depth = 0)

Read the data from the (source based) URI, but if it is a file:// URI, read from the filesystem instead.

request(uri, request_class, last_modified = nil)

Performs a Net::HTTP request of type `request_class` on `uri` returning a Net::HTTP response object. request maintains a table of persistent connections to reduce connect overhead.

reset(connection)

Resets HTTP connection `connection`.

unescape(str)

[Validate]