Commit Graph
181 Commits
Author SHA1 Message Date
Geoff Kizer 286740559c add shutdown call to try to make redirect test more reliable
Commit migrated from https://github.com/dotnet/corefx/commit/11a9368d1b1fbf0eca11406473e1e7f0c712ff3c
2018-02-22 12:03:09 -08:00
Geoff Kizer c3645e3634 reconcile merge and fix curl issue
Commit migrated from https://github.com/dotnet/corefx/commit/4a779f45ac9475925a967a0b9ce3f9bd277fd041
2018-02-20 15:28:05 -08:00
Geoff Kizer cde1aa194a address review feedback and fix issue with redirect to GET handling
Commit migrated from https://github.com/dotnet/corefx/commit/37baaf29aabfd4bea4e1912b5a672a8c7af79c20
2018-02-20 15:28:05 -08:00
Caesar Chen 987d73a579 Enable SendReceive_VaryingLengthBuffers_Success on Windows run (dotnet/corefx#27181)
* enable test on Windows run

* delete script

* disable test issue dotnet/corefx#27211

* disable test see dotnet/corefx#27217


Commit migrated from https://github.com/dotnet/corefx/commit/d3a69ff4448a0bd4df12e6af481898825c066c67
2018-02-16 16:03:46 -08:00
Stephen Toub b6b2da9344 Improve test coverage of SocketsHttpHandler (dotnet/corefx#27135)
* Improve test coverage of SocketsHttpHandler

Used code coverage information to write targeted tests to cover various uncovered paths in SocketsHttpHandler.  Along the way fixed a variety of issues relating to throwing the wrong exception type, a stack overflow due to an unexpected recursive call, etc.

* Address PR feedback

* Re-disable a test


Commit migrated from https://github.com/dotnet/corefx/commit/39677219aaeab8c6591b625ab2874acb17eaf4ef
2018-02-16 12:02:45 -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 c9a61b410b address PR feedback
Commit migrated from https://github.com/dotnet/corefx/commit/6ab005635528a03daa52ca727a4a74dcc0316830
2018-02-13 15:44:00 -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
Max Kerr 717083f0d4 Clear Authorization Headers on Redirect (dotnet/corefx#26864)
When a user has added an Authorization header to a request via the HttpClient DefaultRequestHeaders Authorization field, ensure that header is stripped on redirect.

This change adds a method to strip Authorization headers that were set via the HttpClient DefaultRequestHeaders Authorization field, and calls that method on redirect. In addition, it adds a test to ensure that this behavior occurs as expected.

The new method ResetAuthRequestHeaders is based on the method ResetCookieRequestHeaders, which is used to reset cookie headers on redirect.

The issue also occurs in CurlHandler, but the fix is slightly different. Rather than remove the headers that have already been set, we can instead just skip them when copying over the new headers to the redirected request.

Fixes dotnet/corefx#26426

Commit migrated from https://github.com/dotnet/corefx/commit/7e6396b2bcb4d372b199cfb7b3b13e290c441124
2018-02-12 11:28:09 -08:00
Geoff Kizer 2927c099bf Merge pull request dotnet/corefx#26989 from geoffkizer/fixcookiehandling
SocketsHttpHandler: Fix some issues with cookie handling, and add cookie tests

Commit migrated from https://github.com/dotnet/corefx/commit/8cee267154ef9dc6dde7a76a828844a200437872
2018-02-11 18:23:50 -08:00
Geoff Kizer ef25741e58 consolidate cookie tests
Commit migrated from https://github.com/dotnet/corefx/commit/c20262c69a93449498d511014e9e69bad18f987a
2018-02-11 12:38:20 -08:00
Stephen Toub 5c894d6b17 Add SocketsHttpHandler check for TransferEncodingChunked w/o Content (dotnet/corefx#27040)
Commit migrated from https://github.com/dotnet/corefx/commit/bf5a3183bc901723ebe0bb3d178bec86cda57429
2018-02-11 12:19:03 -05:00
Stephen Toub 296015a364 Add more SocketsHttpHandler tests
Commit migrated from https://github.com/dotnet/corefx/commit/8cb4d130bc3e8151fc72fe9494787643c7b00c4b
2018-02-08 19:12:50 -05: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
Stephen Toub 458c3f858c Implement MaxResponseHeadersLength on ManagedHandler (dotnet/corefx#26906)
Commit migrated from https://github.com/dotnet/corefx/commit/b6b7eb09600c18d35c6f9bf9ca484d5b8399f718
2018-02-07 17:58:05 -05:00
Geoff Kizer 507363f7c1 Merge pull request dotnet/corefx#26782 from geoffkizer/httpmisc2
ManagedHandler: support LF line endings and trailer headers

Commit migrated from https://github.com/dotnet/corefx/commit/ddf2a6d45973d5ceb6b2c9920a23f64094c6da3c
2018-02-07 00:12:58 -08:00
Paulo Janotti d88807b6d4 Conditionally skip test causing assert in WSL. (dotnet/corefx#26875)
Skip test in WSL until dotnet/corefx#26813 and dotnet/corefx#26476 are fixed

Commit migrated from https://github.com/dotnet/corefx/commit/d9665c946e47dc9a3cf4b4669d73f9d49a752a68
2018-02-05 21:40:59 -08:00
Stephen Toub 114398ac6b Disable ExpectContinue in ManagedHandler when using version 1.0 (dotnet/corefx#26774)
Don't fail, but disable sending the header and respecting the setting if the version is 1.0.

Commit migrated from https://github.com/dotnet/corefx/commit/8ec2cf215893c1f86c25bc079ff67e67678e0a04
2018-02-03 06:07:36 -05:00
Paulo Janotti 64e492d841 Fix test PostAsync_ThrowFromContentCopy_RequestFails (dotnet/corefx#26794)
* Fix test to catch proper exception according to handler

* Removing test trait added for my local tests

* Uap handler behaves like the managed one

* Switch if branching for simpler condition


Commit migrated from https://github.com/dotnet/corefx/commit/f38afda24305979be4613d08df8ea154a6a2d16d
2018-02-02 19:07:29 -08:00
Stephen Toub b3286ea024 Clean up ManagedHandler sending of request content (dotnet/corefx#26759)
* Clean up ManagedHandler sending of request content

Centralize the copy into the function that actually sends the content.

* Add HttpClientHandler test for handling request content copy failure


Commit migrated from https://github.com/dotnet/corefx/commit/6f8a600be95671162bd4de3014adafabe0a0e5ed
2018-02-02 08:50:35 -05:00
Geoff Kizer 1869a9d1a1 support LF line endings and trailer headers
Commit migrated from https://github.com/dotnet/corefx/commit/85c943fb8388585a7d49a75b879844d68962a6ab
2018-02-02 01:21:27 -08:00
Paulo Janotti a9bb9f1ab7 Separate basic auth test cases for HttpClientHandler (dotnet/corefx#26713)
Separating the test cases between compliant and non-compliant names. Related to dotnet/corefx#23135 

Commit migrated from https://github.com/dotnet/corefx/commit/62a3d898ceb94227b2b03462b5b09f0a7cd4e3a8
2018-01-31 15:37:08 -08:00
Geoff Kizer 6239288b27 Merge pull request dotnet/corefx#26585 from geoffkizer/httpversionhandling
clean up request and response version handling in managed handler

Commit migrated from https://github.com/dotnet/corefx/commit/2e10ed5418bac7b6b47a407b7efb28ccfcbc9f21
2018-01-31 10:19:41 -08:00
Paulo Janotti 1542b4278f Make redirect test case really 'redirect' (dotnet/corefx#26674)
The test case was redirecting to the same URL this was bringing instability with the handlers (more with the managed). This change should make the test more reliable, as such moving it to inner loop.

Fixes dotnet/corefx#23769
Since no action is planned for dotnet/corefx#26434 this also closes dotnet/corefx#26434

Commit migrated from https://github.com/dotnet/corefx/commit/3b69635f25636377841ded02de254eacec6e3728
2018-01-30 13:26:09 -08:00
Geoff Kizer 79e1348226 clean up request and response version handling in managed handler, and add tests
Commit migrated from https://github.com/dotnet/corefx/commit/a1bf78551ff6de29ea02837a21620000886b2828
2018-01-24 23:17:21 -08:00
Paulo Janotti abeece37dd Disable 307 LargePayload again (dotnet/corefx#26547)
Test failed with managed handler again, disabling before further
investigation.

Commit migrated from https://github.com/dotnet/corefx/commit/19aa9ff4bb0ba7a73a502fe0e5557f7653b7035e
2018-01-23 08:34:32 -08:00
Paulo Janotti be838e8850 No local repro for dotnet/corefx#23768, re-enabling test (dotnet/corefx#26399)
* No local repro for dotnet/corefx#23768

Not to be committed as it is, just to check CI run.

* Re-enale LargePayload test in OuterLoop

The LargePayload test did not fail in various local runs and in CI,
re-enabling it.

Fixes dotnet/corefx#23768


Commit migrated from https://github.com/dotnet/corefx/commit/b265a0f0066dbce3cf4845c25444fe85266c81d0
2018-01-19 12:49:30 -08:00
Stephen Toub c666617fbc Add missing Shutdown calls in HTTP loopback servers (dotnet/corefx#25694)
Commit migrated from https://github.com/dotnet/corefx/commit/dbfa1ebe3f41090c525990d4887bd64574b5124b
2017-12-04 22:04:44 -05:00
Tim Seaward 6b6e07fbb9 Removing unneeded blocking from tests (dotnet/corefx#25399)
Commit migrated from https://github.com/dotnet/corefx/commit/49a62edcfe76f1c5f5e981144a301ba3ddc5feb2
2017-11-20 22:19:04 -05:00
Lakshmi Priya Sekar 2c675cd34e Respond to PR feedback.
Commit migrated from https://github.com/dotnet/corefx/commit/0356a36032259753603a6018daa5d43cc688af32
2017-11-09 15:04:45 -08:00
Lakshmi Priya Sekar 4c8182b579 Mark tests hitting azure as outerloop.
Commit migrated from https://github.com/dotnet/corefx/commit/4a6a6aef06d3f8cbf5f9847ba7a241c15a4a20ff
2017-11-07 15:23:59 -08:00
Lakshmi Priya Sekar 7920e67372 Reset auth settings on the request during redirect on managedhandler.
Commit migrated from https://github.com/dotnet/corefx/commit/1daa3e97131ceb62741e56bd6a7e6450e9de1b5e
2017-11-07 15:18:14 -08:00
David Shulman 19ef688da1 Cleanup Windows 10 version detection (dotnet/corefx#25052)
* Cleanup Windows 10 version detection

Windows 10 Version 1709 ("Fall Creators Update") has been released. This
PR cleans up the version detection to use the latest RTM build numbers
and removes obsolete InsiderPreview detection for those tests.

Also, removed ActiveIssue for tests that are now fixed due to Windows 10
fixes.

Fixes dotnet/corefx#22187

* Addressed feedback


Commit migrated from https://github.com/dotnet/corefx/commit/ac410223aa763a0f67880815057ee1bfe0f4cb6e
2017-11-04 11:09:38 -07:00
Stephen Toub 087ef535f4 Use the Host header for the SSL handshake
Commit migrated from https://github.com/dotnet/corefx/commit/5ecea8ff47c03a073a77916a9c7d1d806f8c7ce3
2017-10-25 13:40:03 -04:00
Stephen Toub ac386deda7 Don't fail a redirect that's missing a Location header
Commit migrated from https://github.com/dotnet/corefx/commit/ddfab940fcc2d571c2da85250c13e457ab1933a2
2017-10-25 13:23:59 -04:00
Stephen Toub 6d13fd5bc3 Address PR feedback
Commit migrated from https://github.com/dotnet/corefx/commit/3b9525bd44ffab17a227cad47ae607bbf370dc1c
2017-10-18 00:19:35 -04:00
Tomas Weinfurt e12d604d93 Add minimal handling for HTTP 1.0 requests to ManagedHandler (dotnet/corefx#23653)
* add minimal handling for 1.0 requests.

* use 1.1 as default version and move some message to resource file

* fix spelling

* remove exception for 2.0 requests and fall-back to 1.1

* remove s_spaceHttp20NewlineAsciiBytes as it is not used now

* add isHttp10 bool to avoid duplicate check.


Commit migrated from https://github.com/dotnet/corefx/commit/8b266d0ca4a12428629b3a7abf79c61c29e50883
2017-10-02 23:40:30 -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
Lakshmi Priya Sekar 7bf96b53d4 Consolidate code between different Http handlers.
Commit migrated from https://github.com/dotnet/corefx/commit/5ef59053709ef8b6f5b30b709bffbe38fcb19823
2017-09-07 11:18:43 -07:00
Lakshmi Priya Sekar ec142d891b Use only CredentialCache when redirecting Uris in ManagedHandler.
Commit migrated from https://github.com/dotnet/corefx/commit/9d5f5d1f8630e3c50404647926496b0d45cf1203
2017-09-05 18:26:43 -07:00
David Shulman c3dbc2406e Disable some networking tests
Disabling tests.
dotnet/corefx#23765 dotnet/corefx#23766 dotnet/corefx#23767 dotnet/corefx#23768 dotnet/corefx#23769 dotnet/corefx#23770 dotnet/corefx#23771


Commit migrated from https://github.com/dotnet/corefx/commit/acafae51592f7e09fba003a3684d550dba155a2e
2017-09-02 16:50:54 -07:00
David Shulman 7df69b01b9 Re-enable HTTP/2 test
Turning back on the HTTP/2 test that relied on www.microsoft.com being
HTTP/2 now that the HTTP/2 server farm processing those requests is
working again.

Fixes dotnet/corefx#22735


Commit migrated from https://github.com/dotnet/corefx/commit/169daaad2062ab623fdafa738c3fdbc778d3652e
2017-09-01 12:33:26 -07:00
Stephen Toub d7e1498910 Fix ManagedHandler redirect post->get behavior (dotnet/corefx#23216)
Commit migrated from https://github.com/dotnet/corefx/commit/2f4faed916caa8d70a72ad7518705aeac7c68257
2017-08-14 13:12:48 -04:00
Stephen Toub e2218fc078 Add Expect: 100-continue support to ManagedHandler (dotnet/corefx#23196)
Commit migrated from https://github.com/dotnet/corefx/commit/791f81d2d8eb45e5077d2c0c17e784ad597c5e3a
2017-08-14 08:42:01 -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
Stephen Toub 8bfc1f89b1 Fix potential deadlocks in HttpClient tests
A bunch of tests have the following structure:
```C#
var clientTask = hc.GetAsync(...);
await server.HandleRequest();
Handle(await clientTask);
```
If the HttpClient request fails in a way that causes the server not to receive the request, the test will hang, as the await for the server operation to complete will never complete.

This commit changes a bunch of the tests to avoid that pattern.  This makes several of the tests disabled due to hanging actually reveal the cause of the problem, e.g. the ManagedHandler not supporting 1.0 requests and failing immediately if provided with that version without making a request to the server.


Commit migrated from https://github.com/dotnet/corefx/commit/e34b6fd99085c69c8fd7a64ed5eb4da5b66f4136
2017-08-11 15:34:06 -04:00
Stephen Toub 48a1b245f6 Handle invalid chunk size in ManagedHandler (dotnet/corefx#23160)
To match WinHttpHandler, support chunk sizes up to ulong.MaxValue in size, and throw exceptions for anything larger.

Commit migrated from https://github.com/dotnet/corefx/commit/c8768231c3a272dd6f330dd1cccb9fa69e671915
2017-08-11 15:33:31 -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 3b0d3fbb4e Update UAP test regarding 'TRACE' method (dotnet/corefx#22973)
* Address delayed feedback

Address delayed feedback from PR dotnet/corefx#22702 and release/uwp6.0 port PR
dotnet/corefx#22759

* Remove active issue on Uap TRACE test

Uap platform doesn't support the 'TRACE' verb.  After discussion with
Wininet team, the method is explicitly not allowed. So, removing the
activeissue and just skipping that part of the test.

Fixes dotnet/corefx#22161


Commit migrated from https://github.com/dotnet/corefx/commit/f7bc8b413406e94549f21be79e67641f11ae8266
2017-08-04 23:38:39 -07:00
David Shulman bf75c2d777 Fix HttpClient redirection logic on UAP (dotnet/corefx#22702)
* Fix HttpClient redirection logic on UAP

This PR changes the implementation of sending requests in HttpClient for UAP when
dealing with redirection. In the past, we would let the WinRT layer handle auto
redirection logic. However, due to dotnet/corefx#9003, the cookies were getting lost on 3xx responses
since the .NET layer didn't see them. So, this PR implements the redirection ourselves.

One important part of redirection is that we need to drop credentials. The WinRT layer
did this for us. However, we are unable to use a single WinRT HttpBaseProtocolFilter object
since we need to remove the credential after the first redirect. So, we need to maintain
a second filter that uses no credentials and keep it in sync regarding all the other properties
of the primary filter.

With this PR, the behavior of other aspects (such as controlling max number of redirects, etc.)
now matches .NET Framework.  So, some tests were adjusted to remove the UAP specific behavior
checks.

Fixes dotnet/corefx#9003
Fixes dotnet/corefx#22191

* Disable test on Linux

* Address PR feedback

* Disable failing HTTP/2 test


Commit migrated from https://github.com/dotnet/corefx/commit/f2308f8db0679ac63e8e7eeac9d56cb035d6d9e3
2017-07-28 16:43:40 -07:00