This makes SSL connections via proxies work correctly.

So, when connecting to an https endpoint via a proxy you're supposed to use a plain TCP socket and send '<verb> https://host HTTP/1.1' as the request line. The current code is trying to talk to the proxy using TLS and that doesn't work.