Commit Graph
332 Commits
Author SHA1 Message Date
Stephen Toub eb1d4e0d0a Add another test
This simply posts to a location that will redirect, with several hundred K of data in the request body. It reliably fails for me before the change and reliably succeeds after.


Commit migrated from https://github.com/dotnet/corefx/commit/a97d15faa7d90bae430ae920a251c23010869a22
2016-06-09 13:39:31 -04:00
Stephen Toub 3d6037f313 Change how request content is read in libcurl
libcurl wants to be able to call back to CurlHandler at arbitrary times to ask it to seek in the request content stream.  This can happen for redirects, for auth challenges, etc.  Handling this has been a challenge due to the way HttpContent is designed.

HttpContent provides two modes for accessing the data via Streams:
- Push: You call CopyToAsync(Stream, TransportContext) to have the data from the HttpContent copied into the target stream.
- Pull: You call ReadAsStreamAsync to get a stream that represents the data in the HttpContent, and you can read from that.

The pull model is ideal for libcurl.  It allows us to get a stream which we can jump around in if it's seekable, and we can request a new stream if it's not seekable. The push model is challenging, as we're forced to put in plcae an intermediary, a push-pull adapter that let's us effectively read from a type that's trying to write to us.

There is however an issue with the pull model.  With the push model, StreamContent's CopyToAsync tracks whether the stream has already been accessed, and if it has and if it's non-seekable, trying to call CopyToAsync again throws to alert you that rewinding simply isn't possible.  The pull StreamContent's ReadAsStreamAsync, however, does not.  This means that if you get a non-seekable stream and you call ReadAsStreamAsync again, you get back the same stream (or, rather, a read-only wrapper around the same stream) that is at the existing position rather than the original position.  Then resending that content will end up sending less data than it should have, resulting in failure, just not abruptly.

That issue caused us to go down the path of the more challenging push model and trying to use CopyToAsync.  However, recently that's been shown to have even worse effects.  We don't have the ability to cancel CopyToAsync, which means that if the first copy is still in-flight when we try to seek, we have no choice but to fail, even if the stream is actually seekable, as most are (e.g. memory streams, file streams, etc.)  This can happen deterministically in cases where libcurl decides to redirect before it's fully sent the request content, but it's also prone to race conditions even for cases where the request content is fully sent but the copy hasn't been officially marked as complete by the time libcurl tries to redirect.   ASP.NET recently began hitting this frequently on some machines in their lab runs.

While there's no perfect solution, the best solution is to go with the one that's the simplest code, the fastest code, and the deterministic outcome: the pull model.  This commit deletes a whole bunch of code that was there in support of the push model, adds just a bit of code to enable the pull model, and fixes up a couple of tests that were written to expect the push model.


Commit migrated from https://github.com/dotnet/corefx/commit/74cd3d619b3d3b1e963ca8bd33749af3aec99c05
2016-06-09 10:18:19 -04:00
dotnet-bot 2e6b9dc990 Updating CoreFx dependencies to rc4-24208-04
Commit migrated from https://github.com/dotnet/corefx/commit/02515a1ace7d60e2b8b63c4b80427b0a1275503c
2016-06-08 18:43:01 +00:00
Wes Haggard cd52f14fb9 Merge pull request dotnet/corefx#9233 from chcosta/nethttp_repro
Remove keepallprojectreferences from system.net.http and system.net.security tests

Commit migrated from https://github.com/dotnet/corefx/commit/fc88bf49cf8cdaa6c5484b3e19f8f17cccd50fbb
2016-06-07 23:04:01 -07:00
Stephen Toub 2cbd59ef6f Merge pull request dotnet/corefx#9208 from stephentoub/fix_header_parsing
Allow whitespace after HTTP response header name

