diff --git a/lib/rubygems/commands/sources_command.rb b/lib/rubygems/commands/sources_command.rb index aa2fdd9239..239b4f5884 100644 --- a/lib/rubygems/commands/sources_command.rb +++ b/lib/rubygems/commands/sources_command.rb @@ -82,8 +82,8 @@ Do you want to add this source? def check_rubygems_https(source_uri) # :nodoc: uri = URI source_uri - if uri.scheme && uri.scheme.downcase == "http" && - uri.host.downcase == "rubygems.org" + if uri.scheme && uri.scheme.casecmp("http").zero? && + uri.host.casecmp("rubygems.org").zero? question = <<-QUESTION.chomp https://rubygems.org is recommended for security over #{uri} diff --git a/lib/rubygems/remote_fetcher.rb b/lib/rubygems/remote_fetcher.rb index d33bfd2668..708b93209f 100644 --- a/lib/rubygems/remote_fetcher.rb +++ b/lib/rubygems/remote_fetcher.rb @@ -320,7 +320,7 @@ class Gem::RemoteFetcher end def https?(uri) - uri.scheme.downcase == "https" + uri.scheme.casecmp("https").zero? end def close_all diff --git a/lib/rubygems/request/connection_pools.rb b/lib/rubygems/request/connection_pools.rb index 44280489fb..38f8db4ce0 100644 --- a/lib/rubygems/request/connection_pools.rb +++ b/lib/rubygems/request/connection_pools.rb @@ -45,7 +45,7 @@ class Gem::Request::ConnectionPools # :nodoc: end def https?(uri) - uri.scheme.downcase == "https" + uri.scheme.casecmp("https").zero? end def no_proxy?(host, env_no_proxy)