When we get called back by libcurl to verify the server's certificate, we try to take a fast path where we use OpenSSL's certificate verification rather than doing our own, which is more comprehensive but also slower. However, when we added that fast path, we inadvertently ended up not setting the Channel Binding Token in that case, only doing so in the fallback path. This fixes that, moving the configuring of the CBT up to before we ask OpenSSL to verify the cert.
Commit migrated from https://github.com/dotnet/corefx/commit/bb26ba8b5375e76d00db8b371abb6e273e7b4019
Today CurlChannelBinding creates the result of ToString when the token is set into it. Getting the description of the binding is rare compared to setting a token into the binding, so just create the string when it's requested.
Also a bit of miscellaneous cleanup in related code.
Commit migrated from https://github.com/dotnet/corefx/commit/49c31a87c41c326788162b7aa148b01f1d89c796
This SafeHandle is only needed when using HttpContent-derived types that care about TransportContext, which is not a common case. Lazily-allocate it.
Just as an example, before this change, it was being allocated during ~50 tests. After this change, it's allocated just once, in the test explicitly verifying the binding.
Commit migrated from https://github.com/dotnet/corefx/commit/900a3664cf4c574e26144b3cf46db2bcf93fe394
This test failed once, and I expect it was just due to a network blip that caused the request to fail, but since we're not currently checking the http status code, I can't be sure. As such, I'm just adding another assert for the expected status code, and if this repros again, we'll know whether that's the issue.
Commit migrated from https://github.com/dotnet/corefx/commit/50b2ce5699eb7034a033b3d125ad62bf03b23458
Currently the shim exposes a single method to get just the information that was needed when this was written. Every time we need to get additional version info, we need to change the existing signature (which won't version well) or add additional similar signatures (will which be confusing). Instead, I've changed it to have more fine-grained entrypoints, each exposing a particular piece of info. We may end up making a few more interop calls on first-use, but the overhead is negligable.
With that scheme, I've then exposed additional entrypoints for getting version information, in order to provide better tracing and exception error messages.
This is then also used in tests to only run tests when certain features are available.
Commit migrated from https://github.com/dotnet/corefx/commit/29b0dc7b810776178bf42851064c397e47c4d0b8
Setting VERIFYPEER to 0 not only tells libcurl/OpenSSL not to do verification of the peer, but also to ignore any failures from our callback.
Also add a check for revocation checking and throw a PNSE if the backend doesn't support us registering the necessary callback.
Commit migrated from https://github.com/dotnet/corefx/commit/e3a4845289edf4ffa3f4da41efff52e3f6363c6c
I made a previous change to decrement assembly versions to enable our packages to be consumed
in desktop and redistribute netcore50 assemblies: https://github.com/dotnet/corefx/pull/6902
That caused a lot of runtime breaks because folks who were built against old packages would
get ref-def mismatches at runtime. Rather than keep everything broken until the whole stack
updates I'm moving the implementation assemblies back to the old versions. This will let folks
move to the new packages with the lower versioned ref-assemblies. Once everyone is on the new
packages we can undo this change.
Change is going directly into TFS to make tonight's build. I will deal with the fallout during mirror.
[tfs-changeset: 1588328]
Commit migrated from https://github.com/dotnet/corefx/commit/0f268ed1079c182d71cdf49cde3f339a01d67863
- Disable libcurl's cert verification when we're going to do it all ourselves
- Disable application policy for the single-cert manual case
- Avoid allocating a List when a simple array suffices
- Avoid an array allocation when a stack handle is invalid
- Dispose of a chain when Build fails in client callback
- Dispose of chain and certificate in client callback
- Avoid explicitly throwing an exception across an interop boundary when an invalid SSL pointer is provided
- Use named return constants in client callback for readability
- Dispose of certificates retrieved from store
- Remove some unnecessary code in GetRequestCertificateAuthorities
Commit migrated from https://github.com/dotnet/corefx/commit/027eb1e0dbac9bfa1c9b925fcf84e0566372d916
Adds implementations for:
- ClientCertificates
- ServerCertificateValidationCallback
- CheckCertificateRevocationList
I've explicitly not added these to the contract, as we're not ready for that yet on other platforms, and I've not added tests (though I've done some testing manually, such as verifying that I could run tweaked versions of the WinHttp server callback tests against this successfully).
Commit migrated from https://github.com/dotnet/corefx/commit/8376a43a5c425cc78dfb94c53b6f100eb5146aca
We removed the lifting from the lineup so tests should reference the
latest packages in order to ensure an implementation is available.
The latest pacakges exclude implementation dependencies so I needed to
add these to projects that were depending on them coming in transitively.
Commit migrated from https://github.com/dotnet/corefx/commit/bef9061fd1238adf47b864d8924d121e4134465b
The latest drop of packages no longer includes lifting entries in the
lineup. This causes errors when restoring for a concrete TFM and no
implementation assembly is in the packages.
I addressed this issue two ways:
1. In places where we were targeting a concrete TFM but packaging as
NETStandard, just target NETStandard instead.
2. In places where we were targeting a concrete TFM but that packages
were missing the implementation on that TFM, update the reference to
newer package version where implementation is available.
Commit migrated from https://github.com/dotnet/corefx/commit/dfb30176c6056f5b3427515c4444a9dc31b9ba4f
Microsoft.CSharp, System.IO.Compression, and System.Net.Http are all
reference assemblies in the desktop and mono/xamarin targeting packs.
As such these won't be referenced automatically. Ensure we add a
reference when installing the package.
Commit migrated from https://github.com/dotnet/corefx/commit/eedef71bc2f4fe040ce10a5a59d385b036d3375f
We were getting an assert if we had an authenticating proxy but didn't have any credentials to send. After the initial 407 was received from the proxy, we then tried to set credentials for a retry. But since we didn't have any, we triggered an assert in SetWinHttpCredential.
The fix is to check for null credentials after getting the 407 response. If there are no credentials, then we end the retry loop with the final 407 status code.
Commit migrated from https://github.com/dotnet/corefx/commit/89966ef37a1269471069c2ee14cdb6af51d8a707
Recent changes due to PR dotnet/corefx#3199 caused `HttpClient` on Windows to miss
`Set-Cookie` response headers when one of the header values was large
enough to cause `WinHttpQueryHeaders` to fail with
`ERROR_INSUFFICIENT_BUFFER` and advance the index.
This commit addresses the regression, by always setting the index
back to the index we want to retrieve.
Added a new test to validate this change.
Fixesdotnet/corefx#6737.
Commit migrated from https://github.com/dotnet/corefx/commit/f7e9f00aba800d2ea63e040deafcc7ee220331fc
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.
Fixesdotnet/corefx#6721.
Commit migrated from https://github.com/dotnet/corefx/commit/19ec320403cd53ad0cba75c69a1a2c027ed867d5