Commit Graph
1127 Commits
Author SHA1 Message Date
Stephen Toub a4a3232bd0 Fix remaining TODOs for SocketTaskExtensions tests
Commit migrated from https://github.com/dotnet/corefx/commit/e4977eb30a1226d736ab611cfed4632ccbac90b1
2017-05-10 09:44:40 -04:00
Lakshmi Priya Sekar 719d8b9ce0 Check for openssl version before setting cert callback.
Commit migrated from https://github.com/dotnet/corefx/commit/7fb74395611cf39ca6475184a840d9916ac71156
2017-05-08 17:03:41 -07:00
Lakshmi Priya Sekar 8eab84bfbe Respond to PR feedback.
Commit migrated from https://github.com/dotnet/corefx/commit/249bebc45b236267d46f72d71f6338320dbef128
2017-05-08 14:09:34 -07:00
Lakshmi Priya Sekar 35fc082740 Check openssl version before setting ssl options.
Commit migrated from https://github.com/dotnet/corefx/commit/0f590712d24837552aee18917d9d34341e20a4d3
2017-05-08 12:11:54 -07:00
Stephen Toub 2cf805c189 Merge pull request dotnet/corefx#19415 from stephentoub/add_winhttp_exc_diagnostics
Add exception diagnostics to WinHttp

Commit migrated from https://github.com/dotnet/corefx/commit/5265ea933604e590beb4837a90a1b71fb2386b3f
2017-05-05 22:52:52 -04:00
Stephen Toub c26f7d9cb9 Ignore lack of CURLMOPT_MAX_HOST_CONNECTIONS in CurlHandler
Versions before 7.30 don't have this option.  Previously we would throw a PlatformNotSupportedException.  As devs would generally use an option of this type to increase the limit (since historically such a limit was 2 or 10 in the .NET Framework) rather than decrease it, and since it's already effectively infinite by default in .NET Core, with this commit, now we just ignore it.  This helps to avoid PNSEs on the few platforms that still ship with too old a version of libcurl.


Commit migrated from https://github.com/dotnet/corefx/commit/113a7d5c47c5c0ab2aa8d7d39acf34a4e1618b24
2017-05-05 19:09:13 -04:00
Stephen Toub 85f212528e Add exception diagnostics to WinHttp
To help diagnose pernicious exceptions, this debug-build-only change augments exceptions created using CreateExceptionUsingError to include the calling thread's stack trace, so that when these exceptions are then moved to other threads and propagated there, we can better correlate where they came from.


