Abstract TLS client for more generic-purposed use.

This commit is contained in:
2022-10-28 00:33:02 +08:00
parent 92e5ed1f9c
commit d9d4eb236e
5 changed files with 12 additions and 12 deletions

View File

@@ -1,14 +1,13 @@
using Microsoft.Win32;
using System;
using System.IO;
namespace Cryville.Common.Network {
public class HttpsClient : HttpClient {
readonly TlsTcpClient _tlsTcpClient;
readonly TlsClient _tlsClient;
protected override Stream Stream {
get {
return _tlsTcpClient.Stream;
return _tlsClient.Stream;
}
}
protected override string WindowsProxyProtocolName {
@@ -18,16 +17,16 @@ namespace Cryville.Common.Network {
}
public HttpsClient(Uri baseUri) : base(baseUri, 443) {
_tlsTcpClient = new TlsTcpClient(TcpClient, baseUri.Host);
_tlsClient = new TlsClient(RawTcpStream, baseUri.Host);
}
public override void Connect() {
base.Connect();
_tlsTcpClient.Connect();
_tlsClient.Connect();
}
public override void Close() {
_tlsTcpClient.Close();
_tlsClient.Close();
base.Close();
}
}