Abstract TLS client for more generic-purposed use.
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user