Commit Graph
1559 Commits
Author SHA1 Message Date
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
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
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 00c926a26f rework content length logic to drain buffer before doing length check
Commit migrated from https://github.com/dotnet/corefx/commit/3584bdbfd21c0f4b02bffe1170febb2e6fa9c0ad
2018-02-21 14:38:05 -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
Geoff Kizer 54e5345381 split auth and redirect handling back into two separate handlers
Commit migrated from https://github.com/dotnet/corefx/commit/e8a17715fba4ba6cfce4043a2cd117474dfcee05
2018-02-20 15:28:04 -08:00
Max Kerr 5953018eb9 Log when an insecure Https -> Http redirect is blocked (dotnet/corefx#27077)
.NET Core does not allow insecure redirects from https to http, but .NET Framework does. Developers have had some trouble diagnosing the issue when they run into this difference. This change adds logging to help developers track down what is going on.

Commit migrated from https://github.com/dotnet/corefx/commit/1fd7d79fc36ca113bdabbee4204e15ae5bcde24a
2018-02-20 14:31:16 -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 f063879da7 remove CL if TE present
Commit migrated from https://github.com/dotnet/corefx/commit/f9c486d14ec01e98b9e73b4eb23f729783678e3c
2018-02-19 11:32:24 -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 beeb9c867f use HttpStatusCode.OK instead of cast to (int)200
Commit migrated from https://github.com/dotnet/corefx/commit/a4dc9e33be825cf740f23faef4605728652b1529
2018-02-16 14:38:42 -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 327b687cbf address some comments from reviews. more to come. loopback tests still needs some work.
Commit migrated from https://github.com/dotnet/corefx/commit/70bbb82db3e18ec702c24d9f2d94b5688373b34b
2018-02-16 14:38:42 -08:00
Tomas Weinfurt 54abced281 initial connect support
Commit migrated from https://github.com/dotnet/corefx/commit/62988ad5f337a08b1fb2937b245333b8d313d6cd
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 95c2db6208 use HttpStatusCode.OK instead of cast to (int)200
Commit migrated from https://github.com/dotnet/corefx/commit/db8d62691f619841fbc46ebbbefe48fbc3f2a4aa
2018-02-15 16:30:52 -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
Tomas Weinfurt aefcab1eaf address some comments from reviews. more to come. loopback tests still needs some work.
Commit migrated from https://github.com/dotnet/corefx/commit/36c8886b4c2526b4d9f11310a1a2dbd4aa991194
2018-02-15 16:28:20 -08:00
Tomas Weinfurt eba42b5b4e initial connect support
Commit migrated from https://github.com/dotnet/corefx/commit/6865bc83d06b632a326d4d60dc3cfc7ad4177c37
2018-02-15 16:10:09 -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
Geoff Kizer ea61dedad9 Merge pull request dotnet/corefx#27151 from geoffkizer/sslproxytunnel
SocketsHttpHandler: refactor pool manager logic to enable SSL proxy tunneling support

Commit migrated from https://github.com/dotnet/corefx/commit/6e3bcbec17273cd38db67e47e7a2975a25160ac2
2018-02-15 13:39:32 -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
Geoff Kizer ab1edffdc0 address review feedback
Commit migrated from https://github.com/dotnet/corefx/commit/46785d3ae61987ae8ae389b2138645e82b54efb0
2018-02-15 10:55:32 -08: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
Geoff Kizer 76301c7104 add code to establish proxy tunnel for SSL
Commit migrated from https://github.com/dotnet/corefx/commit/d84a28844502bcf30538a18e30e33118ca879467
2018-02-14 18:43:15 -08:00