Permalink
Browse files

Update #773 for ruby without HTTPResponse#uri=

Older ruby does not have this feature so we have to fall back to the
slow way.
  • Loading branch information...
1 parent 02d9a23 commit a2f497fff36cbd5a38da7be6c08341de6340b689 @drbrain drbrain committed Feb 6, 2014
Showing with 7 additions and 3 deletions.
  1. +1 −1 lib/rubygems/remote_fetcher.rb
  2. +5 −1 lib/rubygems/source.rb
  3. +1 −1 test/rubygems/test_gem_source.rb
@@ -232,7 +232,7 @@ def fetch_http uri, last_modified = nil, head = false, depth = 0
case response
when Net::HTTPOK, Net::HTTPNotModified then
- response.uri = uri
+ response.uri = uri if response.respond_to? :uri
head ? response : response.body
when Net::HTTPMovedPermanently, Net::HTTPFound, Net::HTTPSeeOther,
Net::HTTPTemporaryRedirect then
View
@@ -86,7 +86,11 @@ def dependency_resolver_set # :nodoc:
rescue Gem::RemoteFetcher::FetchError
Gem::Resolver::IndexSet.new self
else
- Gem::Resolver::APISet.new response.uri
+ if response.respond_to? :uri then
+ Gem::Resolver::APISet.new response.uri
+ else
+ Gem::Resolver::APISet.new bundler_api_uri
+ end
end
end
@@ -41,7 +41,7 @@ def test_cache_dir_escapes_windows_paths
def test_dependency_resolver_set_bundler_api
response = Net::HTTPResponse.new '1.1', 200, 'OK'
- response.uri = URI('http://example')
+ response.uri = URI('http://example') if response.respond_to? :uri
@fetcher.data["#{@gem_repo}api/v1/dependencies"] = response

0 comments on commit a2f497f

Please sign in to comment.