* 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
This enables users of X509Chain to specify a priori a set of trusted root authorities, which is used in place of the default root authorities.
By explicitly specifying the root authorities the caller enables revocation checking for normally untrusted roots, and simplifies the certificate acceptance by having the chain engine tell them if the root matched, vs doing a post-build check (in the case of cross-certified authorities this even tells the chain engine which path to prefer).
Commit migrated from https://github.com/dotnet/corefx/commit/e70e76159b3f34e4e35d241daf39d4f57f4bd82c
* 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
* fix cancelation tests to work with http2
* fix more tests and feedback from review
* feedback from review
* fix issues with missing connection: close
* update body check
* feedback from review
* fix resolve
* feedback from review
Commit migrated from https://github.com/dotnet/corefx/commit/5108d9245b891deeb36a164f434f4fb6975c8baf
Most of these to WaitAsync shouldn't actually matter, as the semaphores being used are there for corner cases or to protect erroneous usage, but if there's no contention, passing a token won't hurt, and if there is contention, passing the token makes it more robust.
Commit migrated from https://github.com/dotnet/corefx/commit/14a7adb23569363b94d575d64b7cb1f38cda3e4a
However, I'm not enabling the rule permanently, as it disagrees with VS IDE0055 about the spacing around semicolons at the end of empty while and for loops.
Because this also impacts `for (;;)` loops, I also searched and replaced those with `while (true)`, to standardize on that across the codebase.
Commit migrated from https://github.com/dotnet/corefx/commit/93285e4511a9656a30b92b8b6a9088608aac40e0
* HttpStress: add a 'GET Slow' operation
Adds a 'GET Slow' operation. Additionally randomize
the response content in GET requests. These are
validated by having the client specify the expected
content length in request headers.
Commit migrated from https://github.com/dotnet/corefx/commit/ba8156d2f0d206655caf0713f6bed0265f48f098
Mechanical/automated change. The only manual changes were a) removing the two rules from the CodeAnalysis.ruleset file, b) removing spaces from one line of a .targets file that is used to generate a .cs file, and c) reverting the changes in a few test files where the naive replacement happened in the middle of a verbatim string where the whitespace actually mattered.
Commit migrated from https://github.com/dotnet/corefx/commit/09a6e66b0c2b31bd0f6e7e3170537d14027aeed0