Commit Graph
17 Commits
Author SHA1 Message Date
Stephen Toub e71767ffb2 Enable HTTP/2 in SocketsHttpHandler via HttpRequestMessage.Version (dotnet/corefx#37234)
We now respect the version: if it's 1.1, we use 1.1, and if it's 2.0, we try to use HTTP/2.  At the same time, the default for HttpRequestMessage.Version goes back to 1.1, so to use HTTP/2, you opt-in by setting the version explicitly to 2.0.

Commit migrated from https://github.com/dotnet/corefx/commit/d69d441dfb0710c2a34155c7c4745db357b14c96
2019-05-02 00:15:28 -04:00
Tomas Weinfurt bb20d2572d add test for lower casing header name logic (dotnet/corefx#36708)
* add test for 35164

* update SocketsHttpHandler_HttpClientHandler_Cancellation_Test_Http2

* fix uwp tests

* change port from 123 to 443


Commit migrated from https://github.com/dotnet/corefx/commit/4e3b46c22cec88a1f0deaa2f594634e5553412e1
2019-04-15 15:15:32 -07: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
David Shulman 2aefe4af59 Only run ResponseDrain tests on SocketsHttpHandler (dotnet/corefx#29988)
Running HTTP tests generally across all the handlers is useful when we're trying to validate HTTP protocol and API behaviors to be consistent everywhere.

However, testing SocketsHttpHandler implementation details, such as connection-drain algorithms, with other handlers leads to brittle tests with random test failures. The internal code of each handler and native code (i.e. WinHTTP) use different rules for such low-level connection details.

So it makes sense to only run tests such as this against the code that was written to match the tests, i.e. SocketsHttpHandler.

Closes dotnet/corefx#28424
Closes dotnet/corefx#28206

Commit migrated from https://github.com/dotnet/corefx/commit/2c734d6db0a8009150bac59f13960f463528ba76
2018-05-30 15:09:26 -07:00
David Shulman e7ae16d343 Disable Http tests on UAP (dotnet/corefx#29803)
Many dozen of Http tests are failing on UAP test runs. This is not showing up during PR/CI
because the UWP leg only is building the product and test sources and not actually running
any tests. However, the test failures show up in Helix and also when run locally on a dev machine.

So, for now, I'm disabling some of these tests so that the inner and outer test runs will pass.

Contributes to dotnet/corefx#29802
Closes dotnet/corefx#27953

Commit migrated from https://github.com/dotnet/corefx/commit/3326f3f24dd083f0966c8f71c7d1e8c2caa1ddae
2018-05-20 09:33:35 -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
Stephen Toub d5ba24bff1 Several Http test fixes to hopefully improve test reliability (dotnet/corefx#29238)
- Add “Connection: close\r\n” response header in more cases where the loopback server explicitly closes a connection, and in particular where the client makes multiple connections.
- Change several Task.WaitAlls on paired tasks to instead use our WhenAllOrAnyFailed helper.

Commit migrated from https://github.com/dotnet/corefx/commit/cebcf436358600a4808656b142a74f57d1e8f6f0
2018-04-20 18:21:18 -04:00
Stephen Toub 3f56012599 Disable draining test on CurlHandler (dotnet/corefx#28814)
Commit migrated from https://github.com/dotnet/corefx/commit/0a61dafdf643f436373c1ad1aba3da4a9a8b19bc
2018-04-04 11:22:40 -07:00
David Shulman 879f046c38 Disable some failing/hanging HTTP tests (dotnet/corefx#28425)
Opened some issues dotnet/corefx#28423 dotnet/corefx#28424. These tests are failing/hanging on my
dev box all the time.

Commit migrated from https://github.com/dotnet/corefx/commit/4a549f7fe7e8ea19f4fea8a233e525ebe0df7abb
2018-03-23 15:30:11 -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
Stephen Toub 1e3e61f57b Expose SocketsHttpHandler.ResponseDrainTimeout (dotnet/corefx#28011)
Commit migrated from https://github.com/dotnet/corefx/commit/9cde05ff84d118a9cc5629b85d4a319dd32172ae
2018-03-13 15:21:16 -04:00
Stephen Toub 4c75f5d1cd Add response drain max time to SocketsHttpHandler (dotnet/corefx#27708)
* Add response drain max time to SocketsHttpHandler

Adds support for a max time limit on how long we'll try to drain a connection before returning it to the pool, and adds a (currently non-public) knob for controlling that limit.

This also fixes a race condition with regards to cancellation and chunked responses.  If cancellation was requested after returning the connection to the pool but before we disposed of the cancellation registration, someone else could get the pooled connection and then cancellation of one request could end up canceling the other request.

* Address PR feedback


Commit migrated from https://github.com/dotnet/corefx/commit/4ca662cf7ed1bff8e423839936083838d705008d
2018-03-06 07:38:06 -05:00
Geoff Kizer a945f1b324 disable drain test variation for CurlHandler
Commit migrated from https://github.com/dotnet/corefx/commit/05e3ec4e001a1754facfd44ac78c6aa33b5fe86a
2018-02-27 19:06:38 -08:00
Stephen Toub 49571aef5e Add MaxResponseDrainSize, and fix a few draining bugs (dotnet/corefx#27476)
* Add MaxResponseDrainSize, and fix a few draining bugs

I've added MaxResponseDrainSize to make the setting configurable rather than a const; I left it internal until the API is approved.

In adding tests for it, I found a few existing bugs in draining that I fixed:
- HttpConnectionResponseContent nulls out its Stream when the Stream is consumed.  Then when the response content is disposed, the Stream is null, so it's not disposed, so it's not drained.
- HttpContentReadStream's Dispose wasn't checking whether it was already called, and would kick off a new draining operation if the connection was still associated.  So if the stream was disposed multiple times, which happens if the response content and stream are both disposed (since the content disposes of the stream), we end up corrupting the response due to multiple threads concurrently accessing and draining it.

* Address PR feedback


Commit migrated from https://github.com/dotnet/corefx/commit/eb80d133d066e72626643dddb3171bf9bb6a7c42
2018-02-27 08:35:03 -05:00
Geoff Kizer d803a21ca8 add logging for drain, and update tests to reflect higher limit for managed handler
Commit migrated from https://github.com/dotnet/corefx/commit/0070410383dfc528f394f3b73787aa9e575afc62
2018-02-21 15:47:40 -08:00
Geoff Kizer f8d6e9d663 address review feedback
Commit migrated from https://github.com/dotnet/corefx/commit/5c622083a4a2228b2b490929da6d94b97c6f6e33
2018-02-21 10:51:28 -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