aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rubygems/spec_fetcher.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rubygems/spec_fetcher.rb')
-rw-r--r--lib/rubygems/spec_fetcher.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/rubygems/spec_fetcher.rb b/lib/rubygems/spec_fetcher.rb
index 62613f7a51..31205b9a06 100644
--- a/lib/rubygems/spec_fetcher.rb
+++ b/lib/rubygems/spec_fetcher.rb
@@ -241,7 +241,13 @@ class Gem::SpecFetcher
https_uri.scheme = 'https'
https_uri += '/'
- Gem::RemoteFetcher.fetcher.fetch_path https_uri, nil, true
+ https_uri = URI https_uri.to_s # cast to URI::HTTPS
+
+ begin
+ Gem::RemoteFetcher.fetcher.fetch_path https_uri, nil, true
+ rescue Gem::RemoteFetcher::FetchError => e
+ raise unless e.message =~ / Not Allowed 405 /
+ end
say "Upgraded #{uri} to HTTPS"