aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rubygems/remote_fetcher.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rubygems/remote_fetcher.rb')
-rw-r--r--lib/rubygems/remote_fetcher.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/rubygems/remote_fetcher.rb b/lib/rubygems/remote_fetcher.rb
index da4db724a1..e6a13d4b8c 100644
--- a/lib/rubygems/remote_fetcher.rb
+++ b/lib/rubygems/remote_fetcher.rb
@@ -260,6 +260,9 @@ class Gem::RemoteFetcher
Net::HTTPTemporaryRedirect then
raise FetchError.new('too many redirects', uri) if depth > 10
+ unless location = response['Location']
+ raise FetchError.new("redirecting but no redirect location was given", uri)
+ end
location = URI.parse response['Location']
if https?(uri) && !https?(location)