As per the latest security review, this issue captures the following tasks in order to remove insecure automatic redirection of HTTPS -> HTTP in HttpClientHandler/WinHttpHandler. This will also match the current NETCore/NETNative behavior as well.
In general, the security guidance is to remove insecure patterns from new code/platforms. This helps the entire ecosystem become more secure while balancing the needs of app-compat.
1. Change the WinHttpHandler API surface to remove the AutomaticRedirectionPolicy enum 3-state value.
2. Change the name/type of the 'AutomaticRedirectionPolicy' property to 'bool AutomaticRedirection'. This matches the current Framework Design guidelines of fully spelling out words and the word pattern of the 'AutomaticDecompression' property.
3. The default for the AutomaticRedirection property will be true. This value means that all redirects will be followed automatically EXCEPT for https:// to http://. This behavior is different from .NET desktop where https:// to http:// redirects are also followed.
[tfs-changeset: 1498199]
Commit migrated from https://github.com/dotnet/corefx/commit/4c99b29d6718af2de6d5e53869c694054cae161b
This property has been effectively deprecated. It was left unimplemented in WinHttpHandler until we realized that we should remove it from the public WinHttpHandler contract.
In the .NET Desktop, the equivalent HttpClientHandler.MaxRequestContentBufferSize property was only used when the handler needed to automatically buffer the request content. That only happened if neither 'Content-Length' nor 'Transfer-Encoding: chunked' request headers were specified. The advice to developers is to always be precise with the headers and explicitly choose the transfer mechanism. So, this condition is an edge case.
When left ambiguous, the handler thus needed to buffer in the request content to determine its length and then would choose 'Content-Length' semantics when POST'ing.
In CoreCLR and .NETNative, the handler will resolve the ambiguity by always choosing 'Transfer-Encoding: chunked'. The handler will never automatically buffer in the request content.
[tfs-changeset: 1492780]
Commit migrated from https://github.com/dotnet/corefx/commit/1183c8183fb25c6f577e91c72bdcd0036fd2ef05
Since the underlying HTTP stack in NETNative (Windows.Web.Http) supports HTTP/2.0, we are changing the default value HttpRequestMessage.Version property to 2.0. HTTP requests sent to servers that don't actually support HTTP/2.0 will result in the connection operating with HTTP/1.1.
[tfs-changeset: 1478638]
Commit migrated from https://github.com/dotnet/corefx/commit/7c551c4ff3cd312e60082f454660962932f53b7b