Detect HTTPS on rubygems.org which disallows HEAD

RubyGems.org does not allow HEAD requests at this time.  This would
cause automatic HTTP upgrade to fail with a 405 Not Allowed and continue
to use HTTP.  Now the 405 response is detected and considered OK.

This fixes a bug introduced in @872ab85