Proper proxy handling

I am currently trying to access github API through a http proxy, so I'd like to propose a little patch to improve proxy handling.

What it changes :
1) the proxy setting is the complete address ( ex: config.proxy = "http://someproxy:8080" )
2) if the protocol is omitted, it uses HTTPS
3) If the port is omitted, it uses 443 for https or 80 for http
3) if no proxy was given, the HTTPS_PROXY environment variable is used, or HTTP_PROXY if it's not set
4) the proxy in the config overrides environment variables, so one can give NULL to use none
5) when using a proxy, the request path is the full targetted url (before the host was missing, so the proxy had no clue where to send the request)

That's all folks! I only tested it in my case, so any feedback would be appreciated :)