* Implement HttpContent and HttpClient cancellation APIs
Implements APIs approved in dotnet/corefx#32615 and dotnet/runtime#576
* Use new CreateContentReadStreamAsync overload in MultipartContent
* Expose HttpContent.SerializeToStreamAsync overload with cancellation
* Remove HTTP_DLL preprocessor directives
* Rename WIN_HTTP_HANDLER to WINHTTPHANDLER_DLL
* Use more 'var' where type is obvious
* netcoreapp -> netcoreapp5.0 in .sln files
* netcoreapp; -> netcoreapp5.0; , netcoreapp- to netcoreapp5.0-
* netcoreapp- -> netcoreapp5.0 in .csproj
* 'netcoreapp -> 'netcoreapp5.0 in .csproj
* done with libraries sub folder
* missed semicolon
* minor changes
* netcoreapp -> netcoreapp5.0 in some extra files
* vNext target variable in configurations.props
* netcoreapp => netcoreapp5/0 in some other .props file
* netcoreapp -> vnext in .csproj
* making the netcorepap framework switch work
* fixing sendToHelix and linux build
* TargetFrameworkVNext -> netcoreappCurrent
* case correct netcoreappcurrent
* fixing send to helix zip path
* netfx -> net472 in .sln
* netfx; -> net472; in .props
* netfx- -> net472- in .props
* netfx - -> net472- in .csproj
* 'netfx-> 'net472 in .csproj
* netfx -> net472 manual change
* fixing ci build for netfx
* Not trying to change the global property
* Fixing build failure due to master changes in net https tests
* adding documentaiton and fixing filtering
* netcoreapp -> netcore5.0 in py file
* changing the path to use netcoreapp5.0 version
* feedback and override corefx path corrected in installers
* remaing netcoreapp5.0 changes done
* netcoreapp-> netcoreapp5.0 after live builds
* net472 -> netframeworkcurrent
On retrieving a connection from a pool, HttpConnectionPoolManager adds the current user identity to the HttpConnectionKey for direct and proxy connections when the default credentials is used on Windows platform. Since on Unix there is not the concept of a user identity on the thread, the identity component in the key is always set to string.Empty.
Fixesdotnet/corefx#39621
This is just prelminary, as all of the docs need to be rationalized with each other now that they're all in the same repo. But it at least keeps most of the links working for now.
* Fix test build break and update common path usages to use property
* Use normalize directory for CommonPath and CommonTestPath
* Update instances of CommonPath and CommonTestPath to not use trailing \
HttpResponseMessage.TrailingHeaders property is set to a new special instance of HttpResponseHeaders configured to validate trailing headers based on their names instead of types. When a header is being added via an explicit Add call, it checks the header type for the NonTrailing flag indicating a prohibited trailing header and throws an exception if it is found. In contrast, when a header arrives on the wire and is being added with TryAddWithoutValidation call, no extra check is performed because HttpConnection validates trailing headers in this scenario.
Fixesdotnet/corefx#41262
Commit migrated from https://github.com/dotnet/corefx/commit/805d06affd41715db4fb6102e05345d6323fcdf1
Some of the client certificate tests weren't running because they were conditioned on having
the "test root" installed. But that isn't needed for these tests.
Moved test to the loopback server. Also, cleaned up code which assumed the tests ran against
.NET Framework or UAP which isn't true anymore.
Commit migrated from https://github.com/dotnet/corefx/commit/a6c0e516956acd30bf412fc23bcb6b82cbb490ae
Many of our RemoteInvokes are there purely because of needing to change the current thread culture but on UAP that actually impacting the whole process. Until that's addressed, we can at least avoid the RemoteInvoke on all platforms other than UAP. There are also some RemoteInvokes that can be avoided by just serializing all of the (small number of) tests in a test assembly. And there's some additional cleanup to be done as well around not explicitly returning an exit code unless required.
This helps measurably with test performance. Consider the System.ComponentModel.Annotations test suite. On my machine, prior to these changes, it took ~25 seconds; after these changes, it takes ~0.3. It helps even more when running against a checked runtime, where all of our test costs are magnified. With a checked runtime, prior to these changes, it takes ~196 seconds; after these changes, it takes ~2.5 seconds. This should help measurably with CI time in coreclr.
Commit migrated from https://github.com/dotnet/corefx/commit/cd18bafbabf7fe47601f6f790d157409034a2477
* Make WebRequest.GetSystemWebProxy() return a working proxy
Today it returns a singleton on .NET Core that throws PlatformNotSupportedExceptions, and is only used for its reference identity by the WebRequest implementation. This is problematic for existing code that's taking this proxy and passing it to, for example, ClientWebSocket's Proxy, as it will end up being an expensive nop. In fact, there's currently no way when targeting netstandard2.0 to tell ClientWebSocket to use a default proxy.
With this fix, WebRequest.DefaultWebProxy (which just defaults to GetSystemWebProxy()) will now return HttpClient.DefaultProxy, which is actually a working proxy implementation.
* Stop throwing NotSupportedException from HttpClient.DefaultProxy.set_Credentials
The OS and how the environment is configured determines what concrete type is returned from HttpClient's DefaultProxy property. And currently these different types behave differently from set_Credentials. Two of them are throwing NotSupportedException, which is not expected from the IWebProxy interface. We should just roundtrip the credentials set, even if they're not used.
Commit migrated from https://github.com/dotnet/corefx/commit/8d21b79b924d29088dbde46d42737a657d466b5e
* Do not force-parse TryAddWithoutValidation headers in SocketsHttpHandler
When enumerating headers to write them out, do not force them to be parsed if the user explicitly asked for them not to be with "WithoutValidation". If the key/values are incorrectly formatted, the request may end up being written incorrectly on the wire, but that's up to the developer explicitly choosing it.
* Revert HttpRequestHeaders.ExpectContinue optimization
Several releases ago, when we weren't paying attention to ExpectContinue, we optimized away the backing field for it into a lazily-initialized collection; that made it cheaper when not accessed but more expensive when accessed, which was fine, as we wouldn't access it from the implementation and developers would rarely set it. But now SocketsHttpHandler checks it on every request, which means we're paying for the more expensive thing always. So, revert the optimization for this field.
* Avoid allocating a string[] per header
When we enumerate the headers to write them out, we currently allocate a string[] for each. We can instead just fill the same array over and over and over.
Commit migrated from https://github.com/dotnet/corefx/commit/4d346a9ab7b6e619dae3784283acb87bb7a825c9
* Remove System.Net.Http dependency on System.Text.RegularExpressions
This dependency is the only reason we end up with a 105K System.Text.RegularExpressions.dll as part of a trimmed new MVC app. Regex is used in the case where on Windows a bypass list is provided, in which case each item in the list is changed into a regex, which is then evaluated against each url provided to SocketsHttpHandler. But the patterns usable are simple: the only special character recognized is an asterisk, which can map to zero or more of any character. So, we can instead employ a simple processor for such patterns, which then eliminates the need to reference System.Text.RegularExpressions.dll from System.Net.Http.dll. It also happens to be faster.
* Address PR feedback
* Update src/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpWindowsProxy.cs
Co-Authored-By: Jan Kotas <[email protected]>
Commit migrated from https://github.com/dotnet/corefx/commit/0e65e923689962f9634b5948d15f995140cc7c93