* Enable full duplex communication with ManagedHandler
ManagedHandler currently waits for all of the request content to be sent before it processes any response content. While that matches with what many servers do (not sending any response content until all request content has been received), some sites and situations do benefit from or even require full duplex communication, such that the response can be processed even while the request content is being sent. This change is also a necessary step towards enabling Expect: 100-continue, as we need to be able to receive the response header before having sent the content, and even without Expect: 100-continue, this allows us to stop sending a large request body if a server quickly sends back a status indicating the transfer isn't needed (e.g. a redirect).
This change also improves on the cancellation support for sending the request body. The send cancellation token is now embedded in the request content stream and uses that token for all operations.
* Address PR feedback
- Don't force flush the headers before sending content.
- Skip the write buffer when using ContentLengthWriteStream
- Fix some typos
Commit migrated from https://github.com/dotnet/corefx/commit/a326d79a4fac6e82839ab1d672a2e536b6c81754
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
- In ManagedWebSocket, there's no need to use a [ThreadStatic] to store a byte array into which we get random bytes that are then copied to the right portion of the destination array... we can just generate directly into the destination array.
- In ManagedHandler, we can use the new Span-based overload to avoid needing to allocate a 1-byte array (and we certainly don't need to allocate such an array 16 times).
Commit migrated from https://github.com/dotnet/corefx/commit/58024e5486531128c6ecf8f46ae7021343550fa9
* 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