The proxy you use simply does not support proxying https://
URLs:
$ https_proxy=http://154.16.202.22:3128 curl -v https://httpbin.org/ip
* Trying 154.16.202.22...
* TCP_NODELAY set
* Connected to (nil) (154.16.202.22) port 3128 (#0)
* Establish HTTP proxy tunnel to httpbin.org:443
> CONNECT httpbin.org:443 HTTP/1.1
> Host: httpbin.org:443
> User-Agent: curl/7.52.1
> Proxy-Connection: Keep-Alive
>
< HTTP/1.1 400 Bad Request
Apart from that the URL for the proxy itself is wrong - it should be http://..
and not https://..
even if you proxy HTTPS traffic. But requests actually ignores the given protocol completely, so this error is not the reason for the problem. But just to demonstrate that it would not work either if the proxy itself got accessed with HTTPS (as the URL suggests):
$ https_proxy=https://154.16.202.22:3128 curl -v https://httpbin.org/ip
* Trying 154.16.202.22...
* TCP_NODELAY set
* Connected to (nil) (154.16.202.22) port 3128 (#0)
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* TLSv1.2 (OUT), TLS header, Certificate Status (22):
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol
* Curl_http_done: called premature == 0
* Closing connection 0
curl: (35) error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol
So the fix here would be to use a different proxy, one which actually supports proxying https://
URLs.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…