* Enable tests to compile with netstandard
Most of the tests have netstandard configurations and it doesn't compile. the changes here is to fix the configurations and the tests to compile.
This is important step to get netfx tests compile too as we are in most of the time netfx fallback to netstandard configuration
The changes include some fixes to compile teh sources too.
* Fix System.Collections.Immutable
* update src configuration
* remove netstandard17 defines
* Split netcoreapp code to its own files
* Remove 17 from the test class name
Commit migrated from https://github.com/dotnet/corefx/commit/15b4f51c2f3cb924840e5407bb8d5fe03bb282ea
* Enable compiling the test projects against the configuration
The tests were compiled using the vertical configuration and not the best configuration picked from Configurations.props. this change is fix that and have all test projects configured accordingly.
This change ensuring netcoreapp runs successfully and we'll have another rounds later for other configurations like netfx, UAP...etc.
* Fix openssl test project on Linux distros
* Update the project configurations
* Update VS solution files
* update solution files
Commit migrated from https://github.com/dotnet/corefx/commit/e79912f8b77bc22abfd85e94b74c06e5d99e8381
When sending request data from something other than a byte[], CurlHandler allocates a buffer to transfer data from the request to libcurl, typically 16K (unless the request content is known to be smaller than that). We can use a buffer from ArrayPool for that.
Commit migrated from https://github.com/dotnet/corefx/commit/6e4d5a1dbac460af9df29e2f3c839c42c503d8ff
Regardless of whether we already had a content stream, we were allocating a closure object on every call to the transfer function.
And for a common case of ReadAsStreamAsync completing synchronously (as it does with StreamContent), we were unnecessarily allocating several tasks as well as a delegate. We can instead add a fast path that does the logic synchronously when the task completes synchronously.
Commit migrated from https://github.com/dotnet/corefx/commit/8b847350441571695c00d182c692ff84c3346be2
* Fix exception when parsing HTTP/2 status line.
* Extend curl tests to cover "HTTP/2" status line
Extend existing tests to cover status line with major version only.
HttpResponseMessage.Version should still have a value of (2, 0) to ensure
compatibility with Windows (see HttpVersionInternal) and full .NET
Framework, not a value of just (2).
Commit migrated from https://github.com/dotnet/corefx/commit/8ddccab25885029a382db319ce65c54d2122d181
This PR addresses the problem seen in dotnet/corefx#11100. Here is a summary:
1) The original .NET Framework (Desktop) code for the HttpClientHandler implementation has been ported for this net46 build. It replaces the WinHttpHandler based code that is used for the other builds of .NET Core (Windows). This means that it uses the original HttpWebRequest (HWR) code in .NET Framework System.dll which is based on managed sockets. This ensures we go back to 100% app-compat behavior against .NET Framework. This also means that existing code that uses ServicePointManager to control behavior will also work 100% app-compat. One downside of this PR is that HTTP/2 protocol support is no longer available since we are reverting back to original .NET HTTP stack for the net46 build. If HTTP/2 protocol support is required on .NET Framework (Desktop), then a developer can use the separate WinHttpHandler package to get that.
2) The System.Net.Http.dll assembly is now marked as APTCA (Allow Partially Trusted Callers) similar to the original annotation of the .NET Framework version of the assembly. As part of this, a few security annotations were added to source code that is being compiled from the CoreFx repo. The SecAnnotate tool was used to verify the annotations and the tool now runs clean against this assembly.
3) This PR also addresses the problem introduced where .NET Framework WebRequestHandler wasn't compatible with the OOB System.Net.Http.dll on Desktop. I manually tested packages with this change and verified sending an HTTP request. There is no longer any "Derived types must either match the security accessibility of the base type or be less accessible" exceptions.
4) The tracing mechanism of this implementation implicitly re-activates the System.Net tracing (TraceListener based) since we are now going back to the original .NET Framework HTTP stack. However, part of the source code for the rest of the assembly compiled in from .NET Core repo also includes the new DiagnosticSource tracing as well. There didn't appear to be any negative consequences of leaving this in as it simply adds extra tracing on top of the original System.Net tracing.
5) There are 8 new properties that were added to the HttpClientHandler class compared to the original HttpClientHandler defined in .NET Framework. These new properties are part of the NETStandardard2.0 definitions. Due to switching back to the original HTTP stack implementation in Desktop, some of these new properties can not be implemented fully since there are incompatibilities between defining them as per handler instance compared to the actual underlying ServicePointManager implementation. So, some of these properties will throw PlatformNotSupportedException for now. Since these were newly added properties, the expectation is that there will be minimal app-compat affect.
6) Even with this PR, any project using an OOB (Out of Band) assembly such as System.Net.Http.dll might be REQUIRED to have binding redirects in their app.config/web.config. This is because there needs to be a way to reconcile onto ONE assembly version of the same name. In particular implicit and explicit references to something like the .NET Framework System.Net.Http.WebRequest.dll (which contains WebRequestHandler) is bound to the System.Net.Http.dll version 4.0.0.0 of the .NET Framework. Once an OOB System.Net.Http.dll is introduced, there is now another version of System.Net.Http.dll with a different version number. For the current master branch, the System.Net.Http.dll assembly version is 4.2.0.0. Note that the assembly version is disjoint from the NuGet package version (currently at 4.4* in the master branch). So, this requires a binding redirect in the app.config/web.config similar to:
```c#
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
</dependentAssembly>
</assemblyBinding>
```
Tooling such as Visual Studio will normally create this binding for you. But we have seen cases where it doesn't do it automatically. Please keep this in mind.
If you don't have any binding redirects for System.Net.Http.dll, you will potentially get errors when sending an HTTP request such as this:
>System.InvalidCastException: [A]System.Net.Http.Headers.MediaTypeHeaderValue cannot be cast to [B]System.Net.Http.Headers.MediaTypeHeaderValue. Type A originates from 'System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' in the context 'Default' at location 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Net.Http\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Net.Http.dll'. Type B originates from 'System.Net.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
* Adding src.
* WIP: Added handler and assemblyinfo.
* Fix up string resources errors
* Remove Rtc support
Rtc only works for Windows 8 Store apps. Windows 10 UWP dropped support
for Rtc.
* Remove unneeded source files from net46 build
* Adding back internal HttpContent.CopyTo
* Add newer HttpClientHandler properties
Compiles now.
* Removed NET_4 defines
* Reformat
Use CoreFx naming convention for fields (use underscore, etc.)
Put properties in alphabetical ordering
* Remove unneeded DEBUG hooks
* Update new property implementation
Fix up security annotations
* Fix up security annotations
Add required annotations. SecAnnotate tool now runs clean against
System.Net.Http.dll.
* Address PR feedback
Commit migrated from https://github.com/dotnet/corefx/commit/d24ddedc5edb10d4ed385a1eb8bfb2351a117cd5