Commit Graph
302 Commits
Author SHA1 Message Date
David Shulman 1e120fdd63 HttpResponseMessage.ReasonPhrase should not be null
Recent changes due to PR dotnet/corefx#3199 caused the `HttpResponseMessage.ReasonPhrase` property to be a null string if the HTTP server response only contained a statuscode but no description on the status line. The existing .NET Framwork behavior is to have empty string as the property value in that case.

Added a new test to validate this change.

Fixes dotnet/corefx#6721.


Commit migrated from https://github.com/dotnet/corefx/commit/19ec320403cd53ad0cba75c69a1a2c027ed867d5
2016-03-07 12:23:04 -08:00
stephentoub 4737c9c91c Address PR feedback
Commit migrated from https://github.com/dotnet/corefx/commit/ad33a55907ff347cb3cb052aafe0bdd63dd524c0
2016-03-04 19:08:06 -05:00
stephentoub f6386c1530 Disable SSLv2 and SSLv3 in CurlHandler
Commit migrated from https://github.com/dotnet/corefx/commit/2ec7d66814f0f2a789356590962d5198c9745912
2016-03-04 17:02:27 -05:00
stephentoub f3434408bc Update xunit.netcore.extensions to 00187
Commit migrated from https://github.com/dotnet/corefx/commit/3cfd81e7369628d052da6367b28c6f5b5839f55d
2016-03-03 22:06:40 -05:00
stephentoub 579dd2cba9 Address more PR feedback
Commit migrated from https://github.com/dotnet/corefx/commit/15b2483a8d1ce5d495f75588ec2f1c0e3ae5bb2b
2016-03-03 12:21:10 -05:00
stephentoub b4708c3018 Add additional tests for IsBypassed and DefaultCredentials
And fixed a few other nits of feedback.


Commit migrated from https://github.com/dotnet/corefx/commit/bbef5f03fdbdf276851d82ce2c189b4ea1a4a826
2016-03-03 11:31:33 -05:00
stephentoub 0bd2c60135 Fix a few proxy-related issues in CurlHandler
- UseProxy's implementation was returning true by default but not actually honoring Proxy.
- WebRequest's DefaultWebProxy throws PlatformNotSupportedException, which should have been eaten to mean "use the default".


Commit migrated from https://github.com/dotnet/corefx/commit/9d8309a98d1165d4584d6f01245b9bf22a988ccb
2016-03-03 11:04:10 -05:00
stephentoub 6154fe40a2 Add HttpClientHandler test for proxies
We don't currently have any functional tests in the repo for using HTTP proxies.  This commit adds a very simple loopback GET request proxy server, just enough to verify that HttpClient does go through the specified proxy and pass credentials if requested.  If/when we get better infrastructure in place for this kind of thing, we can remove the proxy implementation and replace the test, but for now, this at least provides some automated verification cross-platform.


Commit migrated from https://github.com/dotnet/corefx/commit/db2d84b0bb4032ca21b8e7c9cfd96056ffddbab2
2016-03-03 08:23:57 -05:00
stephentoub 9b4473ede7 Upgrade package versions to rc3-23901
Commit migrated from https://github.com/dotnet/corefx/commit/55246a7fc60807d021fded5e333784956a662a51
2016-03-02 07:40:12 -05:00
Eric St. John 7c5ac76238 Add support for new Xamarin frameworks
The latest build tools contains framework lists for two new Xamarin fxs:
  Xamarin.TVOS
  Xamarin.WatchOS

This adds placeholders for those frameworks so that they can support
the packages with inbox facades.


Commit migrated from https://github.com/dotnet/corefx/commit/baf425fa935f4ecd32712448be627604067cf1d3
2016-02-29 14:43:27 -08:00
Eric St. John 19554adc35 Update buildtools and change validation framework
Update BuildTools to 1.0.25-prerelease-00180

Change validation framework moniker from dnxcore50 to
netstandardapp1.5.


Commit migrated from https://github.com/dotnet/corefx/commit/7c50768be0a2008480aa22ddb8038fdcb0e8039b
2016-02-29 14:43:26 -08:00
Eric St. John afdeaf78b0 Remove use of DNXCore from packages
This changes every package that used the DNXCore50 moniker to use a
NETStandard moniker instead.


