因此,我正在创建一个支持HTTP / s和SOCKS4 / 5代理的TcpClient系统,它工作得很好,但问题是SSL身份验证经常返回意外的异常。
var ClientNetworkStream = _TcpClient.GetStream(); //where _TcpClient is a connected TcpClient to lets say a SOCKS4 Proxy
//where url = an Absolute URI of an url
if (!url.Scheme.Equals("https", StringComparison.OrdinalIgnoreCase)) return;//Nothing to do as its not a https url
SslStream sslStream = new SslStream(ClientNetworkStream, false, (sender, cert, chain, err) => true);//create sslStream and ignore cert checking as I do not need it
try {
sslStream.AuthenticateAsClient(url.Host, null, false);
} catch (IOException ex) {
//The handshake packet issue gets thrown here.
}
如果我根本不进行身份验证,它将返回一个正文,指出“将HTTP请求发送到https端口”,因此我假设实际上需要SSLStream。
有人知道做错了什么吗?
URL的端口为:443(SSL) 代理端口通常是非常随机的,此问题发生在:80、8080、8888、3128、8118、1080、5555、8123等
(是的,我确认可以在其他代理服务器上提到的大多数端口上工作:https://i.imgur.com/pY2dkGf.png)