ManagedHandler_HttpClientHandler_ConnectionPooling_Test didn't assert
IDisposable (though did have a Dispose method), so it didn't clear the
environment variable that says to use the prototype managed handler in tests.
This means that any tests which should still be using the curl provider end up
using the managed provider until another managed test runs.
So now it's disposable, and a failure we were expecting, but not seeing, on
macOS 10.13 is asserting itself again.
Commit migrated from https://github.com/dotnet/corefx/commit/3dac2dbf20a56e6b525e078e977bfeed3ae8de8a
LibreSSL needs locks initialized in order to be used safely from
multiple threads, which happens when multiple HttpClients are used. But
we don't currently have a good way to perform that initialization as we
do for OpenSSL. As a workaround, add a shared MultiAgent that's
initialized when LibreSSL is used on macOS, and use that same MultiAgent
from all CurlHandler instances rather than giving each their own. Since
MultiAgent is 1:1 with a thread, all HttpClient's will then end up
sharing the same libcurl event loop thread, and we'll serialize all of
our interactions with libcurl and thus hopefully with LibreSSL.
Commit migrated from https://github.com/dotnet/corefx/commit/a26de495ffa390a9d6b3a0d0f338e9d9f97ad5fe
* Reconcile behavior of MaxRequestContentBufferSize across .NET Core
The HttpClientHandler property, MaxRequestContentBufferSize, has been
deprecated. This PR reconciles the behavior of the getter and setter of
the property.
Similar to other decisions in HttpClient PRs with these kinds of
behavior differences, we are not going to throw PNSE. We will document
the differences in the AppCompat docs.
Fixesdotnet/corefx#7879
* Address PR feedback
Commit migrated from https://github.com/dotnet/corefx/commit/e740973fed660da4426218bf2ec4be35a60ad095
* Re-enable anf fix Http tests for UAP
* Removed ActiveIssue from a bunch of Http tests.
* Converted some ActiveIssue to SkipOnTargetFramework due to
platform differences.
* Change some tests to use RemoteInvoke to get process isolation
since UAP will cache connections per-process.
* Removed a duplicate ChannelBinding test. There is already the
same test in HttpClientHandlerTest.ServerCertificates.cs
(PostAsync_Post_ChannelBinding_ConfiguredCorrectly). And that
test checks more things.
Contributes to dotnet/corefx#20010
* Address PR feedback
Commit migrated from https://github.com/dotnet/corefx/commit/a3cd07a7b608358710ac073cbe41f65866aa929a
* Fix HttpClientHandler UAP to use a filtered set of client certs
My earlier PR dotnet/corefx#22022 refactored the GetEligibleClientCertificates code
into a Common method. However, I neglected to actually use it in the UAP
HttpClientHandler!
Fixed the handler to properly filter down the set of client
certificates.
Added new tests to verify functionality. While doing this, I discovered
that the tests need to run in an isolated process due to the per-process
caching behavior of the UAP HTTP stack.
So, I used the RemoteInvoke method. I had to duplicate some of the new
tests using Fact instead of using Theory. This is because the
RemoteInvoke doesn't allow non-string parameters and I had to pass
in X509Certificate2 objects. So, I separated out each variant into its
own Fact test.
* Address PR feedback
* Fix code refactoring to properly filter client certificates.
* Fix test names in nameof() blocks.
* Disable a test from using the managed handler.
* Address PR feedback
* Remove unneeded using statements.
* Disable managed handler in some SslProtocols tests.
Commit migrated from https://github.com/dotnet/corefx/commit/9c4af2973699aea35ce5c60c00f7dd14398e7a14
* Implement client certificates for HttpClient on UAP
Added code for HttpClientHandler.ClientCertificates on UAP.
Moved code duplicated in several places into a common helper class, CertificateHelper.
Then I discovered a bug introduced into GetEligibleCertificates (from PR dotnet/corefx#21908) that
doesn't properly filter by EKU or KeyUsage if there is only one cert (this was failing
the WinHttpHandler Unit tests). So, I removed that optimization.
Used the new Azure test endpoint for client certificates. I did not use the loopback
server because there is a problem using it with HttpClient in UAP. There is a crash
in the SslStream.AuthenticateAsServer that I was not able to diagnose yet. It will
require a lot of time debugging and I wanted to get this HttpClientHandler feature
done now. Tracking that investigation with dotnet/corefx#22021.
Fixesdotnet/corefx#21628
Contributes to dotnet/corefx#14542
* Address PR feedback
* Moved method to Windows-only Common file
* Fixed some line spacing
Other potential refactoring/optimizations will be looked into in dotnet/corefx#22045
Commit migrated from https://github.com/dotnet/corefx/commit/472b8d8ec212c2afb107dea305b4624c4989a79f
* Fix HttpClientHandler ServerCertificateCustomValidationCallback for UWP
This PR implements the ServerCertificateCustomValidationCallback for UWP. While implementing this, I discovered that the behavior of
the current .NET Core code is incorrect regarding how to propagate exceptions from the user provided callback. I opened up a new
issue dotnet/corefx#21904 and revised the test as well.
Fixesdotnet/corefx#21627
* Address more PR feedback
Commit migrated from https://github.com/dotnet/corefx/commit/e30fdc38e60f6fa2ed8e7e103d1f8c44655438cd
One test needed to be fixed to deal with the fact that currently the ManagedHandler doesn't throttle connections and can end up getting denied connection errors from the server when exceeding the listen backlog size employed.
Commit migrated from https://github.com/dotnet/corefx/commit/47ffa8b49cf3d04be888f4d1e1dc287cdcbbe5e5
The tests that verify PNSEs getting thrown were failing incorrectly when the managed handler was used on platforms like CentOS where our CI system has an old libcurl installed. For now, I've worked around it in a very manual fashion, but longer term we need a better way of using the same tests against multiple handlers substituted dynamically.
Commit migrated from https://github.com/dotnet/corefx/commit/fb2f2e8be64d6bf2c26030ef63d1e5cb004e8a64
* Prevent SslProvider exceptions from being thrown to native code
CurlHandler.SslProvider register the VerifyCertChain method to be invoked by OpenSSL in order to validate a cert chain. If the validation code throws an exception from certain places, e.g. in response to OpenSSL reporting unknown cipher suites, that exception is currently allowed to propagate out of the function back across the interop boundary, which is unsupported and results in bad behaviors. The fix is to widen the existing catch block to catch all such exceptions and marshal them to the associated request appropriately.
* Add X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY to MapVerifyErrorToChainStatus
* Address PR feedback
Commit migrated from https://github.com/dotnet/corefx/commit/c4df8bdc5b2720294b83f44acd6501a89a3b638b
The condition for these tests needs to be adjusted. The tests in question are verifying that a PNSE is thrown on platforms that don't have an OpenSSL backend, but that's irrelevant when using the managed handler, on which these tests actually successfully make connections rather than throwing.
Committing directly to unblock CI.
Commit migrated from https://github.com/dotnet/corefx/commit/4f9322825a9da4f47677b1413f0feabed3fd746b
One of the Windows-only tests is expecting SslStream's ChannelBinding's ToString() to output the data from the binding in a specific format, matching what WinHttp's outputs. This makes that happen. And enables more tests.
Commit migrated from https://github.com/dotnet/corefx/commit/0cd7eeabb6b91c44827592bd45f8312dcb961388
Since System.Net.Http APIs default to not using any cache, we need to
turn off caching at the WinRT layer. If supported, we set the
CacheControl.ReadBehavior to use the NoCache enum value. Otherwise,
we use the next best enum option.
Removed some unneeded try/catch handling when we previously
needed to handle compiling with older SDKs and trap JIT error.
This is no longer needed for NETStandard20.
Fixed some typos from a previous PR.
Fixesdotnet/corefx#7877
Commit migrated from https://github.com/dotnet/corefx/commit/1cf87a19d450040a0ad53c5f9580c5f5ddadd4e1