Commit Graph
518 Commits
Author SHA1 Message Date
Stephen Toub 76fe11578e Merge pull request dotnet/corefx#8521 from stephentoub/curlhandler_sslprotocols
Change CurlHandler.SslProtocols default

Commit migrated from https://github.com/dotnet/corefx/commit/0953751fb947b5a826b2fc5f3a1350c73c9f92cd
2016-05-14 18:40:43 -04:00
stephentoub c43ac8a969 Change CurlHandler.SslProtocols default
Same change as https://github.com/dotnet/corefx/pull/8518, but for CurlHandler.


Commit migrated from https://github.com/dotnet/corefx/commit/3b8756c8b966f93afbe01f24e50794587ef465c9
2016-05-13 19:55:32 -04:00
chcosta a33dd88be4 Disable system.net.http.functiona.tests and system.net.security.functional.tests from projectreference->package dependency conversion. (dotnet/corefx#8505)
Commit migrated from https://github.com/dotnet/corefx/commit/e63e09b758daca6f16d62fa82f40608d18030aa0
2016-05-13 15:11:21 -07:00
Stephen Toub 5a92862423 Merge pull request dotnet/corefx#8500 from dotnet-bot/UpdateDependencies20160513035055
Updating CoreFX dependencies to rc3-24113-00

Commit migrated from https://github.com/dotnet/corefx/commit/d0fdc093a18858e12e4c13617b5643c4e4ea9d47
2016-05-13 16:25:48 -04:00
David Shulman f0d46aef79 Remove WinHttpHandler.ConnectTimeout property
It turns out that setting the WinHTTP 'Connect' timeout does nothing. We discovered this because we still got ERROR_WINHTTP_TIMEOUT errors after about 20 seconds even after setting the 'Connect' timeout to INFINITE. We discussed this with the WinHTTP team and they told us that this timeout is essentially deprecated due to performance enhancements in the TCP stack.

For the technically curious, here is the explanation. Underneath the 'Connect' timeout is really a set of TCP timeouts related to setting up the socket via the 3-leg SYN/ACK exchange. The TCP timeout is about retransmits with backoff and how many is tried by the winsock stack. The default of these initial packet exchanges is 21 seconds with 2 retransmits (3 overall SYNs) and initial RTO of 3 (3 + 6 + 12). So that explained the timeouts we saw during periods of high network congestion.

There is no API exposed in WinHTTP to control those low-level TCP timeouts. And thus it doesn't make any sense to have a 'ConnectTimeout' on the WinHttpHandler class.


Commit migrated from https://github.com/dotnet/corefx/commit/ee0b3a76c8c57ef80d1d53a16deb5b0bc6b46793
2016-05-13 09:40:39 -07:00
dotnet-bot 8e00f7db31 Updating CoreFX dependencies to rc3-24113-00
Commit migrated from https://github.com/dotnet/corefx/commit/4a1e90e8a33c423e5356e9850b834cbfa24bfde7
2016-05-13 15:50:55 +00:00
stephentoub 095291bb48 Remove CurlHandler.ConnectTimeout property
I'd added this when bringing properties from WinHttpHandler to CurlHandler in bulk, with the expectation that we might expose them.  Since we're not planning on exposing this particular property from HttpClientHandler (turns out it's not very useful in practice), I'm removing it.


Commit migrated from https://github.com/dotnet/corefx/commit/953bbe0006ce7f29c87b798eb10d072df06d6f99
2016-05-13 07:46:47 -04:00
David Shulman 6489f6d1c9 Add configurable test settings for Http and WebSocket tests (dotnet/corefx#8480)
Building on the current use of environment variables for passing in test settings, added a common test helper class to allow the http and websocket tests to access alternate test servers. This will help with load balancing and network latency issues which are causing occasional timeouts in CI tests. This will also allow developers to run their own version of the Azure test endpoints. Consolidated the current environment variables used and standardized on a naming format.

Fixes dotnet/corefx#2383.

Commit migrated from https://github.com/dotnet/corefx/commit/3603ed2578220f0ecb2f101324e04acb80fa3196
2016-05-12 14:57:03 -07:00
stephentoub 514492a454 Don't cancel all requests when HttpClient disposed on Unix
On Unix when an HttpClientHandler is disposed, we cancel all outstanding operations associated with that handler.  It turns out this isn't the desired behavior (aka the behavior of WinHttpHandler), which is that we should cancel all outstanding operations that haven't yet published its HttpResponseMessage, but for requests where the HttpResponseMessage has been published, it should remain valid.

This commit tweaks the behavior accordingly and adds a test for it.


Commit migrated from https://github.com/dotnet/corefx/commit/f949d92b3ee26168277f56fbd2c6686505ea0b4a
2016-05-12 14:27:51 -04:00
stephentoub 08c45ba7b8 Address PR feedback
Commit migrated from https://github.com/dotnet/corefx/commit/10c8af5ebedaf1db4a2a7efeac58518df362cbdf
2016-05-12 06:11:28 -04:00
stephentoub 31eddcd4ce Add HttpClient test with IPv6 Uris
Adds support to the loopback server for binding to IPv6 local addresses, then adds a test that uses both ::1 and a link-local address for the current machine.


Commit migrated from https://github.com/dotnet/corefx/commit/a00e71b22fecbf9e2da3205e2e56bdb46773cbc2
2016-05-12 06:11:28 -04:00
dotnet-bot ce3a923ef2 Updating CoreFX dependencies to rc3-24112-00
Commit migrated from https://github.com/dotnet/corefx/commit/388140d1885acee4019544e4b9f8ccb6dd4310d6
2016-05-12 05:51:26 +00:00
stephentoub 5ffbace49b Fix HttpClient test hanging on single core
One of the HttpClient client tests hangs on a machine with a single core.
xunit by default uses a SynchronizationContext that has N threads to do
work, where N defaults to Environment.ProcessorCount.  Thus on a single
core machine, there's only one thread available to run tests, and if that
thread blocks waiting for an async operation that'll schedule work back to
that context, it'll deadlock.


Commit migrated from https://github.com/dotnet/corefx/commit/916798757c122b81e61666c4f0af0c446d378824
2016-05-11 15:05:14 -04:00
Stephen Toub 7f4f44ca46 Merge pull request dotnet/corefx#8443 from stephentoub/linklocal_more
Allow CurlHandler to work with link-local Uris on older libcurls

Commit migrated from https://github.com/dotnet/corefx/commit/0de19d567561a6955ad9f2b59e784a742e13826e
2016-05-11 13:55:40 -04:00
David Shulman 71f781e3c2 Improve WinHttpHandler logic regarding default credentials (dotnet/corefx#8434)
* Improve WinHttpHandler logic regarding default credentials

In some cases, WinHttpHandler was not sending default credentials that were specified inside a custom ICredentials object. In other cases, default credentials would be sent even though CredentialCache.DefaultCredentials was not specified. The code was incorrectly comparing the proxy and server credential (ICredential interface) values against the DefaultCredentials object. Instead, the ICredentials.GetCredential() method should be called to compute the final NetworkCredential object. This takes into account the given uri and auth scheme.

This PR fixes the logic by delay the setting in WinHTTP for releasing default credentials. This ensures that default crdentials are released when requested.

Fixes dotnet/corefx#8176.

* Address PR feedback

Reword comments for clarity.
Add TODO issue.
Sending default creds to proxy only needs MEDIUM security policy.


Commit migrated from https://github.com/dotnet/corefx/commit/90b8ff36c8c9f9cfb1a2cf1302ff7a98ac7801ed
2016-05-11 07:01:41 -07:00
stephentoub bb56a66ba5 Updating CoreFX dependencies to rc3-24111-00
Commit migrated from https://github.com/dotnet/corefx/commit/3b49a7960613e27f89538a53a893a0f8fbb74593
2016-05-11 06:47:29 -04:00
Stephen Toub 0852be942c Merge pull request dotnet/corefx#8442 from dotnet-bot/UpdateDependencies20160511120846
Updating CoreFX dependencies to rc3-24110-00

Commit migrated from https://github.com/dotnet/corefx/commit/44dd3f7a997f560d05e7d43b773b63dd756ac51a
2016-05-11 06:18:49 -04:00
stephentoub ac19b4db8b Disable two recently added tests
These were both added in the last few days and have both failed in CI at least once.


Commit migrated from https://github.com/dotnet/corefx/commit/e3f64a9c8f3869f3db1bdc7bac496e56b89334a6
2016-05-10 22:55:55 -04:00
stephentoub 01c2fc4c12 Allow CurlHandler to work with link-local Uris on older libcurls
libcurl v7.37 added support for parsing IPv6 uris with scope/zone IDs, but some of the Unix systems we target have an older libcurl.  Rather than just saying "use a newer libcurl", we can use libcurl's CURLOPT_ADDRESS_SCOPE to explicitly set the link-local scope ID when it's set, and allow such Uris to be used on older libcurls.


Commit migrated from https://github.com/dotnet/corefx/commit/0c9948a86d36963d92f7e53c8df18c150675c9b5
2016-05-10 20:45:22 -04:00
dotnet-bot bb2d7075e5 Updating CoreFX dependencies to rc3-24110-00
Commit migrated from https://github.com/dotnet/corefx/commit/2c092dd2f1ede076753ffee8342a4e04f919b89a
2016-05-11 00:08:46 +00:00
Stephen Toub 255d5a328b Merge pull request dotnet/corefx#8377 from stephentoub/ssl_loopback_server
Add SSL support to LoopbackServer in HTTP tests

Commit migrated from https://github.com/dotnet/corefx/commit/dbdae6947381db563b081fe7dbcf116ff9df36bc
2016-05-10 17:50:29 -04:00
stephentoub b8970ee51b Add SSL support to LoopbackServer in HTTP tests
We currently make a lot of calls off-box in our unit tests.  By adding SSL support to the loopback server, we should be able to convert many more tests to avoid needing to actually hit the network.  This adds such basic support, and converts a few tests to use it.

Also, since I was moving the certificate configuration code to a central location, I fixed an issue related to cleanup.


Commit migrated from https://github.com/dotnet/corefx/commit/b90795e1d5d7e8d8c68b9ca23d53b1ba0e392f46
2016-05-10 13:55:40 -04:00
Stephen Toub ffb02f22a2 Merge pull request dotnet/corefx#8249 from stephentoub/linklocal_url
Ensure CurlHandler includes IPv6 scope IDs in Urls when applicable

Commit migrated from https://github.com/dotnet/corefx/commit/06704c305d47abe4a5c5243a319414b139f772c2
2016-05-10 11:06:37 -04:00
stephentoub 4a28ad6e87 Ensure CurlHandler includes IPv6 scope IDs in Urls when applicable
Uri.AbsoluteUri omits the scope ID if present.  Switch to using GetComponents with SerializationInfoString.


Commit migrated from https://github.com/dotnet/corefx/commit/8f726b268db7f73486750fa8a9f15e912f857e73
2016-05-10 10:15:46 -04:00
stephentoub ce065a4145 Disable ConnectTimeoout test on Linux
It's failing on Ubuntu 16.04.  Something about the curl used in CI is likely wrong.


Commit migrated from https://github.com/dotnet/corefx/commit/2871273e752dfda09427fb627e590de29bff61a8
2016-05-10 06:42:08 -04:00
stephentoub 9a7efb22cf Disable BadCertificate test failing on Windows
Commit migrated from https://github.com/dotnet/corefx/commit/69652b53d1fa4d1a71bfe4271e22ededebd6c73b
2016-05-09 14:13:57 -04:00
dotnet-bot 9829ded094 Updating CoreFX dependencies to rc3-24109-00
Commit migrated from https://github.com/dotnet/corefx/commit/a0ae8adee8b9454180c3e1f9416f28964b6eccb3
2016-05-09 06:40:00 +00:00
Stephen Toub 2ba22663db Merge pull request dotnet/corefx#8363 from dotnet-bot/UpdateDependencies20160506101302
Updating CoreFX dependencies to rc3-24106-00

Commit migrated from https://github.com/dotnet/corefx/commit/6c257e74fff7cda64fc3a069572007f4b038e057
2016-05-08 20:28:38 -04:00
Stephen Toub 6b493b1bdf Merge pull request dotnet/corefx#8177 from stephentoub/avoid_queued_copytoasync
Avoid race condition between queued HttpContent.CopyToAsync and request completion

Commit migrated from https://github.com/dotnet/corefx/commit/118343b2e8cdadaecb90bf8563b19c4a9416cc6e
2016-05-07 00:15:04 -07:00
dotnet-bot 61320ea502 Updating CoreFX dependencies to rc3-24106-00
Commit migrated from https://github.com/dotnet/corefx/commit/22f53438e34b804d30f472ce6482db5e457bfee0
2016-05-06 22:26:49 -07:00
Eric St. John 8d9ac5084b Update Crypto.Algo references from 4.1 to 4.2
Commit migrated from https://github.com/dotnet/corefx/commit/a4cfd53211606c4b056498937e60a7e45de92c17
2016-05-05 18:29:38 -07:00
Eric St. John a813f99b7f Fix restore of Crypt.Algo dependencies from tests
Tests still target DNXCore50 which hasn't been updated to  support
NETStandard1.6.
Recent changes to the algorithms packaged the impl as 1.6.
Until the tests can be updated, import netstandard1.6 explicitly.


Commit migrated from https://github.com/dotnet/corefx/commit/7fdf8c87435b7ca190f2d611b799db88a4f8224a
2016-05-05 18:29:37 -07:00
dotnet-bot eb8b19bb33 Updating CoreFX dependencies to rc3-24105-00
Commit migrated from https://github.com/dotnet/corefx/commit/880e04074fa4918010feb681de16f95f711a5534
2016-05-05 14:18:51 -07:00
Lakshmi Priya c2ab2cdb04 Merge pull request dotnet/corefx#8252 from Priya91/updatecli
Update dotnet cli version.

Commit migrated from https://github.com/dotnet/corefx/commit/4dc850dcff87092d771444c2b56955c3b0d9bbe7
2016-05-04 11:07:29 -07:00
James Ko aef8bfcb76 Cookie: Set value to an empty string when null is passed in (dotnet/corefx#8206)
* Fix bug in Cookie where Value can == null

* Add a regression test for the bug

* Fix compilation errors

* Fix the netcore50 version of Cookie as well

* Update CookieTest.cs

* Add comment about the test failing on desktop


Commit migrated from https://github.com/dotnet/corefx/commit/9872c2aa881e8651486a6e3ae90fb2f59038baf6
2016-05-04 10:08:15 -07:00
Lakshmi Priya Sekar 0ed928e601 Update dotnet cli version.
Commit migrated from https://github.com/dotnet/corefx/commit/2338f33fadbb31f0869184f999563502f23b7fba
2016-05-03 17:08:05 -07:00
David Shulman 087e92da43 Add DefaultCredentials scenario tests
These tests require the client and server to be on a Windows Active Directory domain. These tests are Windows specific. Currently this cannot be done in the CI system. So, these tests are only enabled when an environment variable is set which points to the test server.

There is a separate todo item dotnet/corefx#4989 to provide more automated scripts for setting up the test server. For now, there is a readme file with some details.

These tests will help support fixes for dotnet/corefx#8176 and related bugs.


Commit migrated from https://github.com/dotnet/corefx/commit/4739da8c8d4965fdaf2fc45ae915297208672d15
2016-05-03 15:53:33 -07:00
dotnet-bot a08807e184 Updating CoreFX dependencies to rc3-24102-00
Commit migrated from https://github.com/dotnet/corefx/commit/f9171470a3c4a8261d4cd3945106c7d632a504d9
2016-05-02 23:40:09 +00:00
Eric St. John 52fb000bf4 Use netcoreapp1.0 TFM for .NETCore validation
Commit migrated from https://github.com/dotnet/corefx/commit/17d24311ef3490a7d4ec25f8105c780c1018a577
2016-04-30 09:53:43 -07:00
stephentoub 120b636957 Correctly annotate a stress test with HttpStressEnabled
It's failed a few times in outerloop; we only want it enabled when we're doing a stress test and nothing else is running, as the time it takes can fluctuate if lots of other things are running.


Commit migrated from https://github.com/dotnet/corefx/commit/d80099c00a3f55acc83089d32794e700171c3030
2016-04-30 06:53:02 -04:00
stephentoub 75ad7b6fbd Avoid race condition between queued HttpContent.CopyToAsync and request completion
HttpContentAsyncStream is used by CurlHandler as the request content stream, with writes to it done via HttpContent.CopyToAsync.  We expect the writes to all be asynchronous via WriteAsync. However, it's possible for an override of CopyToAsync to use Write, and if it does, and if we just delegated from Write(...) to WriteAsync(...).GetAwaiter().GetResult(), we would likely deadlock, as the CopyToAsync call is invoked from the single thread responsible for processing libcurl interactions, including supplying the reader that would unblock the writer. To handle this, we have two options: schedule the CopyToAsync to be invoked asynchronously just in case it does a synchronous write, or implement the write to buffer the data.

The former is what was done in https://github.com/dotnet/corefx/pull/4095.  It adds some cost to the expected / common case, but more importantly and worse it can also lead to concurrency problems and spurious exceptions, as for example if the request is faulted/canceled between the time that a task to invoke CopyToAsync is scheduled and the time that it actually executes, we could be invoking CopyToAsync on a disposed HttpContent; worse, we could
end up invoking CopyToAsync while it's being disposed, which could lead to arbitrary state corruption, and which means we can't guard against this with checks to see if the task has already completed.  The only way to fully guard against that is via a lock, but such a lock would itself lead to deadlocks, as the reader that would unblock the writer would have to take the same lock.

In comparison, buffering has the downside of taking up more and arbitrary amounts of memory to store all of the input.  But, we expect synchronous Writes to be rare, and code shouldn't be doing it anyway; if it does, the fix should really be to switch to asynchronous writes. This commit changes from the first approach to the second, using buffering in synchronous Write calls in order to ensure correctness and to optimize for the expected case.


Commit migrated from https://github.com/dotnet/corefx/commit/1ac3f5e62a0d094e7e4277afc43cb1e0c6260b83
2016-04-29 14:15:38 -04:00
David Shulman 366f1290d2 Clean up ResponseStreamTest
Used the MD5 hash verification when verifying correct response body
dowload.

Fixes dotnet/corefx#7885.


Commit migrated from https://github.com/dotnet/corefx/commit/b9859e8b30b781e59e050874f8c9ef096cdcac0c
2016-04-29 10:29:59 -07:00
David Shulman 4c9d153e59 Address PR feedback
Commit migrated from https://github.com/dotnet/corefx/commit/1eb395b5a05d6728411b0958a2c9df8b36c39fd5
2016-04-28 16:03:53 -07:00
David Shulman cbb2fa09d4 Fix HttpRequestMessage.Version tests
The current tests validating HTTP request message version were depending on a server behavior that is not guaranteed. In particular, HTTP RFC 7230 states that servers are NOT required to respond back with the same minor version if they support a higher minor version. In fact, the RFC states that servers SHOULD send back the highest minor version they support. So, testing the response version to see if the client sent a particular request version only works for some servers. In particular the 'Http2Servers' used in these tests seemed to echo the minor version of the request.

However, depending on network configuration, intermediate proxies can change the HTTP version that ends up getting sent to the destination server. And as a result, we can have unpredictable behavior in these tests.

To fix this, the tests were switched to use a loopback server that has deterministic behavior.


Commit migrated from https://github.com/dotnet/corefx/commit/d1ffcbcc120d3797dadce6196f499a0631e47caf
2016-04-28 10:57:12 -07:00
stephentoub 6e8cc68acf Consolidate loopback server code to LoopbackServer.cs
Also add Date header to responses


Commit migrated from https://github.com/dotnet/corefx/commit/f4804b5f54a9fe60b0dad794936c7b73b47be19f
2016-04-28 08:42:36 -04:00
stephentoub a2977e9fad More HttpClient test fixes and additions
- The GetAsync_ResponseWithSetCookieHeaders_AllCookiesRead test has been failing with some regularity in CI, with strange GatewayTimeout errors.  I don't know why this particular test is so much more susceptible to that, but I've changed the test to use a local loopback server rather than an external site.

- The SendAsync_ReadFromSlowStreamingServer_PartialDataReturned test was relying on timings from the server that might not always be correct, and due to internal differences between curl and WinHttp were very frequently wrong on Unix such that the test was disabled there.  I reimplemented it with a local loopback server, too.

- I've added another mini-stress test, with posts instead of gets.


Commit migrated from https://github.com/dotnet/corefx/commit/9b6a0224c3e404afe3f2c58dfb59e2068391c879
2016-04-27 13:44:35 -04:00
Stephen Toub bd529e5af9 Merge pull request dotnet/corefx#8082 from stephentoub/curlhandler_finalization
Enable finalization of resources in CurlHandler

Commit migrated from https://github.com/dotnet/corefx/commit/f55dbdb64d28ab231401b906c7bb6f411b045d4e
2016-04-26 21:36:15 -04:00
Eric St. John b1119fb4ef Cleanup usage of Linux/OSX
We've standardized on using Unix in most cases where we only cross-
compile once for Unix.  This change cleans up mentions of Linux/OSX when
we aren't actually cross-compiling for those OSes.

The remaining projects that still cross-compile for Linux/OSX are:
  System.Diagnostics.Process
  System.IO.FileSystem.Watcher
  System.Net.NetworkInformation

The System.Net.Security functional tests seem to still have a distinct
difference in functional behavior on OSX so I have also left these
configured to cross-compile for Linux/OSX.


Commit migrated from https://github.com/dotnet/corefx/commit/16ee317fa4e194ff7cf61e923caf103909e391f1
2016-04-26 14:37:21 -07:00
Eric St. John 54f18d06f2 Eliminate use of PackageTargetRuntime in CSPROJ
PackageTargetRuntime can now be derived from the OSGroup of the project.
Set the default values in dir.props and only override if necessary.


Commit migrated from https://github.com/dotnet/corefx/commit/7f871515097039b95b70c974eb5947fe7afaa322
2016-04-26 12:39:49 -07:00
Eric St. John a27cef15c7 Make desktop assets resolve without RID
Packages that support desktop need to install in projects that use
packages.config, so we should not rely on RID-specific assets for
desktop assets.  Additionally, if some decides to use project.json and a
RID we need to make sure they still get the right desktop asset.

This change standardizes most of the desktop builds to specify both RID
and TFM.  The common packaging targets will put the asset in both
lib/TFM and runtimes/RID/lib/TFM for desktop projects.


Commit migrated from https://github.com/dotnet/corefx/commit/0b7a2b6b4d1cf5f5a1fc2abc7e8c00c298bbe449
2016-04-26 12:39:48 -07:00