Commit migrated from https://github.com/dotnet/corefx/commit/ca0075eda676f9a35f43a0c6994fc08c0b1981b3
2016-06-07 13:19:37 -04:00
Christopher Costa 80bca9a4b4 Remove keepallprojectreferences
Commit migrated from https://github.com/dotnet/corefx/commit/25d4dbf46ed63abd4ff96a8f855f21c4420ae597
2016-06-07 10:15:34 -07:00
Stephen Toub 2f0636a244 Allow whitespace after HTTP response header name
Be a bit more lenient in what we allow in the formatting of response headers on Unix. The RFC states that "Each header field consists of a case-insensitive field name followed by a colon (":"), optional leading whitespace, the field value, and optional trailing whitespace." However, whitespace between the header name and the colon is accepted by WinHttpHandler, by the .NET Framework, and by all browsers on which I tried it, and servers can easily include such whitespace; if they do and we're not tolerant of it, requests to such servers will fail.


Commit migrated from https://github.com/dotnet/corefx/commit/888a01cbcb1a98377ebf6e87e89a2551aac1654d
2016-06-07 09:38:20 -04:00
dotnet-bot 349036ec6b Updating CoreFx dependencies to rc4-24207-03
Commit migrated from https://github.com/dotnet/corefx/commit/dbc9db2a3378417434c4fb9e531a788d14eb9621
2016-06-07 13:21:03 +00:00
dotnet-bot 19fa55e533 Updating CoreFx dependencies to rc4-24207-02
Commit migrated from https://github.com/dotnet/corefx/commit/1ad197d9386e4d5dcd6e2bfdc5ed753a0f965893
2016-06-07 07:19:35 +00:00
dotnet-bot 5d49d2be32 Updating CoreFx dependencies to rc4-24206-03
Commit migrated from https://github.com/dotnet/corefx/commit/684a9a1dbe3c467e170c50eff84ff09dbd964b9b
2016-06-06 13:11:57 +00:00
dotnet-bot 8e078b77e7 Updating CoreFx dependencies to rc4-24206-02
Commit migrated from https://github.com/dotnet/corefx/commit/c1bffac7c759702cadd48ae3fb883a5ef38f3275
2016-06-06 07:05:37 +00:00
dotnet-bot 9b556b2ad6 Updating CoreFx dependencies to rc4-24205-04
Commit migrated from https://github.com/dotnet/corefx/commit/130fb7ad9c1f44fa54488a287a4a835567910dc0
2016-06-05 19:06:03 +00:00
dotnet-bot 53b5786639 Updating CoreFx dependencies to rc4-24205-03
Commit migrated from https://github.com/dotnet/corefx/commit/2ac2a1abf6edc0409e0398fa907b67a658a9812c
2016-06-05 13:11:27 +00:00
dotnet-bot 1a2c5d511a Updating CoreFx dependencies to rc4-24205-02
Commit migrated from https://github.com/dotnet/corefx/commit/f543d6c01894f2ce22c46ce2f9e8e97adb7d751e
2016-06-05 07:06:42 +00:00
dotnet-bot 832c793afe Updating CoreFx dependencies to rc4-24205-01
Commit migrated from https://github.com/dotnet/corefx/commit/4638fa6cffdc05bf0efdb528b6d9e9bca1d9290d
2016-06-05 01:09:11 +00:00
dotnet-bot 44203d6255 Updating CoreFx dependencies to rc4-24204-04
Commit migrated from https://github.com/dotnet/corefx/commit/7565dc2368d20db4fd77e9b55ace3305488ed546
2016-06-04 19:07:36 +00:00
dotnet-bot bde86715af Updating CoreFx dependencies to rc4-24204-03
Commit migrated from https://github.com/dotnet/corefx/commit/3a11ec14d8aa9c33bd5fc84a81d748766c756146
2016-06-04 13:05:27 +00:00
Stephen Toub 05c80e923c Merge pull request dotnet/corefx#9109 from stephentoub/clientcert_tests
Add some HttpClientHandler client certificate tests

Commit migrated from https://github.com/dotnet/corefx/commit/a25394ed35d6484f50a063a622fa52df1553d1f0
2016-06-04 05:55:29 -04:00
Stephen Toub 9a11ee5651 Merge pull request dotnet/corefx#9140 from stephentoub/revert9102
Revert "Flow HttpClient timeouts and cancellation to the response stream"

Commit migrated from https://github.com/dotnet/corefx/commit/62d0ddefab515489010ae1464d712348b9d053a1
2016-06-04 05:55:14 -04:00
Stephen Toub 9ec85d26d0 Revert "Flow HttpClient timeouts and cancellation to the response stream"
This reverts the product changes from commit dotnet/corefx@cc8b48c8ea.  The test changes remain.


