You've already forked linux-packaging-mono
Imported Upstream version 5.10.0.47
Former-commit-id: d0813289fa2d35e1f8ed77530acb4fb1df441bc0
This commit is contained in:
parent
88ff76fe28
commit
e46a49ecf1
@ -10,11 +10,7 @@
|
||||
<HarvestIncludePaths Include="ref/netstandard1.3">
|
||||
<SupportedFramework>netcore50</SupportedFramework>
|
||||
</HarvestIncludePaths>
|
||||
<HarvestIncludePaths Include="runtimes/win/lib/netstandard1.3" />
|
||||
<HarvestIncludePaths Include="runtimes/unix/lib/netstandard1.3">
|
||||
<!-- package unix impl (platform not supported) as RID agnostic -->
|
||||
<TargetPath>lib/netstandard1.3</TargetPath>
|
||||
</HarvestIncludePaths>
|
||||
<HarvestIncludePaths Include="runtimes/win/lib/netstandard1.3;lib/netstandard1.3" />
|
||||
</ItemGroup>
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
|
||||
</Project>
|
@ -35,6 +35,9 @@
|
||||
<Compile Include="$(CommonPath)\System\Net\HttpVersionInternal.cs">
|
||||
<Link>Common\System\Net\HttpVersionInternal.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="$(CommonPath)\System\Net\Logging\NetEventSource.Common.cs">
|
||||
<Link>Common\System\Net\Logging\NetEventSource.Common.cs</Link>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System.Buffers" />
|
||||
|
@ -5,11 +5,13 @@
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<CompileItem Include="$(CommonPath)\Interop\Windows\Interop.Libraries.cs" />
|
||||
<CompileItem Include="$(CommonPath)\Interop\Windows\Crypt32\Interop.CertEnumCertificatesInStore.cs" />
|
||||
<CompileItem Include="$(CommonPath)\Interop\Windows\Crypt32\Interop.certificates_types.cs" />
|
||||
<CompileItem Include="$(CommonPath)\Interop\Windows\Crypt32\Interop.certificates.cs" />
|
||||
<CompileItem Include="$(CommonPath)\Interop\Windows\kernel32\Interop.FormatMessage.cs" />
|
||||
<CompileItem Include="$(CommonPath)\Interop\Windows\kernel32\Interop.GetModuleHandle.cs" />
|
||||
<CompileItem Include="$(CommonPath)\Interop\Windows\Interop.HRESULT_FROM_WIN32.cs" />
|
||||
<CompileItem Include="$(CommonPath)\Interop\Windows\SChannel\UnmanagedCertificateContext.IntPtr.cs" />
|
||||
<CompileItem Include="$(CommonPath)\Interop\Windows\winhttp\Interop.SafeWinHttpHandle.cs" />
|
||||
<CompileItem Include="$(CommonPath)\Interop\Windows\winhttp\Interop.winhttp_types.cs" />
|
||||
<CompileItem Include="$(CommonPath)\Interop\Windows\winhttp\Interop.winhttp.cs" />
|
||||
@ -17,8 +19,8 @@
|
||||
<CompileItem Include="$(CommonPath)\System\StringExtensions.cs" />
|
||||
<CompileItem Include="$(CommonPath)\System\Net\HttpKnownHeaderNames.cs" />
|
||||
<CompileItem Include="$(CommonPath)\System\Net\HttpKnownHeaderNames.TryGetHeaderName.cs" />
|
||||
<CompileItem Include="$(CommonPath)\System\Net\UriScheme.cs" />
|
||||
<CompileItem Include="$(CommonPath)\System\Net\SecurityProtocol.cs" />
|
||||
<CompileItem Include="$(CommonPath)\System\Net\UriScheme.cs" />
|
||||
<CompileItem Include="$(CommonPath)\System\Net\Http\HttpHandlerDefaults.cs" />
|
||||
<CompileItem Include="$(CommonPath)\System\Net\Http\NoWriteNoSeekStreamContent.cs" />
|
||||
<CompileItem Include="$(CommonPath)\System\Net\Http\WinHttpException.cs" />
|
||||
|
@ -16,6 +16,7 @@ namespace System.Net.Http
|
||||
// TODO: Issue #2165. Merge with similar code used in System.Net.Security move to Common/src//System/Net.
|
||||
public static void BuildChain(
|
||||
X509Certificate2 certificate,
|
||||
X509Certificate2Collection remoteCertificateStore,
|
||||
string hostName,
|
||||
bool checkCertificateRevocationList,
|
||||
out X509Chain chain,
|
||||
@ -32,6 +33,19 @@ namespace System.Net.Http
|
||||
// Authenticate the remote party: (e.g. when operating in client mode, authenticate the server).
|
||||
chain.ChainPolicy.ApplicationPolicy.Add(s_serverAuthOid);
|
||||
|
||||
if (remoteCertificateStore.Count > 0)
|
||||
{
|
||||
if (WinHttpTraceHelper.IsTraceEnabled())
|
||||
{
|
||||
foreach (X509Certificate cert in remoteCertificateStore)
|
||||
{
|
||||
WinHttpTraceHelper.Trace("WinHttpCertificateHelper.BuildChain: adding cert to ExtraStore: {0}", cert.Subject);
|
||||
}
|
||||
}
|
||||
|
||||
chain.ChainPolicy.ExtraStore.AddRange(remoteCertificateStore);
|
||||
}
|
||||
|
||||
if (!chain.Build(certificate))
|
||||
{
|
||||
sslPolicyErrors |= SslPolicyErrors.RemoteCertificateChainErrors;
|
||||
|
@ -258,7 +258,11 @@ namespace System.Net.Http
|
||||
|
||||
throw WinHttpException.CreateExceptionUsingError(lastError);
|
||||
}
|
||||
|
||||
|
||||
// Get any additional certificates sent from the remote server during the TLS/SSL handshake.
|
||||
X509Certificate2Collection remoteCertificateStore =
|
||||
UnmanagedCertificateContext.GetRemoteCertificatesFromStoreContext(certHandle);
|
||||
|
||||
// Create a managed wrapper around the certificate handle. Since this results in duplicating
|
||||
// the handle, we will close the original handle after creating the wrapper.
|
||||
var serverCertificate = new X509Certificate2(certHandle);
|
||||
@ -266,26 +270,28 @@ namespace System.Net.Http
|
||||
|
||||
X509Chain chain = null;
|
||||
SslPolicyErrors sslPolicyErrors;
|
||||
bool result = false;
|
||||
|
||||
try
|
||||
{
|
||||
WinHttpCertificateHelper.BuildChain(
|
||||
serverCertificate,
|
||||
remoteCertificateStore,
|
||||
state.RequestMessage.RequestUri.Host,
|
||||
state.CheckCertificateRevocationList,
|
||||
out chain,
|
||||
out sslPolicyErrors);
|
||||
|
||||
bool result = state.ServerCertificateValidationCallback(
|
||||
result = state.ServerCertificateValidationCallback(
|
||||
state.RequestMessage,
|
||||
serverCertificate,
|
||||
chain,
|
||||
sslPolicyErrors);
|
||||
if (!result)
|
||||
{
|
||||
throw WinHttpException.CreateExceptionUsingError(
|
||||
(int)Interop.WinHttp.ERROR_WINHTTP_SECURE_FAILURE);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw WinHttpException.CreateExceptionUsingError(
|
||||
(int)Interop.WinHttp.ERROR_WINHTTP_SECURE_FAILURE, ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -296,6 +302,12 @@ namespace System.Net.Http
|
||||
|
||||
serverCertificate.Dispose();
|
||||
}
|
||||
|
||||
if (!result)
|
||||
{
|
||||
throw WinHttpException.CreateExceptionUsingError(
|
||||
(int)Interop.WinHttp.ERROR_WINHTTP_SECURE_FAILURE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -111,14 +111,16 @@ namespace System.Net.Http.WinHttpHandlerFunctional.Tests
|
||||
|
||||
[OuterLoop] // TODO: Issue #11345
|
||||
[Fact]
|
||||
public async Task UseCallback_CallbackThrowsSpecificException_ThrowsInnerSpecificException()
|
||||
public async Task UseCallback_CallbackThrowsSpecificException_SpecificExceptionPropagatesAsBaseException()
|
||||
{
|
||||
var handler = new WinHttpHandler();
|
||||
handler.ServerCertificateValidationCallback = CustomServerCertificateValidationCallback;
|
||||
using (var client = new HttpClient(handler))
|
||||
{
|
||||
_validationCallbackHistory.ThrowException = true;
|
||||
await Assert.ThrowsAsync<CustomException>(() => client.GetAsync(System.Net.Test.Common.Configuration.Http.SecureRemoteEchoServer));
|
||||
HttpRequestException ex = await Assert.ThrowsAsync<HttpRequestException>(() =>
|
||||
client.GetAsync(System.Net.Test.Common.Configuration.Http.SecureRemoteEchoServer));
|
||||
Assert.True(ex.GetBaseException() is CustomException);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,12 +19,18 @@
|
||||
<Compile Include="$(CommonPath)\Interop\Windows\Interop.Libraries.cs">
|
||||
<Link>Common\Interop\Windows\Interop.Libraries.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="$(CommonPath)\Interop\Windows\Crypt32\Interop.CertEnumCertificatesInStore.cs">
|
||||
<Link>Common\Interop\Windows\Crypt32\Interop.CertEnumCertificatesInStore.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="$(CommonPath)\Interop\Windows\Crypt32\Interop.certificates_types.cs">
|
||||
<Link>Common\Interop\Windows\Crypt32\Interop.certificates_types.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="$(CommonPath)\Interop\Windows\Interop.HRESULT_FROM_WIN32.cs">
|
||||
<Link>Common\Interop\Windows\Interop.HRESULT_FROM_WIN32.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="$(CommonPath)\Interop\Windows\SChannel\UnmanagedCertificateContext.IntPtr.cs">
|
||||
<Link>Common\Interop\Windows\SChannel\UnmanagedCertificateContext.IntPtr.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="$(CommonPath)\Interop\Windows\winhttp\Interop.SafeWinHttpHandle.cs">
|
||||
<Link>Common\Interop\Windows\winhttp\Interop.SafeWinHttpHandle.cs</Link>
|
||||
</Compile>
|
||||
@ -52,6 +58,9 @@
|
||||
<Compile Include="$(CommonPath)\System\Net\HttpVersionInternal.cs">
|
||||
<Link>Common\System\Net\HttpVersionInternal.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="$(CommonPath)\System\Net\Logging\NetEventSource.Common.cs">
|
||||
<Link>Common\System\Net\Logging\NetEventSource.Common.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="$(CommonPath)\System\Net\UriScheme.cs">
|
||||
<Link>Common\System\Net\UriScheme.cs</Link>
|
||||
</Compile>
|
||||
|
Reference in New Issue
Block a user