Commit Graph
51 Commits
Author SHA1 Message Date
Geoff Kizer d33615e499 rename HttpClientTestBase to HttpClientHandlerTestBase
Commit migrated from https://github.com/dotnet/corefx/commit/b26e2a66e5c41c3263caf5fdaa8a1811dd360e33
2019-01-09 02:44:04 -08:00
Jeremy Barton cefe07725e Add initial support for TLS 1.3 to .NET Core
* TLS 1.3 connections have been tested on Ubuntu 18.10 (OpenSSL 1.1.1).
* There's no public version of Windows with TLS 1.3 enabled.
* There's no public version of macOS with TLS 1.3 enabled out of the box.

When making use of SslProtocols.None (system default) TLS 1.3 is already working on Ubuntu 18.10, this change mainly makes it so that EncryptionPolicy.None is better handled, and that we can restrict-to and report TLS 1.3.

Commit migrated from https://github.com/dotnet/corefx/commit/d30157d9e48cf73e267994e45953722d18ccd4c6
2018-11-12 17:49:05 -08:00
David Shulman 698cedb4c0 Fix HttpClient TLS tests (dotnet/corefx#29851)
Native WinHTTP sometimes uses multiple TCP connections to try other TLS protocols when
getting TLS protocol failures as part of its TLS fallback algorithm. The loopback server
doesn't expect this and stops listening for more connections. This causes unexpected test failures.

I confirmed this investigation comparing with a non-loopback server and WireShark traces. I discussed
this with the WinHTTP team.

SocketsHttpHandler, which uses SslStream for TLS, is able to optimize this and looks directly at
the TLS server-hello to determine if the connection is going to be compatible with the allowed client
TLS protocols. So, it doesn't use multiple TCP connections to determine a final failure outcome.

I also cleaned up the test code removing duplicate tests.

Fixes dotnet/corefx#8538

Commit migrated from https://github.com/dotnet/corefx/commit/226b225df8873b5c7a79d027119871834b24a7d4
2018-05-22 12:37:49 -07:00
Max Kerr 7a12691e93 Disable SSL3 test case on RedHat 6 (dotnet/corefx#28998)
Commit migrated from https://github.com/dotnet/corefx/commit/5411a5c72920e1fac7e6315aad0ec302de0d1c55
2018-04-12 09:07:37 -07:00
Stephen Toub 6c551076f0 Make default SocketsHttpHandler SslProtocols include Tls11/12 on Win7/2008R2 (dotnet/corefx#28788)
Windows 7 and Windows 2008 R2 support TLS 1.1 and 1.2, but for legacy reasons by default those protocols are not enabled when a developer elects to use the system default.  However, in .NET Core 2.0 and earlier, HttpClientHandler would enable them, due to being a wrapper for WinHTTP, which enabled them.  Both for compatibility and because we prefer those higher protocols whenever possible, SocketsHttpHandler also pretends they're part of the default when running on Win7/2008R2.

Commit migrated from https://github.com/dotnet/corefx/commit/0c7a1de0448c9dee76723d0bedd90f76c3436662
2018-04-04 09:59:09 -07:00
Stephen Toub 40573ec3da Disable frequently failing GetAsync_SupportedSSLVersion_Succeeds test
Commit migrated from https://github.com/dotnet/corefx/commit/031e40a64bd7a148f43e5a49055abbf5743b4543
2018-03-31 01:01:45 -04:00
Stephen Toub fd20c03b0c Stop blocking explicit opt-in to Ssl2/3 in SslStream and HttpClient (dotnet/corefx#28639)
By default, .NET Core defaults to allowing TLSv1, TLSv1.1, and TLSv1.2.  However, whereas .NET Framework allows a developer to opt-in to SSLv2/SSLv3, .NET Core currently blocks it.  This means developers are unable to use .NET Core when they need to communicate with an endpoint they don't control and that's unfortunately limited to one of these protocols, which blocks adoption of .NET Core.

This commit stops blocking these protocols.  They're still disabled by default, and compiling against them still results in a deprecation warning, but if a developer chooses to ignore the warning and explicitly sets SslProtocols, they are at least able to use the protocols, subject to whatever the underlying operating system allows (e.g. Windows stops supporting SSLv2 as of v1607).

Commit migrated from https://github.com/dotnet/corefx/commit/3cc6fda0c6abe76eea222c165ebdf816e83df564
2018-03-30 22:00:37 -07:00
Caesar Chen 9df60dc56a Make SocketsHttpHandler default Handler (dotnet/corefx#27821)
* set SocketsHttpHandler to default

* address feedback

* fix if check for 28002


Commit migrated from https://github.com/dotnet/corefx/commit/2b850f6fe5fd3171c2554da965cb07070e1d648e
2018-03-14 00:34:56 -04:00
Tomas Weinfurt c43d267d92 be more liberal on what exception type to get on handshake failure (dotnet/corefx#27352)
* be more liberal on what exception type to get on handshake failure
* refactor test code to address feedback from review
* move "catch XX" to separate line


Commit migrated from https://github.com/dotnet/corefx/commit/517238c264741d99a28c60178da9d65bac3d3fe5
2018-02-23 10:20:28 -08:00
Tomas Weinfurt 5d8c6a618a disable two tests on ubuntu 18 while investigating root casue (dotnet/corefx#27144)
Commit migrated from https://github.com/dotnet/corefx/commit/d00eb7ec42434b0a7e2c3b4f6cd88c896ebaa30f
2018-02-15 05:47:50 -05:00
Geoff Kizer bf6635fcfd add response generation overloads
Commit migrated from https://github.com/dotnet/corefx/commit/6943fc7c0e92359e6335a618f6ff5ee8402af4ac
2018-02-13 16:04:26 -08:00
Geoff Kizer b94eefba0f reorganize and cleanup some LoopbackServer code
Commit migrated from https://github.com/dotnet/corefx/commit/ec6a7215bb28a061d2357d8c3874447bc575132d
2018-02-13 15:43:59 -08:00
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
Paulo Janotti 99eb957292 Proper check for OpenSSL version in System.Net.Http.Tests (dotnet/corefx#26873)
Disable the tests affected by dotnet/corefx#26803 in the correct way so tests are skipped only when needed.

Commit migrated from https://github.com/dotnet/corefx/commit/cd26075ef0d371e222ab52a1322ea9a73f07ad72
2018-02-05 21:43:37 -08:00
Paulo Janotti bfd647ca5e Disable Net.Http tests failing in Fedora.27 (dotnet/corefx#26835)
* Disable Net.Http tests failing in Fedora.27 (dotnet/corefx#26803)

* Adding comments for when tracking issue is fixed.


Commit migrated from https://github.com/dotnet/corefx/commit/e9be24d1913af98a671734267c212597fecfea70
2018-02-04 19:45:40 -08:00
Tomas Weinfurt d7d3bdd9b7 disable failing tests (dotnet/corefx#26197)
* disable failing tests

* add missing newline


Commit migrated from https://github.com/dotnet/corefx/commit/1efbd8e15fa6747215511cd492aa5a5f9c7e315d
2018-01-05 16:43:40 -08:00
Geoff Kizer 00e680fa3a reenable ssl tests
Commit migrated from https://github.com/dotnet/corefx/commit/085e8d014a0eb5f470bc9748d16f24d86590e9d5
2018-01-03 13:13:44 -08:00
Lakshmi Priya Sekar 3b52529fa4 Respond to pr feedback.
Commit migrated from https://github.com/dotnet/corefx/commit/c9a8b39eb6d78694b715b1d69f9b16409402490f
2017-12-14 15:08:43 -08:00
Lakshmi Priya Sekar 6ca6529323 Use generic test handling for remote server failures.
Commit migrated from https://github.com/dotnet/corefx/commit/d37b86ecf8606f007b32c9d60f623f50c874c723
2017-12-13 17:01:30 -08:00
Krzysztof Wicher f3f741eade Use distro detection from Microsoft.DotNet.PlatformAbstractions (dotnet/corefx#24531)
Commit migrated from https://github.com/dotnet/corefx/commit/4bf90198c5e7710ea67b7c1b467e859ec8bb78e5
2017-11-03 14:30:47 -07: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
Stephen Toub ac9303e990 Disable GetAsync_UnsupportedSSLVersion_Throws test on Linux
Commit migrated from https://github.com/dotnet/corefx/commit/0b3134f7b9a2b2be73dcbfa0deca7a8da24d6621
2017-07-09 00:50:15 -04:00
Stephen Toub e4e0f8e85d Disable ManagedHandler negative test failing on older Windows 10 builds (dotnet/corefx#22002)
Commit migrated from https://github.com/dotnet/corefx/commit/99aa82499ef8fe11e6049a6ba2a636eb8780a520
2017-07-08 00:55:57 -04:00
David Shulman 65782675d6 Fix some TLS related HttpClientHandler properties for UAP (dotnet/corefx#21630)
Due to platform differences on UAP and the current use of WinRT APIs to
implement that HTTP stack, a few properties won't have the same defaults
or behavior.

CheckCertificateRevocationList default value is true for UAP and can't
be changed. However, on UAP, revocation checking that results in an
indeterminate status (i.e. revocation server offline) is treated the
same as a valid result. This is the behavior of the underlying WinRT
APIs.

SslProtocols default value is SslProtocols.None which is the same as the
rest of .NET Core. 'None' means to use the system default. However, changes
to this property value will be ignored.

Similar to the decision made in PR dotnet/corefx#21403, we don't throw PNSE for these
differences. Instead we just no-op on the property setter.

The behavior differences will be documented in:
https://github.com/dotnet/corefx/wiki/ApiCompat

Contributes to dotnet/corefx#18116.

Commit migrated from https://github.com/dotnet/corefx/commit/711f785f072c8131b9d49792eeab02d2d55be662
2017-06-27 14:34:03 -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
Alex Perovich 72abd52557 Fix S.Net.Http.Functional.Tests on AoT (dotnet/corefx#19133)
* Fix S.Net.Http.Functional.Tests on AoT

* Use partial files

* Use braces


Commit migrated from https://github.com/dotnet/corefx/commit/f8f72de4a453151ee38322166ffec0000ee3a7c6
2017-05-02 06:49:19 -04:00
David Shulman 75d4e8ad18 Fixes for running Http tests against Desktop
Got the Http Functional tests running with no errors against NETFX (Desktop). Found a bunch
of compatibility differences between Desktop and Core that need to be investigated. For now,
the tests are skipped on Desktop.

Fixed the LoopbackServer so that it will run. It was blowing up with `MissingTypeException`
due to missing SocketTaskExtensions class (dotnet/corefx#17690).

Contributes to dotnet/corefx#17691


Commit migrated from https://github.com/dotnet/corefx/commit/b7f6f5f159ebe6c0597578bbd858697a6159a22f
2017-04-01 09:28:32 -07:00
Lakshmi Priya Sekar 194dfd28d3 Respond to PR feedback.
Commit migrated from https://github.com/dotnet/corefx/commit/3ac884af42aac1bc5152f4b2ca0c0a8604a92d98
2017-01-23 13:36:54 -08:00
Lakshmi Priya Sekar d82c7740f6 Fix centos test failures in outerloop.
Commit migrated from https://github.com/dotnet/corefx/commit/76e105181d5e5dc2d1f12b5e5b378a572809a000
2017-01-20 18:54:56 -08:00
Stephen Toub 27e985cfa3 Replace "readonly static" with "static readonly"
There are ~4000 occurrences in corefx of "static readonly".  There are ~200 occurrences of corefx of "readonly static".  Replacing all of the straggler "readonly static" cases with "static readonly" to make things consistent.


Commit migrated from https://github.com/dotnet/corefx/commit/d9d1e815ad6c642cf5d61afa4a16726548598bb2
2016-12-09 10:27:00 -05:00
Stephen Toub 42aff03523 Disable SSLv3 default test on older libcurls
libcurl prior to v7.39 allows SSLv3 by default.  Since we've switched our defaults to accepting whatever the platform defaults are, this commit disables our SSLv3-disabled-by-default test on libcurl versions earlier than 7.39.


Commit migrated from https://github.com/dotnet/corefx/commit/460503134b4995c997b46f2439f6704eb1951f1c
2016-11-18 08:06:14 -05:00
Stephen Toub 45df74c422 Re-disable re-enabled HTTP tests that are still failing
Commit migrated from https://github.com/dotnet/corefx/commit/ccbc93652ad7570e3b7262ede4ae4cbb17bbc592
2016-10-28 09:01:13 -04:00
Alex Ghiondea 81e93c452c Re-enable tests for issues that have already been resolved.
Commit migrated from https://github.com/dotnet/corefx/commit/51394d7ca62027468d488b25a4ab87f4a12dc5ba
2016-10-26 15:00:58 -07: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 f9fc17df13 Remove innerloop dependencies on www.ssllabs.com
We have several innerloop tests that make HTTP calls during System.Net.Http.Functional.Tests out to www.ssllabs.com, which has SSL endpoints for different SSL protocols.  This commit avoids using that server during innerloop tests.  The tests are moved to outerloop, and some replacements using a localhost are added to innerloop.


Commit migrated from https://github.com/dotnet/corefx/commit/8a9402b33d46166d1a3129a7c2cae0334b00c4b6
2016-05-31 17:05:10 -04:00
bartonjs e2af1bb6c4 Clear the libcrypto error queue before doing SSL/TLS operations.
If an SSL operation fails, we call SSL_get_error to determine how to proceed.
SSL_get_error's logic is, essentially
  libcrypto_error ?? WANT_READ ?? WANT_WRITE ?? WANT_X509 ?? panic

This means that if a previous call into libcrypto on the same thread had left
something in the error queue when the operation goes into the WANT_READ state (etc)
SSL_get_error will report that the request must have failed due to something in
libcrypto.

There are two different fixes being done here:
1) PKCS12_parse is a known contributor to this problem, clear out the queue on a
successful exit.
2) Before any SSL stream operation (handshake, read, write, shutdown) clear the
queue, in case there are other functions which are leaving dangling errors.

With those mitigations in place, the intermittent errors seen during SslStream
usage should hopefully be a thing of the past.


Commit migrated from https://github.com/dotnet/corefx/commit/80a53ed415ece115d15bcf519e81e600362fd3dc
2016-05-17 09:09:53 -07:00
David Shulman c04a0f68e8 Change some System.Net.Requests tests to use LoopbackServer
Changed HttpWebResponse test to use LoopbackServer.

More tests will be changed to use this server as part of
increasing test reliability and simplifying the requirements for the Azure test server.


Commit migrated from https://github.com/dotnet/corefx/commit/3aaaf19bd94bfcac533787ed45e1c3218168b7fa
2016-05-15 20:58:50 -07:00
stephentoub f44781c5fd Add test verifying HttpClient negotiates Tls12 when None specified
Commit migrated from https://github.com/dotnet/corefx/commit/22e060a3d7735a2b64bf4f409bee91d675866d39
2016-05-15 16:31:36 -04:00
David Shulman 354c2e5b9c System.Net.Http 4.1 contract implementation
As per approved dotnet/corefx#7623, add remaining properties to HttpClientHandler for
all platforms.

Move pre-existing Unix-only Http tests to run for all platforms.

Ensure that "credentials" related properties are secure by default and have
an initial (default) value of null.


Commit migrated from https://github.com/dotnet/corefx/commit/361b66146506a58f7d2c27224cc02f9583cd0639
2016-05-14 17:07:27 -07:00
stephentoub c43ac8a969 Change CurlHandler.SslProtocols default
Same change as https://github.com/dotnet/corefx/pull/8518, but for CurlHandler.


Commit migrated from https://github.com/dotnet/corefx/commit/3b8756c8b966f93afbe01f24e50794587ef465c9
2016-05-13 19:55:32 -04:00
stephentoub 31eddcd4ce Add HttpClient test with IPv6 Uris
Adds support to the loopback server for binding to IPv6 local addresses, then adds a test that uses both ::1 and a link-local address for the current machine.


Commit migrated from https://github.com/dotnet/corefx/commit/a00e71b22fecbf9e2da3205e2e56bdb46773cbc2
2016-05-12 06:11:28 -04:00
stephentoub ac19b4db8b Disable two recently added tests
These were both added in the last few days and have both failed in CI at least once.


Commit migrated from https://github.com/dotnet/corefx/commit/e3f64a9c8f3869f3db1bdc7bac496e56b89334a6
2016-05-10 22:55:55 -04:00
stephentoub b8970ee51b Add SSL support to LoopbackServer in HTTP tests
We currently make a lot of calls off-box in our unit tests.  By adding SSL support to the loopback server, we should be able to convert many more tests to avoid needing to actually hit the network.  This adds such basic support, and converts a few tests to use it.

Also, since I was moving the certificate configuration code to a central location, I fixed an issue related to cleanup.


Commit migrated from https://github.com/dotnet/corefx/commit/b90795e1d5d7e8d8c68b9ca23d53b1ba0e392f46
2016-05-10 13:55:40 -04:00