Skip to content

Commit 603de2c

Browse files
committed
TorHttpClient: SslStream is supposed to support SNI since .NET Core 2.1.
dotnet/runtime#17677 dotnet/corefx#28278
1 parent 2c8fd08 commit 603de2c

File tree

1 file changed

+2
-20
lines changed

1 file changed

+2
-20
lines changed

WalletWasabi/Tor/Http/TorHttpClient.cs

+2-20
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ public async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, Can
173173

174174
// https://tools.ietf.org/html/rfc7230#section-2.7.1
175175
// A sender MUST NOT generate an "http" URI with an empty host identifier.
176-
var host = Guard.NotNullOrEmptyOrWhitespace($"{nameof(request)}.{nameof(request.RequestUri)}.{nameof(request.RequestUri.DnsSafeHost)}", request.RequestUri.DnsSafeHost, trim: true);
176+
string host = Guard.NotNullOrEmptyOrWhitespace($"{nameof(request)}.{nameof(request.RequestUri)}.{nameof(request.RequestUri.DnsSafeHost)}", request.RequestUri.DnsSafeHost, trim: true);
177177

178178
// https://tools.ietf.org/html/rfc7230#section-2.6
179179
// Intermediaries that process HTTP messages (i.e., all intermediaries
@@ -197,25 +197,7 @@ public async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, Can
197197
Stream stream = TorSocks5Client.TcpClient.GetStream();
198198
if (request.RequestUri.Scheme == "https")
199199
{
200-
SslStream sslStream;
201-
// On Linux and OSX ignore certificate, because of a .NET Core bug
202-
// This is a security vulnerability, has to be fixed as soon as the bug get fixed
203-
// Details:
204-
// https://github.com/dotnet/corefx/issues/21761
205-
// https://github.com/nopara73/DotNetTor/issues/4
206-
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
207-
{
208-
sslStream = new SslStream(
209-
stream,
210-
leaveInnerStreamOpen: true);
211-
}
212-
else
213-
{
214-
sslStream = new SslStream(
215-
stream,
216-
leaveInnerStreamOpen: true,
217-
userCertificateValidationCallback: (a, b, c, d) => true);
218-
}
200+
SslStream sslStream = new SslStream(stream, leaveInnerStreamOpen: true);
219201

220202
await sslStream
221203
.AuthenticateAsClientAsync(

0 commit comments

Comments
 (0)