Commit Graph
105 Commits
Author SHA1 Message Date
Geoff Kizer 07f7385c42 HttpClient: add simple nt auth tests (dotnet/corefx#32212)
* add basic nt auth tests

* address review feedback and disable tests on non-Windows platforms


Commit migrated from https://github.com/dotnet/corefx/commit/860509c967c8566b36fc134b5ea001489e2289b3
2018-09-11 15:07:21 -07:00
Geoff Kizer 1140844668 fix Huffman decoding issue and add Huffman decoding tests
Commit migrated from https://github.com/dotnet/corefx/commit/e5388b2fd7f9ab29800426f843b0c026b49ba7e4
2018-09-06 14:30:04 -07:00
Filip Navara 2a2c2ef521 Move uap, uapaot, netfx, netcoreapp and netcoreapp20 constant definitions to top-level build file. (dotnet/corefx#31470)
* Move uap, uapaot, netfx and netcoreapp constant definitions to top-level build file.

* Trying to fix compilation of PerformanceCounterLib for netcoreapp2.0 targets.

* Change netcoreapp definition to mean the current version only.

* Fix conflict in System.Private.DataContractSerialization.csproj.

* Revert change in src/shims/manual/Directory.Build.props.

* Fix condition in test.

* Bring back TargetsNetCoreApp, it was lost during rebases.

* Move definition of netstandard to top-level build file. Remove more netcoreapp/uap definitions from individual files.

* Fix vbproj compatibility.

* Address PR review and unify the definitions to use TargetGroup directly.

* Add back one "netstandard" definition.


Commit migrated from https://github.com/dotnet/corefx/commit/ac994544e749eac3e85b60bf0012ae2f85ae0e49
2018-08-29 08:49:33 -07:00
Max Kerr 967baf836d Implement HTTP/2 loopback server for frame level testing of SocketsHttpHandler (dotnet/corefx#31521)
This is an initial pass at support for frame level testing of the HTTP/2 protocol.

Commit migrated from https://github.com/dotnet/corefx/commit/66649ff5862c7b723fded40c505942de19bdb107
2018-08-06 14:39:12 -07:00
Eric Erhardt 8b6d5baf20 Change .csproj to new Configurations property
Change .sln to use the managed C# project system GUID.


Commit migrated from https://github.com/dotnet/corefx/commit/e05508a62d28f4807f85abe9cb7adf8382f792b4
2018-06-28 17:49:22 -05:00
Eric Erhardt 96c6a1b8fa Merge master into SdkProj
Commit migrated from https://github.com/dotnet/corefx/commit/0c7364e3a25b0d20dd5b4181fcb3041d949b92b9
2018-06-19 15:51:04 -05:00
David Shulman e813e968b6 Fix SocketsHttpHandler for Windows auth proxy CONNECT tunneling (dotnet/corefx#30478)
SocketsHttpHandler wasn't even trying to send Negotiate/NTLM auth tokens to a proxy. This was due
to some invalid logic regarding the "usingProxy" field in HttpConnection. Reworked this logic to
be clearer about the various kinds of proxy scenarios.

I refactored the loopback proxy server and made it much more robust. It can now handle multiple
requests and multiple connections which helps test against the other handlers whose behavior is
different in this area. I plan to do further work in consolidating the LoopbackServer and
LoopbackProxyServer classes in future PRs.

I created a separate HttpClientHandlerTest.Proxy.cs file and moved many existing proxy tests and
added new tests. The current HttpClientHandlerTest.cs file is still over 3000 lines and needs more
refactoring to make it easier to maintain and track test scenario coverage.

Fixes dotnet/corefx#30330


Commit migrated from https://github.com/dotnet/corefx/commit/ec1671fd7feffe1070a94d9d86379e0dd95ddcdf
2018-06-18 16:21:44 -07:00
wtgodbe f38ceb30be Convert all .csproj files in src to SDK-style projects
Commit migrated from https://github.com/dotnet/corefx/commit/91d7e62bbf28094a2b419b87847bcd6a7658564d
2018-05-21 11:53:46 -07:00
David Shulman 2ae1d2c874 Update System.Net tests to use newer corefx-testdata PFX files (dotnet/corefx#29724)
Updated PFX files were checked into corefx-testdata repro via
https://github.com/dotnet/corefx-testdata/pull/24. This PR removed
the friendly name attribute from the private key. This fixes the
problem in Windows dealing with parallel PFX import.

This PR updates the System.Net.* tests to use the updated corefx-testdata package.

Closes dotnet/corefx#23341
Contributes to dotnet/corefx#9543

Commit migrated from https://github.com/dotnet/corefx/commit/84883052ef0f720a8befdc8525db50c9544227d5
2018-05-16 11:42:46 -07:00
Stephen Toub c8e7b2312b Add missing awaits to XmlTextReaderImplAsync (dotnet/corefx#29518)
* Comment on awaits that don't need ConfigureAwait(false)

- Add comments to several awaits on tasks where ConfigureAwait is unnecessary for a variety of reasons
- Rather than commenting, change one await to GetAwaiter().GetResult() where we know the task is already completed (rather than just commenting to that effect)

* Add missing awaits to XmlTextReaderImplAsync


Commit migrated from https://github.com/dotnet/corefx/commit/b758c3b1f1293ada2e46f9e221be0b392838cc41
2018-05-04 16:08:59 -04:00
Stephen Toub b9397a45ca Add two missing ConfigureAwait(false) calls in SocketsHttpHandler (dotnet/corefx#29465)
* Add two missing ConfigureAwait(false) calls in SocketsHttpHandler

ChunkedTransferEncodingReadStream's ReadAsync had one await missing a ConfigureAwait(false).  If there's a synchronization context set on the calling thread, this results in a continuation being created that posts back to that context, which can cause problems (e.g. deadlocks) if that context is blocked, e.g. if the synchronous Read method is being used to block waiting for ReadAsync to complete.  The fix is simply to add `.ConfigureAwait(false)`.

As long as I was fixing that, I also reviewed all `await`s in SocketsHttpHandler and found one more that was missing `.ConfigureAwait(false)`, in HttpConnectionPool's EstablishProxyTunnel, and so fixed that, too.

And added some tests.

* Refactor ContentMode support in tests


Commit migrated from https://github.com/dotnet/corefx/commit/9e8c200f0888a1db590da8ffa026aa7384771611
2018-05-02 19:24:56 -07:00
Ahson Khan fc292cfab0 Split OwnedMemory into MemoryManager and IMemoryOwner (dotnet/corefx#28640)
* Update IRetainable, OwnedMemory, and MemoryHandle APIs

* Split OwnedMemory into MemoryManager and IMemoryOwner

* Update ReadOnlySequence, ArrayMemoryPool, and BufferSegment

* Update System.Memory and System.IO.Pipeline tests

* Temporarily skipping the failing Pipelines tests until impl is corrected.

* Update the reference assembly to match implementation and cleanup

* Update API compat baseline for UAPAOT and add GenFacadesIgnoreMissingTypes

* Fix the System.Runtime ref

* Add back the Pin methods to the uapaot api compat baseline

* Clone the API compat baseline from uapaot and add it for uap as well.

* Update BuildTools, CoreClr, CoreFx, CoreSetup, ProjectNTfs, ProjectNTfsTestILC to preview3-02630-01, preview3-26330-08, preview3-26330-06, preview3-26330-04, beta-26330-00, beta-26330-00, respectively

* Fix pipelines tests and update the api compat baseline shim for uapaot

* Add empty Unpin override to pipe pool test.

* Fix the System.Net.Http Functional tests


Commit migrated from https://github.com/dotnet/corefx/commit/f592e887e2349ed52af6a83070c42adb9d26408c
2018-03-30 14:30:48 -07:00
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