You've already forked linux-packaging-mono
Imported Upstream version 5.4.0.167
Former-commit-id: 5624ac747d633e885131e8349322922b6a59baaa
This commit is contained in:
parent
e49d6f06c0
commit
536cd135cc
@ -1 +1 @@
|
||||
7fd9f4e617cb14446f1c0b378f89c4cf8428b896
|
||||
5f6a3e96a03fd839708cd965990030483ed1179d
|
@ -9,6 +9,8 @@ partial class SR
|
||||
{
|
||||
public const string mono_net_io_shutdown = "mono_net_io_shutdown";
|
||||
public const string mono_net_io_renegotiate = "mono_net_io_renegotiate";
|
||||
|
||||
public const string net_ssl_io_already_shutdown = "Write operations are not allowed after the channel was shutdown.";
|
||||
|
||||
public const string net_log_set_socketoption_reuseport_default_on = "net_log_set_socketoption_reuseport_default_on";
|
||||
public const string net_log_set_socketoption_reuseport_not_supported = "net_log_set_socketoption_reuseport_not_supported";
|
||||
|
@ -0,0 +1,73 @@
|
||||
using System.Net.Security;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Threading;
|
||||
|
||||
namespace System.Net
|
||||
{
|
||||
internal class ServerCertValidationCallback
|
||||
{
|
||||
readonly RemoteCertificateValidationCallback m_ValidationCallback;
|
||||
readonly ExecutionContext m_Context;
|
||||
|
||||
internal ServerCertValidationCallback(RemoteCertificateValidationCallback validationCallback)
|
||||
{
|
||||
m_ValidationCallback = validationCallback;
|
||||
m_Context = ExecutionContext.Capture();
|
||||
}
|
||||
|
||||
internal RemoteCertificateValidationCallback ValidationCallback {
|
||||
get { return m_ValidationCallback;}
|
||||
}
|
||||
|
||||
internal void Callback(object state)
|
||||
{
|
||||
CallbackContext context = (CallbackContext) state;
|
||||
context.result = m_ValidationCallback(context.request,
|
||||
context.certificate,
|
||||
context.chain,
|
||||
context.sslPolicyErrors);
|
||||
}
|
||||
|
||||
internal bool Invoke(object request,
|
||||
X509Certificate certificate,
|
||||
X509Chain chain,
|
||||
SslPolicyErrors sslPolicyErrors)
|
||||
{
|
||||
if (m_Context == null)
|
||||
{
|
||||
return m_ValidationCallback(request, certificate, chain, sslPolicyErrors);
|
||||
}
|
||||
else
|
||||
{
|
||||
ExecutionContext execContext = m_Context.CreateCopy();
|
||||
CallbackContext callbackContext = new CallbackContext(request,
|
||||
certificate,
|
||||
chain,
|
||||
sslPolicyErrors);
|
||||
ExecutionContext.Run(execContext, Callback, callbackContext);
|
||||
return callbackContext.result;
|
||||
}
|
||||
}
|
||||
|
||||
private class CallbackContext
|
||||
{
|
||||
internal readonly Object request;
|
||||
internal readonly X509Certificate certificate;
|
||||
internal readonly X509Chain chain;
|
||||
internal readonly SslPolicyErrors sslPolicyErrors;
|
||||
|
||||
internal bool result;
|
||||
|
||||
internal CallbackContext(Object request,
|
||||
X509Certificate certificate,
|
||||
X509Chain chain,
|
||||
SslPolicyErrors sslPolicyErrors)
|
||||
{
|
||||
this.request = request;
|
||||
this.certificate = certificate;
|
||||
this.chain = chain;
|
||||
this.sslPolicyErrors = sslPolicyErrors;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user