Use proper escaping for proxy passwords

URI.escape does not correctly escape some characters for HTTP proxy
usernames and passwords.  This means that passwords containing an "@"
result in an exception.

Now RubyGems uses proper escaping to allow all possible passwords.

Fixes #668

See also ruby bug #8979