Commit migrated from https://github.com/dotnet/corefx/commit/2c368e81d9d07f0d40edf36047e5b93e44db200b
2017-05-05 18:16:38 -04:00
FAREAST\v-lijiay f7b7e47d8f Disable failed test for issue 19038.
Commit migrated from https://github.com/dotnet/corefx/commit/2f6fc5e6ff048f6fcf6bbf42854bac1a79137064
2017-05-04 01:57:41 -07:00
Alex Perovich 72abd52557 Fix S.Net.Http.Functional.Tests on AoT (dotnet/corefx#19133)
* Fix S.Net.Http.Functional.Tests on AoT

* Use partial files

* Use braces


Commit migrated from https://github.com/dotnet/corefx/commit/f8f72de4a453151ee38322166ffec0000ee3a7c6
2017-05-02 06:49:19 -04:00
Stephen Toub 9401004824 Stop disposing of request content in HttpClient
HttpClient on Unix fails for some sites, in cases where the site sends a response before it’s fully received the entirety of the request.  That’s because HttpClient has logic to Dispose of the request content once the Task returned from the handler’s SendAsync completes, and unlike WinHTTP, libcurl doesn’t require that the whole request be sent before any of the response is processed.  That means that CurlHandler may receive the response (or the response headers), complete the SendAsync task, but still be reading from the request content, which may then be disposed of by HttpClient while it’s still in use, causing potential corruption, exceptions, etc.

The Dispose behavior has other problems with it.  A more generalized version of the above is that it prevents handlers that want to support full duplex communication, since it essentially requires that the whole request be sent before the response is processed.  It also forces extra cost onto consuming code in some situations, as it means that the request content objects can’t be pooled and reused (since disposal typically invalidates objects for such a purpose, though in some cases a custom content could be developed to override and ignore Dispose).

A variety of approaches were explored to address this:
- Change CurlHandler to only complete the SendAsync Task when both the request has been fully sent and the appropriate portion of the response has been received.  This is problematic, though, as with the pull model employed by libcurl, we don’t know reliably when the request has been fully sent.
- Change the disposal to be handled by the handlers rather than by HttpClient.  This could help in that a handler like CurlHandler could simply defer disposal until libcurl tells it the “easy” operation is done.  But it has other downsides. Today code can use an HttpClientHandler without HttpClient, e.g. by using HttpMessageInvoker instead of HttpClient, in which case it bypasses this disposal logic (and other logic provided by the relatively thin HttpClient wrapper). If we were to move the disposal logic to the HttpClientHandler, now such code that was never having its request content disposed will start to, which is bad and exactly the opposite of what we want. It also causes problems for chains of handlers, e.g. if HttpClient is given a handler that wraps CurlHandler, and that handler expects to be able to look at the request content after the SendAsync Task from CurlHandler completes but before it itself completes its SendAsync Task. And while such a scenario may seem far fetched, we effectively have it in the bits today: the diagnostic handler that's used to pass details off to DiagnosticListeners is injected in the middle like this, and it does pass off the request content after the wrapped SendAsync Task completes... if a listener was expecting a non-disposed request content at that point, it would be sorely disappointed.
- Simply stop disposing.  The primary downside here is existing code that may have expected disposal to happen, e.g. if a StreamContent wrapping a FileStream isn't explicitly disposed of by the app code, cleanup of the FileStream will be left to its finalizer.

The least bad option is to simply stop disposing.  This PR makes that change.


Commit migrated from https://github.com/dotnet/corefx/commit/6d06c39857f8bb7a798ca118944d25a43aaa8beb
2017-04-28 07:13:43 -04:00
Stephen Toub b5f9dd78d7 Tweak the SendAsync_ExpectedDiagnosticCancelledActivityLogging test
A few tweaks to hopefully either fix the test(s) or at least help to further isolate the cause for the hangs.


Commit migrated from https://github.com/dotnet/corefx/commit/f14bf2ba1c4cf5c0de4a37d90abe091ebd9133ce
2017-04-26 17:52:11 -04:00
David Shulman c7e96c847e Root cause PostScenarioTests (Http) test failures on NETFX
Fixed a test bug in PostAuthHelper which caused the wrong entity-body
semantics to get used during the test. This actually exposed a netfx
bug dealing with ambiguous semantics (Content-Length vs. chunked).

After fixing this test bug, it then exposed a product bug where we
leak an InvalidOperationException that isn't wrapped properly by an
HttpRequestException. The scenario that exposed this related to
POST'ing content that is non-rewindable and having to resubmit the
POST due to authentication challenges. This test was passing on
.NET Core because the test was written using the wrong assumptions.
It failed on .NET Framework which exposed the problem.

The InvalidOperationException comes from when a StreamContent's
SerializeToStreamAsync method is called and the content needs to be rewound.
If the content can't be rewound, then the exception is thrown with the
error message "The stream was already consumed. It cannot be read again."

Updated the WinHttpHandler and CurlHandler to wrap the InvalidOperationException
in an HttpRequestException. Updated the test accordingly.

Fixes dotnet/corefx#17621.


Commit migrated from https://github.com/dotnet/corefx/commit/e7e3c581870787d87393e674db22589ad56e944c
2017-04-25 09:40:33 -07:00
David Shulman 8a1544b2e5 Merge pull request dotnet/corefx#18875 from davidsh/post_netfx
Root cause System.Net.Http test failures on NETFX

Commit migrated from https://github.com/dotnet/corefx/commit/86913fc619293ca3874a6dd4b3724a69f03d4175
2017-04-24 18:35:45 -07:00
David Shulman 538018e43d Address PR feedback
Commit migrated from https://github.com/dotnet/corefx/commit/6f9338617df7f20dcccb64e5b72c8f8afc823066
2017-04-24 17:24:00 -07:00
Eric StJohn 8af4fc9c49 Merge pull request dotnet/corefx#18766 from ericstj/removeIsDesktopFacade
Remove IsDesktopFacade

Commit migrated from https://github.com/dotnet/corefx/commit/c77b83942986c9103d959dbba5de5ce0599b2858
2017-04-24 16:43:55 -07:00
Eric St. John 809b1ef04a Remove use of IsDesktopFacade
Commit migrated from https://github.com/dotnet/corefx/commit/7a7bf2e0cb40168c8819d84c66c99c8984746e02
2017-04-24 15:46:30 -07:00
David Shulman 3505e5abfd Root cause System.Net.Requests test failures on NETFX
Finished investigation of failures on .NET Framework for
System.Net.Http.

Added specific NETFX test changes where necessary. Opened up additional
bugs for investigation.

Added missing parameter validation for HttpClientHandler.MaxConnectionsPerServer
for the net46 OOB. This matches .NET Core now.

Removed some test code that was incorrectly trying to do CredentialCache.Add()
with a 'basic' authtype and using DefaultCredentials. This is invalid and
throws exception on netfx. Added dotnet/corefx#18870.

Remove PlatformNotSupportedProxy test code. It was throwing an exception
on netfx and the purpose of it didn't seem to make sense in the one test
that was using it.

Fixes dotnet/corefx#17691.


Commit migrated from https://github.com/dotnet/corefx/commit/b1246c7f1ee1d9e42594988073fd06580d23fe84
2017-04-24 14:09:31 -07:00
Stephen Toub 7cc8891d3d Merge pull request dotnet/corefx#18609 from stephentoub/expose_ics
Expose Task.IsCompletedSuccessfully

Commit migrated from https://github.com/dotnet/corefx/commit/4f425df37377b5b2b8df750144695d89ceade51d
2017-04-24 11:13:02 -04:00
Liudmila Molkova b9af05a8bc Update HTTP Diagnostics guide
Commit migrated from https://github.com/dotnet/corefx/commit/251673b6ae0ae114c5d47316f77fd59edee83031
2017-04-21 23:05:01 -07:00
Stephen Toub 00311b4617 Add support for UseDefaultCredentials to CurlHandler
Rely on libcurl internally using gssapi and kerberos infrastructure.


Commit migrated from https://github.com/dotnet/corefx/commit/8499dc22409f59db6b83ad8a4da9cfac9357b6f9
2017-04-19 14:11:20 -04:00
Stephen Toub 876ce9c240 Expose Task.IsCompletedSuccessfully
Commit migrated from https://github.com/dotnet/corefx/commit/5f7986c01ee2a31abe0b54f89d5f2387c64110e5
2017-04-19 08:07:24 -04:00
Eric St. John 08a06887a3 Re-enable package validation and clean up package content
Commit migrated from https://github.com/dotnet/corefx/commit/72002dbb7e3e657adaeb002feca0399d9667a54b
2017-04-18 13:28:50 -07:00
Eric St. John d47f03fb56 Explicitly list paths for harvesting
Commit migrated from https://github.com/dotnet/corefx/commit/ec4d6f868eb6497216791fc158173e7123d6e73f
2017-04-18 12:20:30 -07:00
Daniel Harvey 252cdc5e95 Bulk updates of tests for AssertExtensions (dotnet/corefx#18491)
Bulk update to AssertExtensions.Throws for AOT support. This doesn't disable Assert.Throws.

Commit migrated from https://github.com/dotnet/corefx/commit/b43b4df2e0e2182154bb0f425cb4a61bc1269828
2017-04-18 09:52:02 -07:00
danmosemsft 356e660bfd Increase timeout
Commit migrated from https://github.com/dotnet/corefx/commit/790f633dc071d4ac8486700cd9c2a3f4f5c36c01
2017-04-17 16:43:50 -07:00
Viktor Hofer ebb1c635a9 Removed ActiveIssue comment in favor of explanation why this behavior is intended on Windows
Commit migrated from https://github.com/dotnet/corefx/commit/8fd9800cab67fe7eac59be441eadaec048234ed1
2017-04-15 13:49:27 +02:00
Eric St. John 30b972e1b2 Add NETStandard.Library.NETFramework package
This package is a support package for NETStandard2.0 on .NET 4.6.1.


Commit migrated from https://github.com/dotnet/corefx/commit/796a4b6af55c9ff548e172a943b9af737706fe2b
2017-04-12 13:42:52 -07:00
Stephen Toub ac687fe50f Fix length calculation in HttpContent to avoid unnecessary growth
Commit migrated from https://github.com/dotnet/corefx/commit/100f112b98968cb14587fe910089ecd28c48e5e4
2017-04-12 08:01:35 -04:00
Wes Haggard dacaabc206 Merge pull request dotnet/corefx#18165 from weshaggard/UpdateAssemblyKeys
Updates how we define which key an assembly uses

Commit migrated from https://github.com/dotnet/corefx/commit/4b0b313c3a40fefe793ab465f152f382484813d8
2017-04-10 16:48:43 -07:00
Eric Mellino ddb473aac9 Move corefx onto the .NET Core 2.0 toolset
Commit migrated from https://github.com/dotnet/corefx/commit/8b471f76eef041f0cf40fec65c99a29b235bbe7d
2017-04-10 14:36:01 -07:00
Wes Haggard 4185183e8c Updates how we define which key an assembly uses
Now instead of Use*Key a project can instead define the assembly key
in the project (genreally the common dir.pops for a project) using
the AssemblyKey property. The accepted values are Open, ECMA, MSFT,
Test.

This change allows for a repo to set the default key they want to use
for projects. In corefx we have switched the default to use the Open
key instead of the old BuildTools default of MSFT key.

As part of this update we are explicitly setting the AssemblyKey in
all the library projects (although it is really only necessary for
projects that aren't the default).

Also with this change we are updating all the new libraries that have
not yet shipped stable (compared to our 1.1 release) and making them
use the Open key. Which means that for prerelease dependencies there
might be some binary breaking changes to consume.

The following libraries ahven't shipped so there key is being
changed from MSFT to Open:
Microsoft.XmlSerializer.Generator
System.CodeDom
System.Configuration.ConfigurationManager
System.Data.Odbc
System.DirectoryServices
System.DirectoryServices.AccountManagement
System.DirectoryServices.Protocols
System.IO.Ports
System.Json
System.Memory
System.Net.HttpListener
System.Net.Mail
System.Net.ServicePoint
System.Net.WebClient
System.Net.WebProxy
System.Private.Xml
System.Private.Xml.Linq
System.Security.Cryptography.Xml
System.Security.Permissions
System.Transactions.Local
System.Web.HttpUtility


Commit migrated from https://github.com/dotnet/corefx/commit/ac09a797d09502ebab61f7167bb856846602e1e6
2017-04-10 12:51:50 -07:00
Tijoy Tom Kalathiparambil 324755f6fd More PNSE disabling for UWP
I have disabled couple of PNSE
which look suspect and opened
issue to review all PNSE. Doing it
one by one is not scalable since app
runs take about 10 hours to complete.


Commit migrated from https://github.com/dotnet/corefx/commit/0ca241a01e4d2219220dcb194dc404d90a20ab65
2017-04-08 12:19:43 -07:00
Tijoy Tom Kalathiparambil b61e483e0e Couple of fixes for UWP app-compat.
1. HttpClientHandler.PreAuthenticate throws PNSE, disabling
   it for now.
2.System.Runtime.CompilerServices.RuntimeOps need to be
  reflection enabled.


Commit migrated from https://github.com/dotnet/corefx/commit/c9c5217085f0f591d6a7659aeccecd7c71b9f2ad
2017-04-07 21:27:38 -07:00
Stephen Toub ff38f977e8 Merge pull request dotnet/corefx#18008 from stephentoub/fix_nullref_httpdispose
Fix race condition in HttpClient on Unix when canceling a request

Commit migrated from https://github.com/dotnet/corefx/commit/02e79f08fe0fba8bc31ba4860c0edc0cdb2707ee
2017-04-06 21:16:43 -04:00
Tijoy Tom Kalathiparambil c20b5097eb Disable HttpRequest.MaxResponseHeadersLength PNSE.
This is necessary for app-compat , apps fails
because of PNSE exception.This is a workdaround
till we get the correct fix, seedotnet/corefx#18036


Commit migrated from https://github.com/dotnet/corefx/commit/902799c56feef43e2533b5b4f27e9e278c227ce4
2017-04-06 16:07:49 -07:00
Stephen Toub eb0263f18f Store _pendingReadRequest into a local for multiple accesses
It should not be possible by construction for _pendingReadRequest to become null in SignalComplete after we check it for nullness, as all access to it is protected by a lock.  But for good measure, store it into a local and use that local for subsequent accesses.  If nothing else, we can avoid an extra field access.


Commit migrated from https://github.com/dotnet/corefx/commit/7dc759724bd3da68ebe3756f1e3ffa9bd9266d2c
2017-04-06 10:29:14 -04:00
Stephen Toub 580e439dc7 Associate EasyRequest with MultiAgent in ctor
It looks like it's possible in a rare situation for the following to occur and result in a NullReferenceException when finalizing a request:
- HttpClient.SendAsync is called, which creates an EasyRequest.  That EasyRequest isn't yet associated with a MultiAgent.
- The request is queued to the MultiAgent.
- Between the time that the request is queued and it's handled, the associated CancellationToken has cancellation requested.
- When the agent then processes the request, in ActivateNewRequest it'll see that cancellation has been requested and will immediately bail, before associating the easy request with the agent.
- Everything is dropped and eventually finalized.  At that point the response stream's finalizer is invoked, it calls SignalComplete(..., forceCancel:true), and that dereferences _associatedMultiAgent in order to issue a cancellation request... but _associatedMultiAgent hasn't yet been set.

There's no reason _associatedMultiAgent's initialization needs to be deferred until the EasyRequest is picked up by the agent.  We can instead make _associatedMultiAgent a readonly field that's initialized to the associated agent when the EasyRequest is constructed, so it won't be null even in such a situation.


Commit migrated from https://github.com/dotnet/corefx/commit/534a8dcd35bd3f264d08eadfe54a49e859e2012e
2017-04-06 10:21:50 -04:00
Stephen Toub aff50fd9a3 Merge pull request dotnet/corefx#17951 from marek-safar/http
Fixes NRE when setting Size property of ContentDispositionHeaderValue

Commit migrated from https://github.com/dotnet/corefx/commit/dff31f7522b6af42344da6f6a78db7ed1cf830da
2017-04-05 13:58:30 -04:00
Eric StJohn 0a2460e891 Merge pull request dotnet/corefx#17825 from ericstj/ILLinkTrimAssembly
Add ILLink to the build

Commit migrated from https://github.com/dotnet/corefx/commit/16625287b450bc623fe46683f0ff27da1ab5ad47
2017-04-05 10:19:17 -07:00
Marek Safar df19e1fb58 Fixes NRE when setting Size property of ContentDispositionHeaderValue
Commit migrated from https://github.com/dotnet/corefx/commit/d6a3dbe4addaae897b9d82aedb3afeb125740f29
2017-04-05 18:56:39 +02:00
David Shulman fb0d9456d4 Adjust tests to check for proper Windows 10 update version
Remove unneeded old Windows 10 version check (IsWindows10VersionInsiderPreviewOrGreater).
Use the official Windows 10 Creators Update version number 1703 (build 15393) which is
already defined (IsWindows10Version1703OrGreater).

Fixes dotnet/corefx#8945, dotnet/corefx#10958


Commit migrated from https://github.com/dotnet/corefx/commit/d56c8d1185fdea71e0c210d8ab3d111a40dc3047
2017-04-04 13:04:59 -07:00
David Shulman 83ac5b6403 Fix MaxResponseHeadersLengthSemantics (dotnet/corefx#17796)
* Fix MaxResponseHeadersLengthSemantics

The new HttpClientHandler.MaxResponseHeadersLength property is defined differently from the similarly
named WebRequestHandler and HttpWebRequest properties. The units are supposed to be in Kilobytes
(1024 bytes). This problem was discovered while doing .NET Core vs. .NET Framework compat testing.

Fix the semantics to match the existing WebRequestHandler and HttpWebRequest properties. Adjust tests.

Contributes to dotnet/corefx#17691

* Address PR feedback


Commit migrated from https://github.com/dotnet/corefx/commit/170f7a5ac7f98f2076f0776c573e3188a390d565
2017-04-03 14:25:25 -07:00
Tijoy Tom Kalathiparambil a9298e6c91 Temporary fix for dotnet/corefx#17812
This's a temporary fix for issue
https://github.com/dotnet/corefx/issues/17812
to get us unblocked for ns2.0 UWP app-compact.


Commit migrated from https://github.com/dotnet/corefx/commit/0945e962ba34f8c3db854eef067ca5b082749781
2017-04-03 10:39:00 -07:00
Eric St. John 1a839a01f5 Add manual roots for ILLink
These represent dynamic dependencies that are not caught by ILLink.

See individual files for details on the dependencies.


Commit migrated from https://github.com/dotnet/corefx/commit/2277db969616a5ad4fd9f4a8118a3b4030ff62d3
2017-04-03 10:23:59 -07:00
David Shulman 75d4e8ad18 Fixes for running Http tests against Desktop
Got the Http Functional tests running with no errors against NETFX (Desktop). Found a bunch
of compatibility differences between Desktop and Core that need to be investigated. For now,
the tests are skipped on Desktop.

Fixed the LoopbackServer so that it will run. It was blowing up with `MissingTypeException`
due to missing SocketTaskExtensions class (dotnet/corefx#17690).

Contributes to dotnet/corefx#17691


Commit migrated from https://github.com/dotnet/corefx/commit/b7f6f5f159ebe6c0597578bbd858697a6159a22f
2017-04-01 09:28:32 -07:00
David Shulman 5fd3a239ce Modify HttpClientHandler compression default to match Desktop
Change HttpClientHandler property for AutomaticDecompression to match
original .NET Framework default. Adjust tests accordingly.

Contributes to dotnet/corefx#17691


Commit migrated from https://github.com/dotnet/corefx/commit/eb21a724bff127d3ab0c34240234ef93ac1a94fb
2017-03-30 13:36:49 -07:00
Santiago Fernandez Madero 4f7e250ed1 Disable test (dotnet/corefx#17692)
Commit migrated from https://github.com/dotnet/corefx/commit/755f816d20536dbf87c80baa411a6da00bf94203
2017-03-30 10:44:00 -07:00
Santiago Fernandez Madero 0129621923 Disable some outerloop tests (dotnet/corefx#17623)
Commit migrated from https://github.com/dotnet/corefx/commit/ed04496053a37fedd0a4ebe2022deec1031e1066
2017-03-28 15:53:46 -07:00
Santiago Fernandez Madero de36b4d76e Update csproj and solutions configurations (dotnet/corefx#17613)
* Update csproj and solutions configurations


Commit migrated from https://github.com/dotnet/corefx/commit/9fa0bc5de96946eb3e109f13768f1258cfaddc73
2017-03-28 14:36:26 -07:00
Dan Moseley c6090a8624 Log elapsed
Commit migrated from https://github.com/dotnet/corefx/commit/5a0fb9465e4dc68fb1a7f1924c9df43440d80472
2017-03-27 21:57:46 -07:00