Commit Graph
93 Commits
Author SHA1 Message Date
Paulo Janotti b85ab9824d Add test to visit sites with SocketsHttpHandler (dotnet/corefx#28480)
Adds a small test to visit a list of sites using SocketsHttpHandler and allow easy debugging and comparison with platform handlers in case one needs to investigate. The tests are disabled by default and are controlled by Xunit traits.

Commit migrated from https://github.com/dotnet/corefx/commit/8e18a0e0453654ed88c3729ffad580dff984601a
2018-03-28 08:22:08 -07:00
Stephen Toub 78ca1d62b3 Add test for SocketsHttpHandler Brotli response (dotnet/corefx#28494)
SocketsHttpHandler doesn't currently automatically decode Brotli responses, but add tests to validate we can at least do so manually.

Commit migrated from https://github.com/dotnet/corefx/commit/175984f5c05de918effd97bf322fb002e0da925b
2018-03-27 07:20:08 -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 3a42fc41f9 Merge branch 'master' of https://github.com/dotnet/corefx into ssl_Proxy2
Commit migrated from https://github.com/dotnet/corefx/commit/f909b9f95f099a197e7bb04479b930f0e596dfb7
2018-02-22 15:36:16 -08:00
Geoff Kizer 6bdeebdc0c add response stream drain
Commit migrated from https://github.com/dotnet/corefx/commit/3abd27db07e592629b53bbaca26dd9c8c4411ff1
2018-02-20 21:25:11 -08:00
Lakshmi Priya Sekar 548687e68b Merge pull request dotnet/corefx#26979 from Priya91/newhttpauth
Add test infra for auth testing.

Commit migrated from https://github.com/dotnet/corefx/commit/ff123e89989b2b34e82c854ea597626d884d52ba
2018-02-20 11:06:08 -08:00
Tomas Weinfurt 0ee430e1cb take feedback from review
Commit migrated from https://github.com/dotnet/corefx/commit/adabd8d443f2f0150c5b1cbeb0868b404949c36a
2018-02-19 23:27:03 -08:00
Tomas Weinfurt 7a646e15b7 Merge branch 'master' of https://github.com/dotnet/corefx into ssl_Proxy2
Commit migrated from https://github.com/dotnet/corefx/commit/fcd5280edee0e9aaad82eb552f8e24d8dc0fab27
2018-02-19 22:27:30 -08:00
Stephen Toub 51b78a974c Implement SocketsHttpHandler's Expect100ContinueTimeout and ConnectTimeout (dotnet/corefx#27242)
With the expectation that we'll want to expose this in 2.1, implement Expect100ContinueTimeout and ConnectTimeout.  The members are currently internal but can be flipped public easily once the APIs are approved.  This also fixes an issue with cancellation around the connect phase, where a cancellation request that came in during the SSL auth phase would not be respected.

Commit migrated from https://github.com/dotnet/corefx/commit/01fa16ffd618846a913cad719269c8bb441ceb28
2018-02-19 11:06:18 -05:00
Tomas Weinfurt e87eea8021 rebase with current master. update based on PR feedabck
Commit migrated from https://github.com/dotnet/corefx/commit/15b56c2019c11e6f1a56b2ca86bfdca63156ea96
2018-02-16 14:39:11 -08:00
Lakshmi Priya Sekar 29936a5929 Response to PR feedback.
Commit migrated from https://github.com/dotnet/corefx/commit/9721f49e0838a3b3355437cb1f6882d9d62ab557
2018-02-15 14:24:44 -08:00
Lakshmi Priya Sekar 705c8ae243 Add tests to all handlers.
Commit migrated from https://github.com/dotnet/corefx/commit/aa2482155262063229ea3f0e5d868890d8490415
2018-02-14 15:52:54 -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 8f3ddb7597 Enable SocketsHttpHandler cancellation support (dotnet/corefx#27029)
* Enable SocketsHttpHandler cancellation support

This change significantly improves the cancellation support in SocketsHttpHandler.  Previously we were passing the CancellationToken around to every method, eventually bottoming out in calls to the underlying Stream which then ends up passing them down to the underlying Socket.  But today Socket's support for cancellation is minimal, only doing up-front checks; if cancellation is requested during the socket operation rather than before, the request will be ignored.  Since HttpClient implements features like timeouts on top of cancellation support, it's important to do better than this.

The change implements cancellation by registering with the CancellationToken to dispose of the connection.  This will cause any reads/writes to wake up.  We then translate resulting exceptions into cancellation exceptions.  When in the main SendAsync method, we register once for the whole body of the operation until the point that we're returning the response message.  For individual operations on the response content stream, we register per operation; however, when feasible we try to avoid the registration costs by only registering if operations don't complete synchronously.  We also account for the case that on Unix, closing the connection may result in read operations waking up not with an exception but rather with EOF, which we also need to translate into cancellation when appropriate.

Along the way I cleaned up a few minor issues as well.

I also added a bunch of cancellation-related tests:
- Test cancellation occurring while sending request content
- Test cancellation occurring while receiving response headers
- Test cancellation occurring while receiving response body and using a buffered operation
- Test that all of the above are triggerable with CancellationTokenSource.Cancel, HttpClient.CancelPendingRequests, and HttpClient.Dispose
- Test cancellation occurring while receiving response body and using an unbuffered operation, either a ReadAsync or CopyToAsync on the response stream
- Test that a CancelPendingRequests doesn't affect unbuffered operations on the response stream

There are deficiencies here in the existing handlers, and tests have been selectively disabled accordingly (I also fixed a couple cases that naturally fell out of the changes I was making for SocketsHttpHandler).  SocketsHttpHandler passes now for all of them.

* Add test that Dispose doesn't cancel response stream


Commit migrated from https://github.com/dotnet/corefx/commit/53be85c2fe473fdea8c001e3d9fd81dd478b858e
2018-02-13 16:30:34 -05:00
Geoff Kizer 3a5fbcf1c2 add protocol tests for cookie handling
Commit migrated from https://github.com/dotnet/corefx/commit/750b29bbb1433ad5d4c3727217192dddbef90eef
2018-02-09 00:37:09 -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
Geoff Kizer 694a7a6172 implement connection retry logic and related changes
Commit migrated from https://github.com/dotnet/corefx/commit/64976bf062b6cbc55a3e708dbf7116188d075ff1
2018-01-31 10:03:23 -08:00
Geoff Kizer 47c423424d fix IDNA host name handling in proxy case, and add some IDNA tests
Commit migrated from https://github.com/dotnet/corefx/commit/36eb70cb80ec368df52ffd9b2257317bae8bdb47
2018-01-22 12:26:18 -08:00
Tyler Brinkley 9d61820b00 Made tests only apply to netcoreapp
Commit migrated from https://github.com/dotnet/corefx/commit/dff5efc1c3630e40c961d01049afd35475a29221
2018-01-01 21:00:31 -06: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
Geoff Kizer cf5033763d add some basic protocol tests for status line handling
Commit migrated from https://github.com/dotnet/corefx/commit/79709c46a1e84ccae519ca58a12f9f29f0b64db5
2017-10-17 11:49:00 -04:00
Stephen Toub e16c674170 Increase file descriptor limit in S.N.Http tests on macOS
Commit migrated from https://github.com/dotnet/corefx/commit/2bce06e38f5c16ec6d6eed96a2c4410110fe5ec6
2017-09-21 21:31:49 -04: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 29b6641eeb Add ReadOnlyMemoryContent to System.Net.Http (dotnet/corefx#24006)
* Add ReadOnlyMemoryContent to System.Net.Http

Allows `{ReadOnly}Memory<byte>`s to be uploaded in HttpClient requests.

* Address PR feedback

* Address more PR feedback


Commit migrated from https://github.com/dotnet/corefx/commit/d183fd34074fba9633f025fe2251e7d7883c7f25
2017-09-13 13:01:15 -07:00
Lakshmi Priya Sekar 82a42d0e68 Move test to windows specific.
Commit migrated from https://github.com/dotnet/corefx/commit/b95d60789528d2d920e4d58238ee3fd3260585de
2017-09-12 17:36:53 -07:00
Stephen Toub 262530fb1d Override Read/Write(span) on System.Net.Http streams (dotnet/corefx#23345)
Commit migrated from https://github.com/dotnet/corefx/commit/c351ba1f094871e4ae97f23f20f26648662cc4e6
2017-08-18 09:06:05 -04:00
Stephen Toub 945d60b1f5 Enable full duplex communication with ManagedHandler (dotnet/corefx#23180)
* Enable full duplex communication with ManagedHandler

ManagedHandler currently waits for all of the request content to be sent before it processes any response content.  While that matches with what many servers do (not sending any response content until all request content has been received), some sites and situations do benefit from or even require full duplex communication, such that the response can be processed even while the request content is being sent.  This change is also a necessary step towards enabling Expect: 100-continue, as we need to be able to receive the response header before having sent the content, and even without Expect: 100-continue, this allows us to stop sending a large request body if a server quickly sends back a status indicating the transfer isn't needed (e.g. a redirect).

This change also improves on the cancellation support for sending the request body.  The send cancellation token is now embedded in the request content stream and uses that token for all operations.

* Address PR feedback

- Don't force flush the headers before sending content.
- Skip the write buffer when using ContentLengthWriteStream
- Fix some typos


Commit migrated from https://github.com/dotnet/corefx/commit/a326d79a4fac6e82839ab1d672a2e536b6c81754
2017-08-13 06:07:13 -04:00
Tarek Mahmoud Sayed 3765a6069b Moving PlatformDetection to Corefx.Private.TestUtilities assembly (dotnet/corefx#23109)
* Moving PlatformDetection to Corefx.Private.TestUtilities assembly

The purpose of this change is to clean up all test projects instead of including the PlatformDetection code inside every test project, we’ll have it in the Corefx.Private.TestUtilities.
I have refactored the PlatformDetection to split the different implementation of Windows and Linux. If we need to do more refactoring there we can do it later as needed.

* Fix Linux BB

* Update the xunit package reference

* Fix wrong condition on one of the tests

* Update the ConditionalFact/Theory to use Type as a parameter


Commit migrated from https://github.com/dotnet/corefx/commit/878e2fcf5a9f1068015e5fada9231088663e3490
2017-08-10 22:37:36 -07:00
David Shulman 0e9da04ab9 Port TFS WinRT interop tests for HttpClient for UAP (dotnet/corefx#22239)
* Port TFS WinRT interop tests for HttpClient for UAP

Bring over the last of the WinRT interop tests for HttpClient. These
tests deal with interop between WinRT stream classes and .NET stream
classes.

Fixes dotnet/corefx#9044

* Address PR feedback


Commit migrated from https://github.com/dotnet/corefx/commit/7f4b8837ef77c3784cde0f57d17a5e656df86cb4
2017-07-14 09:01:11 -07:00
Hugh Bellamy 98b18432b7 Move AssertExtensions to Corefx.Private.TestUtilities (dotnet/corefx#21799)
* Move AssertExtensions to Corefx.Private.TestUtilities

* Update csprojs

* Fix Linq.Expressions uapaot build


Commit migrated from https://github.com/dotnet/corefx/commit/7e3b0db2892c56a431f8e99af9cd9381adec385a
2017-07-03 09:27:30 -07:00
Stephen Toub 849ab9a89b Separate ManagedHandlerTestHelpers into its own file
Commit migrated from https://github.com/dotnet/corefx/commit/083a1dc85c21ecb980e0af58f78af7af87254edd
2017-06-30 17:15:18 -04:00
Stephen Toub 1de0cf31b0 Integrate ManagedHandler into Windows and Unix builds
- Add a ManagedHandler field to both the Windows and Unix HttpClientHandler builds, and change the members to switch based on which is being used.  The default is still to use WinHttpHandler and CurlHandler respectively, but setting an environment variable prior to constructing an HttpClientHandler will switch it to use ManagedHandler.
- Add test classes that will run the tests again but with the managed handler.  Some of the test classes are commented out due to current failures.
- Fixed a few tests.


Commit migrated from https://github.com/dotnet/corefx/commit/b238d0d760a2588513c443f3a4c991222fd037bb
2017-06-22 09:26:46 -04:00
Tarek Mahmoud Sayed 8754550d62 Enable UAP Remote Execution for all tests (dotnet/corefx#21014)
This change to enable remote execution of all corefx tests in UAP. Because the remote execution code for UAP is using WinRT APIs and to avoid forcing adding UAP configuration to all test projects, we factor the remote execution code into its own test library (called TestHelper) which is cross compiled.

Commit migrated from https://github.com/dotnet/corefx/commit/eb2f543b189e8f7f9ae4c31e832ac9d3c22bb41a
2017-06-14 13:26:57 -07:00
Jose Perez Rodriguez 7ce5531fcc Fixing System.Net.Http.Functional tests on uapaot
Commit migrated from https://github.com/dotnet/corefx/commit/692343761c582dba996f83abfffe150bf854a614
2017-05-26 11:24:34 -07:00
Eric St. John 67a1a83adf Update configurations
Commit migrated from https://github.com/dotnet/corefx/commit/a152026c63c03dda2e470b780ecb4b3aa9671e11
2017-05-19 10:17:08 -07:00
Stephen Toub aed0fee2f6 Add DangerousAcceptAnyServerCertificateValidator property to HttpClientHandler
Commit migrated from https://github.com/dotnet/corefx/commit/2a9435284246f914dc854e195428527b38e52aae
2017-05-18 13:49:15 -04:00
Lakshmi Priya Sekar d13b95a549 Fixing OID EKU validation.
Commit migrated from https://github.com/dotnet/corefx/commit/023ecc91671ea48a0e27d466d13003d4830d671a
2017-05-10 13:29:13 -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
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
Eric Mellino ddb473aac9 Move corefx onto the .NET Core 2.0 toolset
Commit migrated from https://github.com/dotnet/corefx/commit/8b471f76eef041f0cf40fec65c99a29b235bbe7d
2017-04-10 14:36:01 -07:00
Tarek Mahmoud Sayed 77cad86b1e Remove versioned configuration from test projects (dotnet/corefx#15879)
The changes onclude some other minor clean up in the test project files

Commit migrated from https://github.com/dotnet/corefx/commit/62212cca900081173fce70991c3a0b30393994a3
2017-02-06 13:52:11 -08:00
Karthik Rajasekaran 4bbdadd88a Update project configuration and sln files (dotnet/corefx#15182)
* Add ValidateVSConfigurations

* Update project config and sln files.


Commit migrated from https://github.com/dotnet/corefx/commit/f6ab339f446e37505f93ef9f430801fa1dcc05b8
2017-01-17 14:31:23 -08:00
Wes Haggard 848b9b15c0 Update documentation to include how to configure builds
Updates the documentation as well as config.json file with information on
RuntimeOS and the different ways to configure BuildConfiguration.

Cleans up InputOSGroup as it is no longer needed.

Cleans up TargetOS and makes it scoped only to the test command line generation

Add debugging information for TargetOS property for test runs.


Commit migrated from https://github.com/dotnet/corefx/commit/32bb7e8b9a472c8ea97537ce0a94511b4c7ca821
2017-01-09 13:32:45 -08:00
Jose Perez Rodriguez e5529a906d Make Test projects compile against the Targeting pack. (3/3 of the work) (dotnet/corefx#14534)
Commit migrated from https://github.com/dotnet/corefx/commit/c06e46913f93aa4d4eec880410c3edb4e5039639
2016-12-15 13:12:46 -08:00
Stephen Toub 74ac16201f Override CopyToAsync on LimitMemoryStream
The base MemoryStream's CopyToAsync implementation only provides its optimizations when the concrete type of the stream is MemoryStream and not for derived streams.  This commit adds a similar optimization to to LimitMemoryStream, such that it'll write its whole buffer to the destination in a single write.


Commit migrated from https://github.com/dotnet/corefx/commit/23b4fa71707970c7828af237fcee7ac0407f88be
2016-11-14 16:58:25 -05:00
Jeremy Kuhne f05a8c4187 Move IO types into System.Runtime.Extensions (dotnet/corefx#13451)
Move all of System.IO into System.Runtime.Extensions.
Finish moving System.IO.Primitives into System.Runtime.

Commit migrated from https://github.com/dotnet/corefx/commit/55eb2f16c4ccdb6e4c50a89af5c14ac843239901
2016-11-09 14:44:50 -08:00
Cristian Pop 1fb0a8ece8 TLS SystemDefault support.
Commit migrated from https://github.com/dotnet/corefx/commit/e882577f1cdf1c6505681c0a52a532d78f03c24f
2016-11-08 16:07:26 -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
Cristian Pop ba43904a93 Adding server code. Fixing IIS application deployment.
Commit migrated from https://github.com/dotnet/corefx/commit/cb0becbb7e546ffa5f265f862e76bc0fa445ec50
2016-07-13 15:29:11 -07:00