- Apply IDE simplifications for things like null checks during assignments
- Fix GetOrAdd calls to only allocate if necessary
- Use throw expressions in a few places
- Add some readonlys to fields
- Change some .Waits to .GetAwaiter().GetResult()s
- Remove some unnecessary abstract overrides
- Remove some unnecessary usings
Commit migrated from https://github.com/dotnet/corefx/commit/dc01adf473ae5031be436808bf4b310c364c4268
The primary purpose of the PR is to get the code into the repo (not enabled by default), so most PR feedback is being left for subsequent PRs. However, this commit addresses the feedback deemed imperative to fix prior to initial merge.
Commit migrated from https://github.com/dotnet/corefx/commit/5c86b5e5e1a6896e0be396a6422e8f3ebed78648
After my PR dotnet/corefx#21325, I discovered an edge case where we need to check for
a non-null Proxy property in the underlying WebRequest.
On .NET Framework, System.Net.Http is built on WebRequest
(HttpWebRequest) and is subject to side-affects from it. The static
property WebRequest.DefaultWebProxy affects the initial value of
WebRequest.Proxy. So, it's possible that a developer may have set
WebRequest.DefaultWebProxy to null prior to using System.Net.Http in the
app.
The net affect of this is that that won't be any proxy used as the
system default proxy and thus the
HttpClientHandler.DefaultProxyCredentials is ignored.
On .NET Core, there is no relationship between System.Net.Http and
System.Net.WebRequest. So, in all cases on .NET Core, where a developer
has specified HttpClientHander.UseProxy=true and HttpClientHandler.Proxy
= null (default values), the handler will always try to use the system
default proxy (if configured).
Commit migrated from https://github.com/dotnet/corefx/commit/eac755df47f70e5ef3853c0b71ed4ab12455bb96
- Add a ManagedHandler field to both the Windows and Unix HttpClientHandler builds, and change the members to switch based on which is being used. The default is still to use WinHttpHandler and CurlHandler respectively, but setting an environment variable prior to constructing an HttpClientHandler will switch it to use ManagedHandler.
- Add test classes that will run the tests again but with the managed handler. Some of the test classes are commented out due to current failures.
- Fixed a few tests.
Commit migrated from https://github.com/dotnet/corefx/commit/b238d0d760a2588513c443f3a4c991222fd037bb
This bug was discovered in internal testing when this code was being
ported to .NET Framework vNext. Due to all these tests being previously
disabled on NETFX, the bug was missed.
The HttpClientHandler.DefaultProxyCredentials property is only used when
an explicit proxy is not specified (HttpClientHandler.Proxy==null) but a
proxy is still desired (HttpClientHandler.UseProxy==true). In this case,
the semantics implied are to use the system default proxy settings to
find a proxy. In that case, the credentials specified by
DefaultProxyCredentials should be passed to the webrequest.Proxy object
which, by default, points to the system proxy.
Commit migrated from https://github.com/dotnet/corefx/commit/e5306b55c0267c0369e5da9bef0467d2ea4e9b51
This change to enable remote execution of all corefx tests in UAP. Because the remote execution code for UAP is using WinRT APIs and to avoid forcing adding UAP configuration to all test projects, we factor the remote execution code into its own test library (called TestHelper) which is cross compiled.
Commit migrated from https://github.com/dotnet/corefx/commit/eb2f543b189e8f7f9ae4c31e832ac9d3c22bb41a
In situations where setting ServerCertificateValidationCallback would result in a PlatformNotSupportedException, if it was set to DangerousAcceptAnyServerCertificateValidator instead simply disable CURLOPT_SSL_VERIFYPEER and CURLOPT_SSL_VERIFYHOST. This enables a common case of `delegate { return true; }` to work on libcurls with non-SSL backends, such as the default on macOS.
Commit migrated from https://github.com/dotnet/corefx/commit/65bdb971e1d97c930c59939ed7ac3f7ab364bfb0
* Remove SerializableAttribute from many CoreFX types that will not be serializable.
* Removes serialization tests for types that are no longer serializable and fixes serializing a couple of types. Includes marking some internal serializable types as public so that they'll be reflectible with .NET Native.
* Remove unneeded pragmas
* Update based on review comments
Commit migrated from https://github.com/dotnet/corefx/commit/6dd451f51451a7d0ceea6104b51bd17005e9a0e6