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
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
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.
Fixesdotnet/corefx#6231.
Commit migrated from https://github.com/dotnet/corefx/commit/7f5d6b643996306062836a17ddad643fd7e40ff2
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
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
- 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
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
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
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
We currently have a bunch of tracing in CurlHandler, but it's all guarded behind compile-time flags, making it difficult to use to diagnose issues. This converts that to all be EventSource-based logging. It also enables libcurl to provide its debug info via a callback, which is then routed to the EventSource as well, and mapped to the easy handles with which the info is associated.
Commit migrated from https://github.com/dotnet/corefx/commit/9c9120d7e4368d5a627a09ae4285c66432f5e4d2
Some fixes (adding imports, adding Platforms package) were tooled, but more complex ones (forking project.jsons, editing csproj's) were not.
Also makes dependency version validation rules case-insensitive. (I used this fix to update the versions of some packages.)
[tfs-changeset: 1573868]
Commit migrated from https://github.com/dotnet/corefx/commit/84af04317505d48feaa1e83dd5dc27ddc0f6de76
Our certificate chain verification includes the ability to check user store certificates in addition to the root store, but it's more expensive than the default verification provided by OpenSSL, which only includes the system store. This commit modifies our CurlHandler's VerifyCertChain implementation to first use the OpenSSL implementation, and only fall back to ours if it fails, resulting in much faster processing in https cases.
Commit migrated from https://github.com/dotnet/corefx/commit/65fa1710ebf14711a7ec9b03e00b24014e8e97eb
HttpClientHandler (on Windows) was attempting to use default credentials against a server that needed auth even when the property .UseDefaultCredentials was set to false.
In order to map the different HttpClientHandler properties to the WinHttpHandler properties, the HttpClientHandler .UseDefaultCredentials. needs to turn on/off two credentials related properties of WinHttpHandler, .ServerCredentials and .DefaultProxyCredentials. However, it was only toggling the single .ServerCredentials property. The fix is to update both properties accordingly.
Fixesdotnet/corefx#5045.
Commit migrated from https://github.com/dotnet/corefx/commit/010801cbdfcb4f64152d2ba29da541ca395d0a8e