Commit Graph
24 Commits
Author SHA1 Message Date
Stephen Toub 89dfde815e Expose SocketsHttpHandler
- Renames ManagedHandler to SocketsHttpHandler
- Moves a bunch of files around accordingly
- Updates System.Net.WebSockets.Client to use SocketsHttpHandler directly
- Updates System.Net.Http's tests with a reflection-based rather than TLS-based method for instantiating an HttpClientHandler backed by a SocketsHttpHandler.


Commit migrated from https://github.com/dotnet/corefx/commit/852d40e723c849e8d0c486676d40332343e12ca5
2018-02-08 19:12:50 -05:00
Stephen Toub 7be9b5bb5f Switch tests to use thread-local switch for ManagedHandler
And as a result re-enable parallelism of the test suite, which on my machine reduces the running time of the outerloop tests from 150s to 45s.


Commit migrated from https://github.com/dotnet/corefx/commit/3db504ec31fb03162b33e0658870aef5af4e4abe
2017-09-21 08:26:44 -04:00
Stephen Toub 50805a924a Update TODOs with issue numbers
Commit migrated from https://github.com/dotnet/corefx/commit/924d34b8a04eb1bc0f005848d784d7d414d0d4d3
2017-08-11 15:34:57 -04:00
David Shulman 113a821137 Fix HttpClientHandler UAP to use a filtered set of client certs (dotnet/corefx#22075)
* 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
2017-07-11 16:39:00 -07:00
David Shulman 823f81b56e Implement client certificates for HttpClient on UAP (dotnet/corefx#22022)
* 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.

Fixes dotnet/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
2017-07-10 16:52:07 -07:00
Stephen Toub fd63714f4a Re-enable ManagedHandler_HttpClientHandler_ClientCertificates_Test and ManagedHandler_HttpClientHandler_ServerCertificates_Test
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
2017-07-05 12:43:12 -04:00
Santiago Fernandez Madero c65dd7a4bd Test attributes cleanup for Uap now that Uap flag includes UapAot (dotnet/corefx#20108)
* Update xunit extensions to unify TargetFrameworkMonikers.Uap to include UapAot

Commit migrated from https://github.com/dotnet/corefx/commit/652d12bf31606eeef8fe8b9a7bf1cc7af06f6352
2017-05-22 15:10:24 -07:00
David Shulman d899bda510 Disable System.Net.Http tests on UAP/UAPAOT (dotnet/corefx#20017)
Disable a bunch of System.Net.Http tests on UAP/UAPAOT platform.

Both inner and outer loop tests now run clean for System.Net.Http

Commit migrated from https://github.com/dotnet/corefx/commit/38cd7f91dbbc5ac4001bf15762a8e244f5ec3a70
2017-05-19 14:28:54 -07:00
Daniel Harvey 252cdc5e95 Bulk updates of tests for AssertExtensions (dotnet/corefx#18491)
Bulk update to AssertExtensions.Throws for AOT support. This doesn't disable Assert.Throws.

Commit migrated from https://github.com/dotnet/corefx/commit/b43b4df2e0e2182154bb0f425cb4a61bc1269828
2017-04-18 09:52:02 -07:00
Caesar Chen b6892a28ed change the test label and add string to the resource file of WinHttpHandler to correct build error
Commit migrated from https://github.com/dotnet/corefx/commit/f57d3f2b4ee02c1e7cdc0a7d649eeda7d7a680d4
2017-03-16 14:48:58 -07:00
Caesar Chen eb24955a77 fix the HttpClientHandler.ClientCertificates behaviour when ClientCertificateOption.Automatic is set
Commit migrated from https://github.com/dotnet/corefx/commit/72322773ec42b011622e8162acfdff4ecc3beb0c
2017-03-16 13:21:12 -07:00
Jeremy Barton b978bc6f2c Merge remote-tracking branch 'dotnet/master' into master_to_applecrypto
Conflicts:
	netci.groovy
	src/System.Net.Security/src/System/Net/Security/SecureChannel.cs
	src/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Unix/OpenSslX509Encoder.cs
	src/System.Security.Cryptography.X509Certificates/src/Resources/Strings.resx
	src/System.Security.Cryptography.X509Certificates/tests/Cert.cs
	src/System.Security.Cryptography.X509Certificates/tests/CollectionImportTests.cs
	src/System.Security.Cryptography.X509Certificates/tests/CollectionTests.cs
	src/System.Security.Cryptography.X509Certificates/tests/PfxTests.cs
	src/System.Security.Cryptography.X509Certificates/tests/X509StoreTests.cs


Commit migrated from https://github.com/dotnet/corefx/commit/5d7aec3e00afd35d0211b50c0630a1614a548726
2017-03-10 17:44:40 -08:00
Jeremy Barton 74fbe34b84 Initial implementation of X509Certificates, HttpClient, and SslStream for macOS (dotnet/corefx#16445)
Broken by this change:
* A lot of TLS CipherSuites have no metadata defined.
* macOS does not support version skipping in TLS.  So `Tls | Tls12` is an invalid choice.

In this change:
General:
* All OSStatus related exceptions now look up the error message.

X509Certificates:
* X509Certificate moves to using SecCertificateRef from OpenSSL's X509.
* X509 metadata comes from a managed reader after being loaded by Security.framework,
due to the significant amount of data that has no public export in Apple's libraries.
* Significant code was factored out to be shared by OpenSSL and Apple implementations for X500DistinguishedName and X509Certficate2Collection.Find.
* Loading a PFX (or, rather, the private keys from a PFX) via Apple's platform
requires importing into a Keychain, and a Keychain requires a file on disk.
A temporary keychain is created during cert loading and erased when safe.
Like the perphemeral key load on Windows this can leak files due to
abnormal program termination.
* The X.509 My store for CurrentUser and LocalMachine are the default (user) and System keychains.
* The X.509 Root store is an interpretation of the Apple SecTrustSettings data.
* The X.509 Disallowed store hasn't been implemented yet, but should be a very small change.
* Other X.509 stores cannot be created due to keychain complexity.

HttpClient:
* Initialization no longer wakes up OpenSSL

SslStream:
* New implementation based on Apple SecureTransport.
* Currently has support for SNI (for AuthenticateAsClient)


Commit migrated from https://github.com/dotnet/corefx/commit/3b19899963606a34e1623e0926b90fe907197ee6
2017-03-01 14:45:41 -08:00
Steve Harter 4fc05a19f5 Improve CI: change Http test ActiveIssue(Windows) to (Any) (dotnet/corefx#16368)
Commit migrated from https://github.com/dotnet/corefx/commit/8bf03424d20922170572803fa3f3c17671e4d197
2017-02-21 18:24:25 -06:00
Steve Harter be18ea33cc Disable network test that is failing regularly (dotnet/corefx#16167)
Commit migrated from https://github.com/dotnet/corefx/commit/7df0cd05c67c28f869a997dfc4423813c2bd9f2a
2017-02-14 16:58:24 -08:00
Lakshmi Priya Sekar 6bff1b3000 Fix networking test activeissues in System.Net.Http
Commit migrated from https://github.com/dotnet/corefx/commit/dd65f89ef9806067779eb63b884d9317dad68202
2017-02-03 12:31:59 -08:00
Eric St. John f6f23740a5 Update Http tests to target ns1.7 + ns1.3
I had to add a namespace alias due to System.Configuration now being
defined by System.Runtime.


Commit migrated from https://github.com/dotnet/corefx/commit/6e86da5cc3efb88db6b932f01c9a4f9e66e84f8c
2016-10-20 14:31:18 -07:00
Justin Van Patten aa68f5ce2f Replace uses of Xunit.PlatformID with renamed TestPlatforms
Replace uses of `Xunit.PlatformID` with renamed `TestPlatforms` because
the old name conflicts with `System.PlatformID` and should be plural
according to the design guidelines for flags enums.


Commit migrated from https://github.com/dotnet/corefx/commit/5179dda7331b1e201519adf76ce9ae69ffe2a0f6
2016-10-01 17:18:41 -07:00
David Shulman 935520c1dc Disable most networking tests for default CI runs
Lately, the CI system and test server infrastructure has been overloaded with many PRs. This is causing many networking tests to randomly fail due to resource exhaustion caused by so many simultaneous PR runs on the same CI machines. This occurrs not only when using an external test server endpoint (corefx-net.cloudapp.net) but also loopback servers.

To improve engineering efficiency for the team, we are moving most of the tests in the networking libraries from the default CI runs (innerloop). For developers working on networking libraries, the networking tests can be run by invoking the "outerloop" tests.

We will not be allowing any merges of PRs in the networking libraries unless the outerloop tests are also run by the developer.

This affects tests in the following libraries right now:

* System.Net.Http
* System.Net.Http.WinHttpHandler
* System.Net.Sockets
* System.Net.Security
* System.Net.WebSockets.Client

I will be working on fine tuning these exclusions (issue dotnet/corefx#11345) to try to bring back tests into the innerloop runs when we have begun to address the infrastructure issues.


Commit migrated from https://github.com/dotnet/corefx/commit/defbb8afd11b317f6b5cc2f4422a03d701b6dba3
2016-09-01 11:23:40 -07:00
David Shulman 9449dda9a7 Enhance LoopbackServer to return received data
Modified the test LoopbackServer so that it can return the received data in the helper methods. This allows more use of the
simple ReadRequestAndSendResponseAsync() method instead of having to use the more complex methods.

Modified a few HttpClient tests to take advantage of this. More tests will be simplified in future PRs.


Commit migrated from https://github.com/dotnet/corefx/commit/14c8ddd89be1fac31a472efdcaee184ba9d62e58
2016-08-26 12:11:43 -07:00
Cristian Pop 7a3d76b180 Adding multi-machine scripts and unifying configuration.
Commit migrated from https://github.com/dotnet/corefx/commit/c354b2d44f6988a20a9f7be4a1b996ef7fbc873a
2016-06-28 12:38:07 -07:00
Stephen Toub def7b43d50 Mark another ActiveIssue
Commit migrated from https://github.com/dotnet/corefx/commit/daa30fcf33d57203456ed6c0ce8c42650074d5db
2016-06-20 14:48:11 -04:00
Stephen Toub 5a23884046 Tweak HTTP client certificates test and add ActiveIssue
With forced GC/finalization at the right moment, the test currently fails on Windows.


Commit migrated from https://github.com/dotnet/corefx/commit/4cdb8dc1ba73ef02ef719b9a0ee336dbefca3b10
2016-06-20 08:37:30 -04:00
Stephen Toub ea6cd05418 Add some HttpClientHandler client certificate tests
And fix a small bug discovered from this, lack of argument validation when setting the enum value.


Commit migrated from https://github.com/dotnet/corefx/commit/483aa5a3012fe78ea001ece1b0404b18c0b90a29
2016-06-03 13:09:23 -04:00