Commit Graph
116 Commits
Author SHA1 Message Date
Caesar Chen 52de487b17 Http trailer support for HTTP/1.x (dotnet/corefx#35337)
* http trailer for http/1.1

* address feedback

* address feedback

* pr feedback

* stop blocking context

* fix framework test failiure

* address feedback

* seperate tests

* address some feedback

* more feedback from review

* correct ReadAsync

* feedback from review

* handle short ReadAsync()

* more feedback


Commit migrated from https://github.com/dotnet/corefx/commit/ac9c746c44a5c0decf551fe33fb2acbdc895d021
2019-03-16 15:56:39 -04:00
Geoff Kizer c88fd24fd9 Merge pull request dotnet/corefx#34345 from geoffkizer/genericloopbackserver
Add GenericLoopbackServer for HttpClient testing

Commit migrated from https://github.com/dotnet/corefx/commit/3de6ad8c1233ccf9c781d42a0cdb88b0aeb24cb7
2019-02-12 12:54:50 -08:00
David Shulman 8ddab057fd Add NTLM feature detection and more tests (dotnet/corefx#35200)
This PR works toward the goal of our Enterprise Scenarios. I added logic in the Unix
PAL gssapi layer to detect whether the NTLM plugin is installed. This is useful both
in the product code (to return better exception messages) and the test code (to
skip NTLM tests if needed).

Refactored some of the Common System.Net.Configuration logic for tests. Added new
environment variable logic to separate between domain-joined and standalone server
environments.

Add new tests to validate NTLM end-to-end connectivity. Opened some new issues
discovered along with way regarding HTTP/2 and Windows authentication.

To run these new tests simply set the 3 environment variables to point to the
standalone windows server environment.  For example, on Linux:

```
export COREFX_WINDOWSSERVER_HTTPHOST=somewindowsmachine.contoso.com
export COREFX_NET_SERVER_USERNAME=someusername
export COREFX_NET_SERVER_PASSWORD=somepassword
```

I have already deployed a standalone Windows server for these tests but
we're not ready yet to have the tests always run in CI.

Contributes to dotnet/corefx#34878 


Commit migrated from https://github.com/dotnet/corefx/commit/fe6f55b496489dbd02cdd207c0b1f9112b560763
2019-02-10 08:24:06 -08:00
Geoff Kizer 20be2ff6d4 rename HttpCookieProtocolTests => HttpClientHandlerTest.Cookies
Commit migrated from https://github.com/dotnet/corefx/commit/47e35192ff1f830b27e2ed5fa14d7d7645a27e95
2019-02-07 17:06:48 -08:00
Geoff Kizer 71d702c934 add GenericLoopbackServer and provide basic implementations for HTTP/1.1 and HTTP/2, and use in Cookie tests
Commit migrated from https://github.com/dotnet/corefx/commit/4fc6a75fce36fbbf7b551f25c121dde403b8f0f4
2019-02-07 16:55:26 -08:00
Geoff Kizer 0714534ab3 make HTTP2 tests run for platform handler as well
Commit migrated from https://github.com/dotnet/corefx/commit/686bf6eb6973713f4845fbb874b53f81ea16e50b
2019-02-06 10:48:22 -08:00
Caesar Chen d6e31afb2d Diable System.Net.Http.FunctionalTests parallel execution on UAP run (dotnet/corefx#35004)
* diable parallel execution

* fix format....

* address feedback


Commit migrated from https://github.com/dotnet/corefx/commit/5543097d8b6039dedffdcd8b8e713de38e5a1ece
2019-01-31 15:55:40 -08:00
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
Geoff Kizer 66c9cd06da split redirect tests into separate file
Commit migrated from https://github.com/dotnet/corefx/commit/33aa830e7975d6fdf50143348cb78f2924d673de
2019-01-01 16:00:52 -08:00
Viktor Hofer 66e8f64d31 Consume Microsoft.DotNet.CoreFxTesting package (dotnet/corefx#33423)
* Consume Microsoft.DotNet.CoreFxTesting package

* Remove code coverage dedicated runtime dir config files and switch to Coverlet

* Add global tool support in corefx

* Update code coverage docs

Commit migrated from https://github.com/dotnet/corefx/commit/ae38b7cc3762d832fdcebe27a0aab7b22ab2f3fa
2018-12-06 02:56:11 +01:00
Jeremy Barton e54864fbc0 Check for the specific in-use version of OpenSSL when working with libcurl
Rather than check a generic 1.0/1.1, test for the specific library version that
the crypto shim has loaded.  This makes things work when both libcurl
and the crypto shim are using OpenSSL 1.1 and also prevents a state where two
different copies of the library (at different patch versions) are utilized.

Commit migrated from https://github.com/dotnet/corefx/commit/d33f8435461028ec131fcfd42232098aaf3e6ded
2018-09-26 15:35:35 -07:00
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