Skip to content

Commit

Permalink
Merge branch 'master' of github.com:rubygems/rubygems-mirror
Browse files Browse the repository at this point in the history
* 'master' of github.com:rubygems/rubygems-mirror:
  Support use of proxy options from the environment
  Give Net::HTTP::Get.new the path, not the full uri
  • Loading branch information
raggi committed Oct 15, 2010
2 parents ee482f5 + 6b62a32 commit 99d050f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/rubygems/mirror/fetcher.rb
Expand Up @@ -6,15 +6,15 @@ class Gem::Mirror::Fetcher
class Error < StandardError; end

def initialize
@http = Net::HTTP::Persistent.new
@http = Net::HTTP::Persistent.new(self.class.name, :ENV)
end

# Fetch a source path under the base uri, and put it in the same or given
# destination path under the base path.
def fetch(uri, path)
modified_time = File.exists?(path) && File.stat(path).mtime.rfc822

req = Net::HTTP::Get.new uri
req = Net::HTTP::Get.new URI.parse(uri).path
req.add_field 'If-Modified-Since', modified_time if modified_time

@http.request URI(uri), req do |resp|
Expand Down

0 comments on commit 99d050f

Please sign in to comment.