Use https_proxy if available

RubyGems would automatically look for HTTP proxies, but would not look
for HTTPS proxies. RubyGems would send HTTPS traffic over the HTTP
proxy.

Now RubyGems looks for the HTTPS proxy in the environment for HTTPS URLs
and falls back to the HTTP proxy if no HTTPS proxy was found.

Fixes #610
Rearrange to fit in 80 columns

Using local variables makes this code much easier to read.

Also, remove a redundant comment.