Commit migrated from https://github.com/dotnet/corefx/commit/6008326984df7bddff751d0fec678ee29d821a59
2016-02-29 14:43:25 -08:00
Pallavi Taneja 38e2f4de64 Update the packages
Commit migrated from https://github.com/dotnet/corefx/commit/be7151b45a54577c2e28c56977408d7d61ed0ea9
2016-02-29 13:09:16 -08:00
Stephen Toub 84f73c7035 Merge pull request dotnet/corefx#6322 from justinvp/curl_headers
Reduce CurlHandler header parse allocations

Commit migrated from https://github.com/dotnet/corefx/commit/0d639c39f884de45f4325c6a9218b849b834a4fb
2016-02-25 20:50:32 -05:00
Stephen Toub 834f1fb44a Merge pull request dotnet/corefx#6389 from stephentoub/arg_names
Fix use of nameof with ArgumentException

Commit migrated from https://github.com/dotnet/corefx/commit/581d8ec923f57a33c43f3fbccdf47cd527010c47
2016-02-25 17:21:44 -05:00
Justin Van Patten 34b6ba7acb Address PR feedback
Commit migrated from https://github.com/dotnet/corefx/commit/0291b44d95777cc3ea5521194a7f9c88be987959
2016-02-25 10:41:06 -08:00
Justin Van Patten fb984b77d4 Reduce CurlHandler header parse allocations
Use existing known header and reason phrase instances instead of
always allocating new strings and avoid unnecessary intermediate
string allocations.


