* Cleanup Windows 10 version detection
Windows 10 Version 1709 ("Fall Creators Update") has been released. This
PR cleans up the version detection to use the latest RTM build numbers
and removes obsolete InsiderPreview detection for those tests.
Also, removed ActiveIssue for tests that are now fixed due to Windows 10
fixes.
Fixesdotnet/corefx#22187
* Addressed feedback
Commit migrated from https://github.com/dotnet/corefx/commit/ac410223aa763a0f67880815057ee1bfe0f4cb6e
* add minimal handling for 1.0 requests.
* use 1.1 as default version and move some message to resource file
* fix spelling
* remove exception for 2.0 requests and fall-back to 1.1
* remove s_spaceHttp20NewlineAsciiBytes as it is not used now
* add isHttp10 bool to avoid duplicate check.
Commit migrated from https://github.com/dotnet/corefx/commit/8b266d0ca4a12428629b3a7abf79c61c29e50883
A bunch of tests have the following structure:
```C#
var clientTask = hc.GetAsync(...);
await server.HandleRequest();
Handle(await clientTask);
```
If the HttpClient request fails in a way that causes the server not to receive the request, the test will hang, as the await for the server operation to complete will never complete.
This commit changes a bunch of the tests to avoid that pattern. This makes several of the tests disabled due to hanging actually reveal the cause of the problem, e.g. the ManagedHandler not supporting 1.0 requests and failing immediately if provided with that version without making a request to the server.
Commit migrated from https://github.com/dotnet/corefx/commit/e34b6fd99085c69c8fd7a64ed5eb4da5b66f4136
* Moving PlatformDetection to Corefx.Private.TestUtilities assembly
The purpose of this change is to clean up all test projects instead of including the PlatformDetection code inside every test project, we’ll have it in the Corefx.Private.TestUtilities.
I have refactored the PlatformDetection to split the different implementation of Windows and Linux. If we need to do more refactoring there we can do it later as needed.
* Fix Linux BB
* Update the xunit package reference
* Fix wrong condition on one of the tests
* Update the ConditionalFact/Theory to use Type as a parameter
Commit migrated from https://github.com/dotnet/corefx/commit/878e2fcf5a9f1068015e5fada9231088663e3490
* Fix HttpClient redirection logic on UAP
This PR changes the implementation of sending requests in HttpClient for UAP when
dealing with redirection. In the past, we would let the WinRT layer handle auto
redirection logic. However, due to dotnet/corefx#9003, the cookies were getting lost on 3xx responses
since the .NET layer didn't see them. So, this PR implements the redirection ourselves.
One important part of redirection is that we need to drop credentials. The WinRT layer
did this for us. However, we are unable to use a single WinRT HttpBaseProtocolFilter object
since we need to remove the credential after the first redirect. So, we need to maintain
a second filter that uses no credentials and keep it in sync regarding all the other properties
of the primary filter.
With this PR, the behavior of other aspects (such as controlling max number of redirects, etc.)
now matches .NET Framework. So, some tests were adjusted to remove the UAP specific behavior
checks.
Fixesdotnet/corefx#9003Fixesdotnet/corefx#22191
* Disable test on Linux
* Address PR feedback
* Disable failing HTTP/2 test
Commit migrated from https://github.com/dotnet/corefx/commit/f2308f8db0679ac63e8e7eeac9d56cb035d6d9e3
* Reconcile behavior of MaxRequestContentBufferSize across .NET Core
The HttpClientHandler property, MaxRequestContentBufferSize, has been
deprecated. This PR reconciles the behavior of the getter and setter of
the property.
Similar to other decisions in HttpClient PRs with these kinds of
behavior differences, we are not going to throw PNSE. We will document
the differences in the AppCompat docs.
Fixesdotnet/corefx#7879
* Address PR feedback
Commit migrated from https://github.com/dotnet/corefx/commit/e740973fed660da4426218bf2ec4be35a60ad095
* Re-enable anf fix Http tests for UAP
* Removed ActiveIssue from a bunch of Http tests.
* Converted some ActiveIssue to SkipOnTargetFramework due to
platform differences.
* Change some tests to use RemoteInvoke to get process isolation
since UAP will cache connections per-process.
* Removed a duplicate ChannelBinding test. There is already the
same test in HttpClientHandlerTest.ServerCertificates.cs
(PostAsync_Post_ChannelBinding_ConfiguredCorrectly). And that
test checks more things.
Contributes to dotnet/corefx#20010
* Address PR feedback
Commit migrated from https://github.com/dotnet/corefx/commit/a3cd07a7b608358710ac073cbe41f65866aa929a
This PR clarifies how credential handling and specifically default
logged-on credentials actually works on the UAP platform.
First, "default credentials" are the current credentials of the
logged-on user, typically on an enterprise network joined to an
Active Directory domain. When these credentials are sent to a
proxy or server, only Negotiate, Kerberos, or NTLM schemes are
used. Those credentials can never be sent via other schemes
like basic or digest.
.NET Framework traditionally has two ways for developers to specify
using default logged-on credentials to send to the server. Either
set the .UseDefaultCredentials property to true or specify
CredentialCache.DefaultCredentials to the .Credentials property.
For proxy credentials, the developer could pass DefaultCredentials
via the custom IProxy object or via the .DefaultProxyCredentials
property.
.NET Framework would send default credentials anywhere (intranet
or internet) if specified by the developer.
The UAP platform implementation of System.Net.Http uses a different
set of rules for sending default credentials. It is based on whether
the app has Enterprise Authentication capability as well as if the
endpoint is specified in an intranet zone. This design is part of
the base native WinInet and WinHTTP stacks. It was a design choice
to provide optimum security as well as convenience for developers
writing apps for enterprise scenarios.
This PR does a few things. First, it keeps the .NET ICredentials
properties stored separately so that they correctly round-trip
on get and set. .NET NetworkCredential has 3 parameters (domain,
user, password). But WinRT PasswordCredential only has 2 parameters
(user, password). We now convert to the WinRT objects only when
we need to use them.
Second, this PR clarifies that the .UseDefaultCredentials property
is basically a no-op because the API models of default credentials
handling is different on the UAP platform as described above.
These platform differences will be documented here:
https://github.com/dotnet/corefx/wiki/ApiCompatFixesdotnet/corefx#19642Fixesdotnet/corefx#21510
Commit migrated from https://github.com/dotnet/corefx/commit/2c33453f3e4064c75d404c6f3590ddf00a377d10
Due to platform differences on UAP and the current use of WinRT APIs to
implement that HTTP stack, a few properties won't have the same defaults
or behavior.
CheckCertificateRevocationList default value is true for UAP and can't
be changed. However, on UAP, revocation checking that results in an
indeterminate status (i.e. revocation server offline) is treated the
same as a valid result. This is the behavior of the underlying WinRT
APIs.
SslProtocols default value is SslProtocols.None which is the same as the
rest of .NET Core. 'None' means to use the system default. However, changes
to this property value will be ignored.
Similar to the decision made in PR dotnet/corefx#21403, we don't throw PNSE for these
differences. Instead we just no-op on the property setter.
The behavior differences will be documented in:
https://github.com/dotnet/corefx/wiki/ApiCompat
Contributes to dotnet/corefx#18116.
Commit migrated from https://github.com/dotnet/corefx/commit/711f785f072c8131b9d49792eeab02d2d55be662
The HttpClientHandler for UAP does not properly implement the PreAuthenticate
property. This is because on UAP, HttpClientHandler is built on the WinRT
APIs which in turn are built on WinInet. And WinInet always uses authentication
caching internally and this results in the net effect of PreAuthenticate always
being "true".
The default for .NET Framework and .NET Core (non-UAP) is "false".
When this property was first added to .NET Core 1.1, the UAP version defaulted
to true and the setter would throw PNSE.
As part of .NET Core 2.0, API surface for networking APIs was expanded. This
resulted in HttpWebRequest exposing and implementing a "PreAuthenticate" property,
which is what it has historically done in .NET Framework. On .NET Core, HttpWebRequest
is built on top of HttpClient. And so, HttpWebRequest was enhanced in .NET Core 2.0
to set the default of PreAuthenticate to false. But this later caused the PNSE
exception to surface and this exception was caught in UWP app-compat testing.
Essentially, we had now created the default HttpWebRequest to always throw an
exception.
So, in PR dotnet/corefx#18105, the PNSE in HttpClientHandler.PreAuthenticate was commented out
and thus the setter became a no-op.
This PR basically acknowledges this situation and removes the TODO from this change.
Since there is no good way to implement the actual HttpClientHandler.PreAuthenticate
property, I left the getter default to return "true" which is closer to reality of
what happens on UAP (even though this default value is different from .NET Framework
or the rest of .NET Core). And, in terms of the setter for the property, I opted to
leave it as a no-op. This seems like the best compromise outcome for now and will
generate less distraction for developers rather than throwing an exception all the
time.
The rest of this PR moves the ActiveIssue's from the class level to the method level
as part of eventually solving all of them. In addition, I added a new test case to
validate the HttpClientHandler constructor defaults that are different on the UAP
platform.
Fixesdotnet/corefx#18104
Commit migrated from https://github.com/dotnet/corefx/commit/c3b2f15d90972a5607415582681584965f16c01d