To support future security improvements, the default value for WinHttpHandler.SslProtocols will use the enum value of .None. This means that no preferred list of protocols is being expressed. And that means to use the best OS defaults. Currently this translates into using "Tls10 | Tls11 | Tls12".
This list will change over time as platforms adopt newer Tls versions and phase out older versions.
Commit migrated from https://github.com/dotnet/corefx/commit/9530ca89d99e2778d7882847230c462798e59544
It turns out that setting the WinHTTP 'Connect' timeout does nothing. We discovered this because we still got ERROR_WINHTTP_TIMEOUT errors after about 20 seconds even after setting the 'Connect' timeout to INFINITE. We discussed this with the WinHTTP team and they told us that this timeout is essentially deprecated due to performance enhancements in the TCP stack.
For the technically curious, here is the explanation. Underneath the 'Connect' timeout is really a set of TCP timeouts related to setting up the socket via the 3-leg SYN/ACK exchange. The TCP timeout is about retransmits with backoff and how many is tried by the winsock stack. The default of these initial packet exchanges is 21 seconds with 2 retransmits (3 overall SYNs) and initial RTO of 3 (3 + 6 + 12). So that explained the timeouts we saw during periods of high network congestion.
There is no API exposed in WinHTTP to control those low-level TCP timeouts. And thus it doesn't make any sense to have a 'ConnectTimeout' on the WinHttpHandler class.
Commit migrated from https://github.com/dotnet/corefx/commit/ee0b3a76c8c57ef80d1d53a16deb5b0bc6b46793
Building on the current use of environment variables for passing in test settings, added a common test helper class to allow the http and websocket tests to access alternate test servers. This will help with load balancing and network latency issues which are causing occasional timeouts in CI tests. This will also allow developers to run their own version of the Azure test endpoints. Consolidated the current environment variables used and standardized on a naming format.
Fixesdotnet/corefx#2383.
Commit migrated from https://github.com/dotnet/corefx/commit/3603ed2578220f0ecb2f101324e04acb80fa3196
WinHttpHandler often creates an exception in response to some native error code and then stores that exception into a Task. As the exception isn't actually thrown until it's propagated out at the eventual await site, the these exceptions often lack a good stack trace to help highlight where the error came from.
This commit ensures that such exceptions have a stack trace by throwing and catching them before storing them into either another exception as an inner exception or directly into a Task. I've not touched cases where the exception was already being thrown or where an exception was wrapping another exception that has a stack trace.
Commit migrated from https://github.com/dotnet/corefx/commit/31bd97c86fd90faeb977d67c495198dbb2a96000
*
In WCF repo many of our test projects are more than one level below the 'tests' directory.
*
If this doesn't break anything in corefx could we take this change?
* Amending to remove corefx\src\System.Net.Sockets\tests\PerformanceTests\System.Net.Sockets.Async.Performance.Tests.builds
* Amending again with more test .builds files that needed to be removed.
Commit migrated from https://github.com/dotnet/corefx/commit/8cac0d4afab96e15837818ca1abfbd9068008458
This change uses some features available in an updated version of
buildtools. Instead of resolving the test-runtime for each of our test
projects as a separate step, we will now add a "reference" to it from the
project.json of each test project. This will allow us to resolve the nuget
assets from both it and the test project at the same time. This will be
more robust than our current process, which is very fragile and
error-prone.
The above is made possible by an updated version of
"PrereleaseResolveNuGetPackageAssets", which is the buildtools task
responsible for resolving test assets from nuget packages. This task also
has a lot of additional validation, which triggers a lot of warnings in
corefx. I've made various changes to csproj's and to project.json's around
the repository in order to satisfy those warnings.
Commit migrated from https://github.com/dotnet/corefx/commit/622ee8f512497fc07621de15e41c6bd575f387c9
There were a handful of test projects that just didn't have .builds
files and some other cases where the data in the .builds file did not
match what was in the UnsupportedPlatforms metadata.
Some of the projects said the tests were unsupported on FreeBSD and
nowhere else. Given that these tests should most likely be supported on
FreeBSD (given that OSX and Linux both supported them), I've not moved
that logic into the .builds files.
If there ends up being a specific set of tests that the FreeBSD port
team wants to disable long term, they can add .builds metadata as they
see fit.
Commit migrated from https://github.com/dotnet/corefx/commit/836c6f12e1a05749d7d5bf27d02bd28f98eb76aa
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
In order to support WindowsProxyUsePolicy.UseWinInetProxy, WinHTTP provides the WINHTTP_ACCESS_TYPE_AUTOMATIC_PROXY option. This allows for reading the per-user registry settings to determine how to find a proxy for a given url. This includes using WPAD protocol to find and execute a Javascript PAC file. The WINHTTP_ACCESS_TYPE_AUTOMATIC_PROXY only works on Windows 8.1 and above. For Windows 7 and Windows 8, we have to manually do the work and the WinInetProxyHelper class provides for that by calling various WinHTTP APIs.
This fix is about having the AUTOMATIC_PROXY behaviors work the same whether done automatically by WinHTTP or manually using the WinInetProxyHelper class. In general, errors processing the auto discovery logic should be ignored and the proxy settings should fallback to manual settings if present in the registry.
This is difficult to test in an Xunit test since registry settings need to be changed as well as recycling the "WinHTTP Web Proxy Autodiscover Discovery Service" since it caches PAC file processing. So, this was tested manually for now and additional traces were added to the WinInetProxyHelper class.
Fixesdotnet/corefx#6011
Commit migrated from https://github.com/dotnet/corefx/commit/25ebb1bff1526bbc81d622ba7fc7749181c458fa