Commit migrated from https://github.com/dotnet/corefx/commit/8aab95829d92185966ec9b79702101a2f167cd49
2016-02-25 10:41:05 -08:00
Stephen A. Imhoff 811f903c18 Fix use of nameof with ArgumentException
Correct instances of new "ArgumentException(nameof(..." so names are in the correct parameter.  Where possible, I chose the resource string I felt best fit the situation.  Otherwise, I created a new entry (I'm assuming there's some extra work that needs to be done there, but don't know what it is offhand).


Commit migrated from https://github.com/dotnet/corefx/commit/368fdfd86ee3a3bf1bca2a6c339ee590f3d6505d
2016-02-25 10:35:40 -05:00
Eric Mellino 45736b2647 Fix compilation issues in various libraries when compiling without PCL reference assemblies
Commit migrated from https://github.com/dotnet/corefx/commit/e49f570bf97d0d81f3c461970155dc6cdd6aee8c
2016-02-24 18:29:17 -08:00
Eric St. John 5af200cd50 Rename "dotnet" to "NETStandard"
Fixes https://github.com/dotnet/corefx/issues/5707

We are changing the .NET packages to no longer use the ‘dotnet’, ‘dotnet5.x’, and ‘dnxcore50’ monikers.  This is thee first stage of the change for dotnet->netstandard.

The replacements are as follows

Old moniker | New moniker
----------------- | ------------------
dotnet5.x | netstandard1.y  (where y = x -1)
DNXCore50 | netstandardapp1.5
dotnet | netstandard1.3

To prepare for this change you can do the following to your project.json.  This change will require a recent build of NuGet or dotnet.exe and can be done prior to consuming the packages with the breaking change.  These packages will not work with DNX.

For a project targeting dotnet5.6
```
    "frameworks": {
        "netstandard1.5": {
            "imports": [ "dotnet5.6" ]
        }
    },
```

For a project targeting dnxcore50
```
    "frameworks": {
        "netstandardapp1.5": {
            "imports": [ "dnxcore50", "portable-net45+win8" ]
        }
    },
```

[tfs-changeset: 1578321]


Commit migrated from https://github.com/dotnet/corefx/commit/4435f9f2776ae007e05f4454675e56cf76a51975
2016-02-23 20:18:17 -08:00
David Shulman 19962646b8 Response stream reads should return error for insufficient data
WinHttpResponseStream was not tracking the amount of data read when the response used 'Content-Length' semantics. So, if the amount of bytes read from the server was less than expected, we did not return an error. This was different behavior than .NET Framework.

Fixed WinHttpResponseStream so that it will track the total number of bytes read and compare it to the expected number of bytes if using 'Content-Length' semantics. Note that we don't do this checking if the HTTP request is a HEAD request. That is because the definition of that HTTP verb is to return headers "as-if" it was returning a real response body. So, the 'Content-Length' might be set but there is no response body for a HEAD request.

For cases of using 'Transfer-Encoding: chunked' semantics for the response body, there is already error checking at the lower HTTP layer in WinHTTP.

Fixes dotnet/corefx#6231.


Commit migrated from https://github.com/dotnet/corefx/commit/7f5d6b643996306062836a17ddad643fd7e40ff2
2016-02-21 15:36:38 -08:00
Stephen Toub 1d7305c701 Merge pull request dotnet/corefx#6269 from stephentoub/curl_errors
Improve several areas of CurlHandler error handling

Commit migrated from https://github.com/dotnet/corefx/commit/2eb9d0ebbf97456fdbf0e2fc118abc9d3fcaed7f
2016-02-21 09:06:08 -05:00
David Shulman 3c429d38af Address PR feedback
Commit migrated from https://github.com/dotnet/corefx/commit/e1847ee878dcd48ce66f330761f50a96e7e9b2b0
2016-02-20 20:32:45 -08:00
David Shulman 1127bdc413 Add more Http response stream tests
Building on PR dotnet/corefx#6250, added more response stream tests dealing with
invalid response body transfer semantics.


Commit migrated from https://github.com/dotnet/corefx/commit/42e5f468e86f7d62fe1c62194bfd473d30cf06b7
2016-02-20 19:21:10 -08:00
stephentoub 647a074469 improve several areas of CurlHandler error handling
While tracking down an issue related to exception handling in CurlHandler, I fixed up a few issues:
- On older libcurl's curl_multi_perform can return an error code that means to retry curl_multi_perform, but we were treating it as an actual error.
- Several places we were creating an HttpRequestException with a null inner exception, even if we had additional information about the cause.  I've fixed those call sites to include an appropriate inner exception.
- Cleaned up a few error messages.
- Fixed one place where I was overzealous in mapping exceptions to IOException


Commit migrated from https://github.com/dotnet/corefx/commit/1faaea86f0684452a874bcd58ce259763135c6b9
2016-02-20 07:25:58 -05:00
Stephen Toub f87bde7d1a Merge pull request dotnet/corefx#6250 from stephentoub/curlhandler_ioexception
Change CurlHandler to use IOExceptions for Stream failures

Commit migrated from https://github.com/dotnet/corefx/commit/4375b158e5d0498afb7edd1f3dc320bedbf9bf29
2016-02-19 21:26:21 -05:00
stephentoub 951b06b86c Add test for invalid response content length
Commit migrated from https://github.com/dotnet/corefx/commit/f9d488485d2bb7edeb43f918af1746d9ecb5e758
2016-02-19 17:32:27 -05:00
Christopher Costa b7275a6e29 Merge branch 'master' of https://github.com/dotnet/corefx into open_pkgs
Commit migrated from https://github.com/dotnet/corefx/commit/7df55caaad1d1e21866ec31b0e7161db9ae2179c
2016-02-19 14:21:24 -08:00
stephentoub 7365591fd7 Change CurlHandler to use IOExceptions for Stream failures
As with WinHttpHandler, CurlHandler wraps exceptions in HttpRequestException.  But WinHttpHandler switches to using IOException when sending exceptions out via Stream.Read/WriteAsync.  This change does the same for CurlHandler.


Commit migrated from https://github.com/dotnet/corefx/commit/e39e43a3809775c41a223ffa679e4f9e693676e1
2016-02-19 14:11:51 -05:00
Stephen Toub 26c1962d0d Merge pull request dotnet/corefx#6209 from stephentoub/nameof_exceptions
Deploy nameof throughout corefx

Commit migrated from https://github.com/dotnet/corefx/commit/1bd332f2e5f559c2eab276acb0d9e4256085ec2f
2016-02-19 14:10:39 -05:00
Christopher Costa 8d91794cf8 Merge branch 'master' of https://github.com/dotnet/corefx into open_pkgs
Commit migrated from https://github.com/dotnet/corefx/commit/6c7226985ebea63f36d3d24e4c65e331a2e277c1
2016-02-19 10:56:24 -08:00
stephentoub 7385fb7563 Fix two build warnings
Commit migrated from https://github.com/dotnet/corefx/commit/499960b0345be841d0eb5bd174d68045a2c8d5f0
2016-02-19 10:42:25 -05:00
dotnet-bot b32ddb5d98 Deploy nameof throughout corefx in MemberData
Commit migrated from https://github.com/dotnet/corefx/commit/9c3156b9ada06b8e58ac53d48fc303500bf3e476
2016-02-18 23:58:15 -05:00
dotnet-bot 3184718282 Deploy nameof throughout corefx in exception construction
Mostly automated replacement of parameter name string literals with corresponding usage of nameof.


Commit migrated from https://github.com/dotnet/corefx/commit/396b41ddec99d01505c1bc4fa02fb0f0c5844990
2016-02-18 23:58:06 -05:00
David Shulman 52476494de Merge pull request dotnet/corefx#3199 from justinvp/winhttphandler_parseresponseheaders
Reduce allocations when parsing response headers in WinHttpHandler

Commit migrated from https://github.com/dotnet/corefx/commit/35f7ef05a8022358ec435152e7099d8263a4422a
2016-02-18 15:52:45 -08:00
Christopher Costa d95b14a3c4 Merge branch 'master' of https://github.com/dotnet/corefx into open_pkgs
Commit migrated from https://github.com/dotnet/corefx/commit/b70432898b7a00edb3303c0fbf4a1b98ebe442b4
2016-02-18 10:28:54 -08:00
stephentoub 95d7cc7534 Update packages to rc3-23818
Commit migrated from https://github.com/dotnet/corefx/commit/380a2ebf4a498f9ab0a819c71d8717377e601bfb
2016-02-18 07:28:09 -05:00
Christopher Costa 23ac6d7e8d Merge branch 'master' of https://github.com/dotnet/corefx into open_pkgs
Commit migrated from https://github.com/dotnet/corefx/commit/ddcd78f8f2ccd3debefefb5e10164d7a038bb7e0
2016-02-17 10:46:00 -08:00
Justin Van Patten 8e6b8806d3 Reduce response message allocations in WinHttpHandler
Reduce allocations associated with interop calls to
WinHttpQueryHeaders and parsing response headers.


Commit migrated from https://github.com/dotnet/corefx/commit/ce63f30fcc11eca57b13753effbb057ce6547688
2016-02-16 18:47:54 -08:00
stephentoub b6b5cfd1c0 Fix HttpClient diagnostic listener issues
- Fix Assert that was throwing in a background thread due to mistmatched type (it was looking explicitly for HttpResponseMessage rather than any type in its inheritance hierarchy, and CurlHandler uses a derived type).
- Update project.json package versions
- Unsubscribe the listener when done with it


Commit migrated from https://github.com/dotnet/corefx/commit/9a8d97852bcce9be0b4b6b5eff5ed87f4e36119e
2016-02-16 18:13:49 -05:00
nbilling 4401926ae3 Http request/response DiagnosticSource logging.
- Added logging to WinHttpHandler, CurlHandler, and HttpHandlerToFilter
  for HTTP request/response.
- Added functional tests for HttpClient (WinHttpHandler is exercised by
  these tests on desktop).


Commit migrated from https://github.com/dotnet/corefx/commit/edbd7ba720699bbe20753872ac430f0b3fdaf3a9
2016-02-16 15:57:17 -05:00
stephentoub 180fba592f Update packages to rc3-23816
Commit migrated from https://github.com/dotnet/corefx/commit/c2e6426b9b9494d5478f656396f4da5711e8729a
2016-02-16 11:05:43 -05:00
stephentoub a024728bfe Use Buffer.BlockCopy with byte[]
In particular after https://github.com/dotnet/coreclr/pull/3118, Buffer.BlockCopy has less overhead than Array.Copy when copying byte[]s, such that there's no benefit to using Array.Copy and potential benefit to using Buffer.BlockCopy.

This commit replaces usage of Array.Copy(byte[], ...) in corefx with Buffer.BlockCopy(byte[], ...).  A lot of places were already using it.

(In a few places where we weren't passing lower bounds to Array.Copy with T[] arguments, I added explicit lower bounds as well to avoid the overload needing to call GetLowerBound.)


Commit migrated from https://github.com/dotnet/corefx/commit/3ab3bd6efcba669bf04d42f738fe5a495ec62940
2016-02-14 09:04:00 -05:00
Stephen Toub 4843d966db Merge pull request dotnet/corefx#6040 from stephentoub/add_review_headers
Add API review headers to ref files

Commit migrated from https://github.com/dotnet/corefx/commit/39471b56bd0241e60a33b4179a04187b96481547
2016-02-11 18:47:35 -05:00
Christopher Costa 1df6eaae43 Open package conversions for corefx.
Commit migrated from https://github.com/dotnet/corefx/commit/030e29992f6be20ffb9d9d3e799118f3354bce22
2016-02-11 13:37:45 -08:00
stephentoub 685d9f5063 Add API review headers to ref files
Commit migrated from https://github.com/dotnet/corefx/commit/5240b324e50f9aabaa11d4b0c46acc34e370a724
2016-02-11 10:50:44 -05:00
stephentoub 1744d93462 Allow CurlHandler to opt-in to NTLM via CredentialCache
libcurl supports four auth types (Negotiate, NTLM, Digest, and Basic), but today our CurlHandler implementation only enables three (Negotiate, Digest, and Basic), with NTLM explicitly disabled to match what was done in WinHttpHandler in corefx (the full framework enables it).

However, there are a few key differences that need to be taken into account for CurlHandler. For example, popular implementations of gssapi and Negotiate on Unix do not include implementations for fallback to NTLM.  So whereas including "Negotiate" in WinHttpHandler often allows code on Windows to use NTLM if Kerberos is not available, the current state of CurlHandler often does not.  And although NTLM has some known issues, if it's the only option for a scenario where a Unix front-end needs to communicate with a Windows back-end (say because the front-end doesn't have kerberos infrastructure available and the back-end only has Windows authentication enabled), we still want it to be possible for a developer to write an app that communicates with that back-end.  The underlying platform supports it, the developer explicitly wants it, CurlHandler sitting in the middle shouldn't get in the way.

As such, this commit enables NTLM to be used, essentially removing the blocking of it that was previously done.  However, it's not enabled by default for arbitrary credentials; rather, it's only enabled when a credential added to a CredentialCache explicitly specifies "NTLM".  That way, it's available for a dev to opt-in to if desired, but just providing a NetworkCredential to CurlHandler will not use NTLM.


Commit migrated from https://github.com/dotnet/corefx/commit/6e765b2b84dcf0b6e7e3d1e0cbee6a7499a585f5
2016-02-11 10:39:07 -05:00
Stephen Toub f581539eca Merge pull request dotnet/corefx#6016 from stephentoub/remove_cctors
Remove ~20 explicit static cctors across corefx

Commit migrated from https://github.com/dotnet/corefx/commit/11efc0d43d56e1c280653934b27ae5c1ef05af8c
2016-02-11 08:48:15 -05:00
stephentoub 0dc4f0e58f Remove a handful of explicit static cctors across corefx
Explicit static cctors cause the C# compiler to not mark types as beforefieldinit, which in turn means that the backend compiler needs to add checks to static methods to ensure that the type has been initialized.  We have a bunch of such cctors across corefx that can be easily removed; this commit does so.  In a few places, it also presizes some collections to help avoid unnecessary memory pressure.


Commit migrated from https://github.com/dotnet/corefx/commit/79ae21b1b9a113230da7ebfbffa4e3c3fe36f0ac
2016-02-11 07:59:21 -05:00
Stephen Toub 36e072e26f Merge pull request dotnet/corefx#6001 from stephentoub/http_logging
Enable EventSource logging in CurlHandler

Commit migrated from https://github.com/dotnet/corefx/commit/b50ddae49d917e9a3c7c3d244ece87d7cb805d0b
2016-02-10 23:34:27 -05:00