You've already forked linux-packaging-mono
Imported Upstream version 6.8.0.73
Former-commit-id: d18deab1b47cfd3ad8cba82b3f37d00eec2170af
This commit is contained in:
parent
bceda29824
commit
73ee7591e8
@ -53,7 +53,7 @@ namespace Mono.Net.Security
|
||||
class MonoTlsStream : IDisposable
|
||||
{
|
||||
#if SECURITY_DEP
|
||||
readonly MonoTlsProvider provider;
|
||||
readonly MobileTlsProvider provider;
|
||||
readonly NetworkStream networkStream;
|
||||
readonly HttpWebRequest request;
|
||||
|
||||
@ -63,9 +63,9 @@ namespace Mono.Net.Security
|
||||
get { return request; }
|
||||
}
|
||||
|
||||
IMonoSslStream sslStream;
|
||||
SslStream sslStream;
|
||||
|
||||
internal IMonoSslStream SslStream {
|
||||
internal SslStream SslStream {
|
||||
get { return sslStream; }
|
||||
}
|
||||
#else
|
||||
@ -104,7 +104,7 @@ namespace Mono.Net.Security
|
||||
#if SECURITY_DEP
|
||||
var socket = networkStream.InternalSocket;
|
||||
WebConnection.Debug ($"MONO TLS STREAM CREATE STREAM: {socket.ID}");
|
||||
sslStream = provider.CreateSslStream (networkStream, false, settings);
|
||||
sslStream = new SslStream (networkStream, false, provider, settings);
|
||||
|
||||
try {
|
||||
var host = request.Host;
|
||||
@ -121,7 +121,7 @@ namespace Mono.Net.Security
|
||||
|
||||
status = WebExceptionStatus.Success;
|
||||
|
||||
request.ServicePoint.UpdateClientCertificate (sslStream.InternalLocalCertificate);
|
||||
request.ServicePoint.UpdateClientCertificate (sslStream.LocalCertificate);
|
||||
} catch (Exception ex) {
|
||||
WebConnection.Debug ($"MONO TLS STREAM ERROR: {socket.ID} {socket.CleanedUp} {ex.Message}");
|
||||
if (socket.CleanedUp)
|
||||
@ -132,8 +132,7 @@ namespace Mono.Net.Security
|
||||
status = WebExceptionStatus.SecureChannelFailure;
|
||||
|
||||
request.ServicePoint.UpdateClientCertificate (null);
|
||||
sslStream.Dispose ();
|
||||
sslStream = null;
|
||||
CloseSslStream ();
|
||||
throw;
|
||||
}
|
||||
|
||||
@ -142,12 +141,11 @@ namespace Mono.Net.Security
|
||||
await sslStream.WriteAsync (tunnel.Data, 0, tunnel.Data.Length, cancellationToken).ConfigureAwait (false);
|
||||
} catch {
|
||||
status = WebExceptionStatus.SendFailure;
|
||||
sslStream.Dispose ();
|
||||
sslStream = null;
|
||||
CloseSslStream ();
|
||||
throw;
|
||||
}
|
||||
|
||||
return sslStream.AuthenticatedStream;
|
||||
return sslStream;
|
||||
#else
|
||||
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
|
||||
#endif
|
||||
@ -155,6 +153,10 @@ namespace Mono.Net.Security
|
||||
|
||||
public void Dispose ()
|
||||
{
|
||||
CloseSslStream ();
|
||||
}
|
||||
|
||||
void CloseSslStream () {
|
||||
if (sslStream != null) {
|
||||
sslStream.Dispose ();
|
||||
sslStream = null;
|
||||
|
Reference in New Issue
Block a user