Commit migrated from https://github.com/dotnet/corefx/commit/ef6b3490bb2d376d42eeddbc4db45414a23c7804
2016-06-03 21:33:31 -04:00
Stephen Toub 00f486042d Fix HttpClientMiniStressTests tests
These were broken at some point (almost all of the tests fail, complaining about invalid responses from the server), but we didn't notice because they're not enabled by default.


Commit migrated from https://github.com/dotnet/corefx/commit/ef77613d8732beab380b058368bb7bcf2cc54369
2016-06-03 15:42:48 -04:00
Stephen Toub 1d23722d72 Merge pull request dotnet/corefx#9102 from stephentoub/slowread_windows_cancellation
Flow HttpClient timeouts and cancellation to the response stream

Commit migrated from https://github.com/dotnet/corefx/commit/3eb2e11d028a8b9e9e861cd595235a314c7a2560
2016-06-03 13:10:47 -04:00
Stephen Toub ea6cd05418 Add some HttpClientHandler client certificate tests
And fix a small bug discovered from this, lack of argument validation when setting the enum value.


Commit migrated from https://github.com/dotnet/corefx/commit/483aa5a3012fe78ea001ece1b0404b18c0b90a29
2016-06-03 13:09:23 -04:00
dotnet-bot bbbd91a21c Updating CoreFx dependencies to rc4-24203-06
Commit migrated from https://github.com/dotnet/corefx/commit/fa054f7d8012b5361b4614d1b2e5912291a8d6da
2016-06-03 13:06:55 +00:00
Stephen Toub b1895678eb Flow HttpClient timeouts and cancellation to the response stream
When using a timeout and/or a cancellation token with a buffered HttpClient operation, the cancellation/timeout doesn't flow through to the actual read/write operations on the underlying streams.  This means that on Windows, doing a basic operation like GetStringAsync with a server that pauses for arbitrarily long periods of time while sending the response body won't cancel or timeout until it sends more data. (We don't need to do this on Unix, as on Unix we already handle this case differently, with a single registration for the duration of the SendAsync operation.)


Commit migrated from https://github.com/dotnet/corefx/commit/cc8b48c8ea41b9cee888055483d16072f3f3a1c5
2016-06-03 07:12:28 -04:00
dotnet-bot c4da362b9c Updating CoreFx dependencies to rc4-24203-05
Commit migrated from https://github.com/dotnet/corefx/commit/18ace4063860ae0db9ff303f14609368719fa8f5
2016-06-03 07:10:21 +00:00
Davis Goodin 1418be0568 Upgrade CoreFX version to rc4-24201-04 from the build pipeline.
Commit migrated from https://github.com/dotnet/corefx/commit/7ce67d490263f936fd093b70e41a010d9be6a970
2016-06-01 13:53:46 -05:00
Stephen Toub 4077430754 Merge pull request dotnet/corefx#9024 from stephentoub/http_sendasync_tests
Add several HttpClientHandler tests related to content

Commit migrated from https://github.com/dotnet/corefx/commit/cdba60ecba957272a77ccc8245ab6ba29535380b
2016-06-01 14:19:34 -04:00
Stephen Toub ad4e7cb1ab Fix CurlHandler handling of redirects (dotnet/corefx#8946)
* Fix CurlHandler handling of redirects

- Relative urls in Location headers were not being handled correctly.  We now allow any url that TryCreate will parse using the current url as a base.
- We were only handling a subset of redirect status codes as redirects, trying to second-guess which status codes libcurl would redirect for, e.g. 300 wasn't being treated as a redirect. We now let libcurl do all the work.
- We should have been playing it safer with regards to clearing out credentials if we weren't sure a Uri redirect location was valid. Now we do.
- We were tracking state unnecessarily that we should have instead been
  asking libcurl for, e.g. the last url used in a redirect.  This also caused us to store the wrong RequestMessage.Uri in some cases where a location header came in but we didn't actually follow it.

Commit migrated from https://github.com/dotnet/corefx/commit/7bd18d682f0e201275c988e6263239ab84f6389b
2016-06-01 08:41:23 -04:00
Stephen Toub 3f7c097a58 Add several HttpClientHandler tests related to content
- Verify that request content isn't disposed until after response content is buffered
- Verify that request content isn't disposed until after request content is sent and response headers are received
- Verify that verbs which shouldn't send request content don't


Commit migrated from https://github.com/dotnet/corefx/commit/9c0eaa1b7a4812f50ac37f4adde516971d9b333a
2016-06-01 08:38:58 -04:00
Matt Ellis 94c58f546c Use correct openSUSE RID
When I added the rid, I forgot to append the -x64 part, which prevented
the openSUSE build from restoring a runtime, since that part is platform
specific.


Commit migrated from https://github.com/dotnet/corefx/commit/d02e47ec2d44fae9d45d29d49f356199ed59b406
2016-05-31 17:52:15 -07:00
Stephen Toub f9fc17df13 Remove innerloop dependencies on www.ssllabs.com
We have several innerloop tests that make HTTP calls during System.Net.Http.Functional.Tests out to www.ssllabs.com, which has SSL endpoints for different SSL protocols.  This commit avoids using that server during innerloop tests.  The tests are moved to outerloop, and some replacements using a localhost are added to innerloop.


Commit migrated from https://github.com/dotnet/corefx/commit/8a9402b33d46166d1a3129a7c2cae0334b00c4b6
2016-05-31 17:05:10 -04:00
dotnet-bot cfde5f8d34 Updating CoreFX dependencies to rc4-24131-00
Commit migrated from https://github.com/dotnet/corefx/commit/7a16fac72dca8b3442e4425896593a0d24fd0fd2
2016-05-31 06:57:39 +00:00
Stephen Toub 2424c43e44 Improve tracing in CurlHandler
While debugging some HttpClient issues, I needed more tracing in CurlHandler.  It's useful to check this in to help with future investigations.


Commit migrated from https://github.com/dotnet/corefx/commit/48da5807ac281c26b34ac375755a4d83b2268a91
2016-05-27 13:19:45 -04:00
dotnet-bot f0fa9faf0b Updating CoreFX dependencies to rc4-24127-00
Commit migrated from https://github.com/dotnet/corefx/commit/9f0469d8011336f7bf60365b017dcbe7df537dc0
2016-05-27 06:49:24 +00:00
Matt Ellis 1c7fd4103c Add additonal runtimes
Commit migrated from https://github.com/dotnet/corefx/commit/3ce0367e0f62cdd71aa4368abca30658b315079d
2016-05-25 23:23:02 -07:00
dotnet-bot 91d532f5fc Updating CoreFX dependencies to rc4-24126-00
Commit migrated from https://github.com/dotnet/corefx/commit/1a374cac6178651a21298020b2b3d6eb897d1837
2016-05-26 05:46:42 +00:00
dotnet-bot 032dea8c8b Updating CoreFX dependencies to rc4-24125-00
Commit migrated from https://github.com/dotnet/corefx/commit/9cd447dda0dfa473fb814dd6a3a1504764fa7bf4
2016-05-25 13:52:14 -07:00
Eric StJohn 64dd1b53f2 Merge pull request dotnet/corefx#8838 from ericstj/test-netstandardapp1.0
Test netstandardapp1.0

Commit migrated from https://github.com/dotnet/corefx/commit/673e8307ec8811ce85c3f17cc5375a468a2fb152
2016-05-25 06:12:55 -07:00
Eric St. John 5a444416fd Update tests to use NETCoreApp1.0 moniker
Requires https://github.com/dotnet/buildtools/pull/751

This makes all the tests resolve using NETCoreApp1.0 instead of
DNXCore50.  I've removed the netstandard1.6 import since that is no
longer needed.  I've also removed the workarounds from tests that were
targeting netcoreapp1.0 on their own.  For restore compat I've added an
DNXCore50 import to every test project.  These can be removed once
test-runtime packages are updated to target NETCoreApp1.0.

I've updated all the test scripts which were assuming DNXCore50 as well
as docs which referred to this path.


Commit migrated from https://github.com/dotnet/corefx/commit/7ba4d296e3e0a2445ffa708c1e918d90d2bac69c
2016-05-24 21:49:17 -07:00
Cristian Pop 51e3b454ee Fixing integration error within Http tests.
Commit migrated from https://github.com/dotnet/corefx/commit/41f9406775c62f1635b57ed72e3693b743905c49
2016-05-24 17:01:15 -07:00
dotnet-bot 52a5140af7 Use SchSendAuxRecord in SslStream on Windows.
[tfs-changeset: 1607766]


Commit migrated from https://github.com/dotnet/corefx/commit/91f1698b5139a0f618c0248e384c32d9bbe291c5
2016-05-24 17:01:01 -07:00
David Shulman 7bd12ef540 Merge pull request dotnet/corefx#8693 from davidsh/responsestream_cancelread
Fix cancellation of WinHttpHandler response stream reads

Commit migrated from https://github.com/dotnet/corefx/commit/7a55665dd4f068e5bce748107b6a53fcb5e5c14c
2016-05-19 18:39:33 -07:00
David Shulman 107ed2e91a Address PR feedback 2
Commit migrated from https://github.com/dotnet/corefx/commit/11942a384a06fbce76a04e445fd8c42cf4224589
2016-05-19 12:46:35 -07:00
David Shulman 87cf76acf3 Fix cancellation of WinHttpHandler response stream reads
Reading from the response stream using ReadAsync() was ignoring the cancellation token passed in. To fix this, registered a delegate that will be called to dispose the WinHTTP request handle during pending I/O. This will cause the WinHTTP operation to cancel.

Added tests. For now, left them disabled to be resolved in issue dotnet/corefx#8692 next week. But wanted to get this fix in asap since it blocks partners for RTM.

Fixes dotnet/corefx#8662.


Commit migrated from https://github.com/dotnet/corefx/commit/a6e019d8e1910b9fed3c1077be23bfd9023d2837
2016-05-19 10:12:09 -07:00
Matt Ellis e80c1f6794 Remove debian.8.2-x64 rid from projects
debian.8-x64 is the correct rid for debian and CI no longer uses it.


Commit migrated from https://github.com/dotnet/corefx/commit/8eba099f188af464e5e4ef8cd1b75ec53b137918
2016-05-17 19:22:33 -07:00
dotnet-bot 3aa5dbf336 Updating CoreFX dependencies to rc3-24117-00
Commit migrated from https://github.com/dotnet/corefx/commit/976b88889266258325f501e443b5bda6200cd3cc
2016-05-17 16:57:43 -04:00
bartonjs e2af1bb6c4 Clear the libcrypto error queue before doing SSL/TLS operations.
If an SSL operation fails, we call SSL_get_error to determine how to proceed.
SSL_get_error's logic is, essentially
  libcrypto_error ?? WANT_READ ?? WANT_WRITE ?? WANT_X509 ?? panic

This means that if a previous call into libcrypto on the same thread had left
something in the error queue when the operation goes into the WANT_READ state (etc)
SSL_get_error will report that the request must have failed due to something in
libcrypto.

There are two different fixes being done here:
1) PKCS12_parse is a known contributor to this problem, clear out the queue on a
successful exit.
2) Before any SSL stream operation (handshake, read, write, shutdown) clear the
queue, in case there are other functions which are leaving dangling errors.

With those mitigations in place, the intermittent errors seen during SslStream
usage should hopefully be a thing of the past.


Commit migrated from https://github.com/dotnet/corefx/commit/80a53ed415ece115d15bcf519e81e600362fd3dc
2016-05-17 09:09:53 -07:00
Matt Ellis 4c035bad61 Merge pull request dotnet/corefx#8544 from ellismg/add-rids
Add additional runtimes

Commit migrated from https://github.com/dotnet/corefx/commit/fc5926e933371c755094c1c68f7cd39b73ae727c
2016-05-16 11:22:54 -07:00
David Shulman f94d450d1a Merge pull request dotnet/corefx#8553 from davidsh/defaultauth_fix
Fix WinHttpHandler default cred auth when server offers multiple schemes

Commit migrated from https://github.com/dotnet/corefx/commit/7e87430a5ee2f747e028829903bb1d8e5ecd967d
2016-05-16 08:56:44 -07:00