Commit Graph
905 Commits
Author SHA1 Message Date
Geoff Kizer e59a5d3bb0 fix trace conflict issue
Commit migrated from https://github.com/dotnet/corefx/commit/0288644ee8b16e54a9d6bd1fad8b8a50a24bf6d0
2018-02-28 11:42:23 -08:00
Geoff Kizer 64ea71c544 add ntlm auth and proxy auth for tunnel, and rework auth handling generally
Commit migrated from https://github.com/dotnet/corefx/commit/5d209e6e6280ced6c3ef4afda57c6f486ae36118
2018-02-28 02:57:05 -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 fe3585d9c5 Merge pull request dotnet/corefx#27220 from wfurt/ssl_Proxy2
support for CONNECT method in SocketHttpHandler 

Commit migrated from https://github.com/dotnet/corefx/commit/8e88850940605ef7d57cfc7b570bdf9bf2b8d822
2018-02-24 22:20:16 -08:00
Geoff Kizer 10fb7486c6 add issue number
Commit migrated from https://github.com/dotnet/corefx/commit/cc8db63f8688043306088b0057b05f69aa23e921
2018-02-24 14:52:34 -08:00
Geoff Kizer 9dba5b8340 revert change to existing redirect test and split into new test, disabled for WinHttpHandler
Commit migrated from https://github.com/dotnet/corefx/commit/edfa136cb9b003ac5575f9d1ad3e11dfbc147d76
2018-02-24 14:30:04 -08:00
Tomas Weinfurt c43d267d92 be more liberal on what exception type to get on handshake failure (dotnet/corefx#27352)
* be more liberal on what exception type to get on handshake failure
* refactor test code to address feedback from review
* move "catch XX" to separate line


Commit migrated from https://github.com/dotnet/corefx/commit/517238c264741d99a28c60178da9d65bac3d3fe5
2018-02-23 10:20:28 -08:00
Tomas Weinfurt 73922f6a6f update AllowAllCertificates so it works on systems with curl/nss. Disable test on Windows as it seems to cause some troubles.
Commit migrated from https://github.com/dotnet/corefx/commit/85756b823938ca5c5f6583d024a14363ad266f7d
2018-02-23 10:13:47 -08:00
Stephen Toub bd4c7bfebb Increase timeout in Expect100ContinueTimeout_SetAfterUse_Throws test
A few outerloop runs just missed the old timeout, presumably due to being overloaded.

Commit migrated from https://github.com/dotnet/corefx/commit/603c69d8ef82fa5517ec68b5a84fe3dd897fda0f
2018-02-23 08:10:48 -05:00
Tomas Weinfurt 96d06a74f6 refactor Proxy_UseSecureProxyTunnel_Success little bit.
Commit migrated from https://github.com/dotnet/corefx/commit/9fa2b9ab41d361cb1e683a95585abd91f147c67b
2018-02-22 20:37:04 -08:00
Geoff Kizer 8df3174c2f Merge pull request dotnet/corefx#27377 from geoffkizer/redirecttestfix
add shutdown call to try to make redirect test more reliable

Commit migrated from https://github.com/dotnet/corefx/commit/59481ca56906713ef9e5e4890388f4cd2fe9c699
2018-02-22 15:57:26 -08: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 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
Stephen Toub 0365092b59 Disable SocketsHttpHandler's concurrent content sends (dotnet/corefx#27341)
* Disable SocketsHttpHandler's concurrent content sends

SocketsHttpHandler currently has some support for allowing request content sending to run concurrently with response content receiving.  However, we don't actually have a need for this, and there are a lot of subtleties that would need to be made robust, e.g. how to handle exceptions that occur concurrently in the sending and receiving.  For now, we're removing it.  Unless ExpectContinue is set to true, we just send the content before receiving the response, and if it is set, we start the send and then wait for it once we've received the final status code from the server.

* Address PR feedback


Commit migrated from https://github.com/dotnet/corefx/commit/fecb772f0607dc85afdb782eda1b42ddffcba61b
2018-02-22 14:58:19 -05:00
Stephen Toub 3c9dd1b90a Fix fragment handling in HttpClient (dotnet/corefx#27360)
* Fix fragment handling in HttpClient

SocketsHttpHandler isn't sending fragments, nor is it properly inheriting the fragment from the original request URI into the redirect location URI when the original URI had one and the redirect URI did not, even though RFC 7231 says it must.  This commit fixes that for SocketsHttpHandler.

WinHttpHandler also isn't handling this inheritance according to the RFC. It appears that the logic for WinHttpHandler would actually need to be changed in WINHTTP itself, or else WinHttpHandler would need to be changed to do the redirects itself.

Neither CurlHandler or NetFxHandler send fragments at all.

This commit also fixes the test to correctly compare the expected and actual Uris... apparently Uri equality doesn't factor in fragments, so they're first converted to strings.  It also updates the test to also validate that the server received the URI with the fragment included.

* Disable the fragments test on WinHttpHandler

Apparently it sometimes doesn't do the "right thing" even in other cases.


Commit migrated from https://github.com/dotnet/corefx/commit/a273be657f6666e333fd902965a56046d6f48018
2018-02-22 14:25:05 -05:00
Geoff Kizer ebf914566e Merge pull request dotnet/corefx#27315 from geoffkizer/responsedrain
SocketsHttpHandler: add response stream drain

Commit migrated from https://github.com/dotnet/corefx/commit/662d9bffae0c1e6119d1a62b073966d8aee673d3
2018-02-22 09:36:37 -08: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 6bd49e65b9 Merge pull request dotnet/corefx#27266 from geoffkizer/authrefactor
SocketsHttpHandler: split auth and redirect handling back into two separate handlers

Commit migrated from https://github.com/dotnet/corefx/commit/d8d32ab5abbec82f4f1346f64e51e525508c6f39
2018-02-21 14:20:13 -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
Stephen Toub e030befe43 Several perf improvements/tweaks for SocketsHttpHandler (dotnet/corefx#27231)
* Several perf improvements/tweaks for SocketsHttpHandler

- Chunked reads from buffer.  We now process as much of the buffer as we can synchronously during ReadAsync, rather than returning once we hit the end of a chunk.  For very small chunks that arrive quickly, this results in a huge perf increase, e.g. best case for the optimization, with lots of 1-byte chunks getting buffered together, it's now 10x faster.  With 100-byte chunks buffered together, it's 2x faster.

- Blitting byte[] to output for known headers.  Rather than using WriteStringAsync to output all header names, we now use WriteBytesAsync for known headers, with the headers precomputed into byte[]s and cached.

- Removed delegate/closure allocation from connection.  We were accidentally closing over a cancellation token, resulting in an extra delegate and closure allocation in ConnectHelper.  Also reduced the size of the EstablishSslConnectionAsync state machine by splitting the method in order to remove several arguments from being included.

- Use Utf8Formatter for hex values.  Switched from custom formatting of hex values to just use Utf8Formatter.TryFormat.

- Avoid buffering in HttpConnection.CopyToAsync(Stream).  This is used when we want to copy the whole source stream until EOF (e.g. for a Connection: close response), and thus we can skip the buffer and use the source stream's CopyToAsync directly.

- Added a test to exercise various size chunks, line endings, ReadAsync vs CopyToAsync, etc.

- Fix CopyToAsync cancellation handling.  Even though we'll abort the connection when cancellation is requested, we still need to pass the token to the destination stream's WriteAsync to give it the opportunity to cancel.  Also properly pass the buffer size through to the underlying stream's CopyToAsync where appropriate.

- Small miscellaneous cleanup, like removing a few unused arguments from methods, fixing an assert to validate the right thing, etc.

* Address PR feedback

* Fix test on netfx


Commit migrated from https://github.com/dotnet/corefx/commit/d5351fe933f0f4682ac465b656b2a438b076c24e
2018-02-20 20:54:16 -05:00
Stephen Toub eac46c0cce Expose SocketsHttpHandler.ConnectTimeout/Expect100ContinueTimeout (dotnet/corefx#27292)
Commit migrated from https://github.com/dotnet/corefx/commit/3b2d39593672a7f49946e453a42cfae62f2ac88f
2018-02-20 18:30:34 -05: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
Stephen Toub a471023af9 Increase timeout on ConnectTimeout_TimesOutSSLAuth_Throws test (dotnet/corefx#27294)
Hopefully fixes dotnet/corefx#27291.  If it fails again, we'll need to look for a deeper reason than just CI hammering the server and causing things to take longer.

Commit migrated from https://github.com/dotnet/corefx/commit/7c3caab0801dc1542ab21c79fab2194a525c952f
2018-02-20 16:05:47 -05:00
Tomas Weinfurt 220c12eeac use TestHelper.AllowAllCertificates for validation callback to pass test netfx
Commit migrated from https://github.com/dotnet/corefx/commit/df7eaef7f46fad8520c9ee7273b06eada2f6bdf6
2018-02-20 13:04:40 -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 a9426f88e7 update tests
Commit migrated from https://github.com/dotnet/corefx/commit/12d26820d9f85c6a64a6d753956bb41a32705056
2018-02-20 10:48:10 -08:00
Geoff Kizer 1ff27f16dd SocketsHttpHandler: Don't reuse connection with extraneous received data (dotnet/corefx#27265)
* don't reuse connection with extraneous received data

* add tracking issue


Commit migrated from https://github.com/dotnet/corefx/commit/5a57de7524fa3c3a2ba2b4f643f30464f917e14f
2018-02-20 08:20:20 -05: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
Geoff Kizer b17b24ae2d Merge pull request dotnet/corefx#27255 from geoffkizer/fixcl
SocketsHttpHandler: remove Content-Length header if Transfer-Encoding: chunked is present

Commit migrated from https://github.com/dotnet/corefx/commit/f9853fafb6e49c1c6e94f8c3130af9da4a1574a2
2018-02-19 22:07:37 -08:00
Geoff Kizer 98ff22b12c modify test to work around CL population issue
Commit migrated from https://github.com/dotnet/corefx/commit/ff5318905c9134d5fbf87b6597f72d331bc9a029
2018-02-19 11:28:15 -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
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
Tomas Weinfurt c305ca00a4 fix SocketsHttpHandlerTest
Commit migrated from https://github.com/dotnet/corefx/commit/1ca7de15f13548c260b1b798074571e53c23dfab
2018-02-16 14:40:53 -08: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
Tomas Weinfurt c02a6afe8e take feedback from review
Commit migrated from https://github.com/dotnet/corefx/commit/37847dc5866a361d886bc9e1d0ea2b4a36fd5a31
2018-02-16 14:38:42 -08:00
Tomas Weinfurt a9f3f5b3c1 rebase with current master. update based on PR feedabck
Commit migrated from https://github.com/dotnet/corefx/commit/93e568488390af8903b2984cc50cffae9de5f67b
2018-02-16 14:20:58 -08:00
Lakshmi Priya Sekar 130436c7f3 More test fixes from CI.
Commit migrated from https://github.com/dotnet/corefx/commit/3fe39953a3213f60110e319cef869958a9638c49
2018-02-16 11:24:15 -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
Max Kerr cd85b45b2d Modify StreamContent to use default CopyToAsync buffer size when no size is provided (dotnet/corefx#27176)
* Add a tentative fix

* Minor fixes.

* Remove unused default value.

* Re-order error checks for compatibility reasons.

* Add a test to pin exception behavior when both parameters are incorrect.


Commit migrated from https://github.com/dotnet/corefx/commit/c28fbce3ce31cc0274b14e6e4ae08a84ec04ed1b
2018-02-16 07:18:59 -05:00
Lakshmi Priya Sekar 086a261943 More test fixes from CI runs.
Commit migrated from https://github.com/dotnet/corefx/commit/29374f83897d19995b640c1d663e68dfb9fb1058
2018-02-15 16:59:26 -08:00
Tomas Weinfurt 25ea6021dc take feedback from review
Commit migrated from https://github.com/dotnet/corefx/commit/009a855ef809128cc3824b2a1f06a5e89cb867d0
2018-02-15 16:30:52 -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
Stephen Toub 96239ef682 Streamline SocketHttpHandler's ParseStatusLine validation (dotnet/corefx#27163)
* Streamline SocketHttpHandler's ParseStatusLine validation

For a typical status line like "HTTP/1.1 200 OK", cuts the time of ParseStatusLine almost in half.

* Address PR feedback


Commit migrated from https://github.com/dotnet/corefx/commit/c8d23b4941b3b620633db397a0094f55b01be22b
2018-02-15 16:04:40 -05:00
Stephen Toub b47f6bd40f Fix race condition in PostAsyncExpect100Continue_RetryOnConnectionClosed_Success test (dotnet/corefx#27148)
Commit migrated from https://github.com/dotnet/corefx/commit/28799e8af0556efe1b9e5e98b700460951ae9eb2
2018-02-15 14:59:30 -05:00
Tomas Weinfurt 5d8c6a618a disable two tests on ubuntu 18 while investigating root casue (dotnet/corefx#27144)
Commit migrated from https://github.com/dotnet/corefx/commit/d00eb7ec42434b0a7e2c3b4f6cd88c896ebaa30f
2018-02-15 05:47:50 -05:00
Lakshmi Priya Sekar 4fc5a16b79 Mark failing tests with issue.
Commit migrated from https://github.com/dotnet/corefx/commit/828468a258cfba872c84c3976835e9c664f68dee
2018-02-14 17:24:03 -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