Commit Graph
1255 Commits
Author SHA1 Message Date
Stephen Toub 5636b5e703 Add debug state machine tracking to GoAwayFrame_NoPendingStreams_ConnectionClosed test (dotnet/corefx#38438)
Commit migrated from https://github.com/dotnet/corefx/commit/0b0df51dab6f641e2988846dd6913de2db30789c
2019-06-10 20:22:05 -07:00
Liudmila Molkova 4541251707 Enable tracing context propagation without listener in presence of parent Activity (dotnet/corefx#38280)
* Enable tracing context propagation without listener in presence of parent Activity
* tests for AppContext switch


Commit migrated from https://github.com/dotnet/corefx/commit/35ebd462cc03bddc7ac135b7ec218ebd8357f7b2
2019-06-08 18:55:56 -07:00
Krzysztof Wicher a5b8971c8d HttpClient: Try decode Location header using UTF-8 (dotnet/corefx#37852)
* Use desktop logic for parsing Location (try decode using UTF-8)

* Tests and feedback

* fix netfx

* Convert UTF-8 in non-allocating way without try .. catch


Commit migrated from https://github.com/dotnet/corefx/commit/02026907370c57380a9f091b54ee77873f276a68
2019-06-07 14:38:02 -07:00
Stephen Toub b585c84595 Add debug data to help diagnose HTTP2 test failure (dotnet/corefx#38345)
The GoAwayFrame_AbortAllPendingStreams_StreamFailWithExpectedException test has been frequently hanging on some Linux distros.  This adds some diagnostics to help track it down in CI: every minute, it'll dump out the fields of the async state machine, which if nothing else will let us see which await it's stuck on and what is the state of each of the tasks.

Commit migrated from https://github.com/dotnet/corefx/commit/410a162f68eb319e8066ac7bf2d7bcd6e2ce47d0
2019-06-07 16:09:38 -04:00
Marco Rossignoli bdc76b180d Fix digest authentication on SocketsHttpHandler (dotnet/corefx#38225)
* fix digest

* improve test

* address PR feedback


Commit migrated from https://github.com/dotnet/corefx/commit/94c5f1384c9b6477d164050de964cf6dcf99b2a9
2019-06-05 11:33:31 -07:00
Martin Baulig 0b774e783c HttpClient.SendAsync() should not attempt to read response body on a HEAD or PUT request. (dotnet/corefx#38129)
* HttpClient.SendAsync() should not attempt to read response body on a HEAD or PUT request.

* Update HttpMethod.cs

* Address feedback.

* Cleanup.

* Update HttpRequestMessageTest.cs


Commit migrated from https://github.com/dotnet/corefx/commit/73e610f847f9c5100a0cec4a80692969836ff35d
2019-06-04 16:52:27 -04:00
Stephen Toub fc7622a806 Fix catch block for cancellation in ConnectHelper.ConnectAsync (dotnet/corefx#38211)
There are logic errors in ConnectHelper's catch blocks regarding cancellation.  It's catching all exceptions and then trying to decide whether it should wrap the exception in an OperationCanceledException (based on whether cancellation was requested), but it's ignoring the possibility that the exception already is an OperationCanceledException.

Commit migrated from https://github.com/dotnet/corefx/commit/80252bbc5cf2f933aef1f30d6bec7deaa3064f54
2019-06-04 16:03:25 -04:00
Tomas Weinfurt 031db203d9 add support for 100-continue for H/2 (dotnet/corefx#36884)
* expect100

* updates

* remove dead code

* fix tests

* use configured value for allowExpect100ToContinue timer

* feedback from review

* dispose expect100Timer

* feedback from review

* feedback from review

* feedback from review

* small updates to sync up with master changes

* add concurent send/recive and more tests

* fix netfx

* feedback from review

* feedback from review

* feedback from review

* feedback from review

* feedback from review

* kick ci


Commit migrated from https://github.com/dotnet/corefx/commit/b4fa2006c2e9757e4446e3fdad413bdbf265eedc
2019-05-31 14:39:12 -07:00
Viktor Hofer b661c58b1c Replace netstandard test projects with tfms
Netstandard test projects are broken by design and don't support the
Microsoft.Net.Test.SDK. Replacing the netstandard tfm with the concrete
implementation tfms.


Commit migrated from https://github.com/dotnet/corefx/commit/d29c16c99c6045ee67444a7a693dd4476861c463
2019-05-30 16:18:41 +02:00
Tomas Weinfurt 06b43bd28e Enable MaxConnectionsPerServer_WaitingConnectionsAreCancelable again (dotnet/corefx#37933)
* enable MaxConnectionsPerServer_WaitingConnectionsAreCancelable afain

* skip with curl handler


Commit migrated from https://github.com/dotnet/corefx/commit/c6fc43c6f2b92d8e13a444217f29368159e015eb
2019-05-29 19:33:18 -07:00
Marco Rossignoli dbb09e4ab9 User-Agent header is ignored in "CONNECT" requests (dotnet/corefx#37785)
* flow UserAgent on CONNECT

* Apply Stephen feedback

* address PR feedback

* update test

* fix style


Commit migrated from https://github.com/dotnet/corefx/commit/1064d0352c007fd2d8fb32d7f6e286fbb6d41264
2019-05-28 09:36:25 -07:00
Tomas Weinfurt ed528dcdcb Move tests with external servers to outerloop (dotnet/corefx#37934)
* move tests with external servers to outerloop

* fix Set_ValidValues_Success


Commit migrated from https://github.com/dotnet/corefx/commit/d58a8ade31b4731759c92df00d0f6398c52f3d83
2019-05-27 14:48:04 -07:00
Viktor Hofer ba11d53cc1 Use Arcade DotNetTool and NuGetPackageRoot (dotnet/corefx#37647)
* Use Arcade props

* Use global dotnet if applicable

Commit migrated from https://github.com/dotnet/corefx/commit/f42e04b8d4be76b1818cf263ff06234d0e25ada0
2019-05-17 03:39:21 +02:00
Tomas Weinfurt 936c296657 update HTTP2 responce header processing (dotnet/corefx#37572)
* update HTTP2 responce header processing

* fix also trailinbg headers


Commit migrated from https://github.com/dotnet/corefx/commit/269a37755c788252385ceec472c619e68d676032
2019-05-14 09:52:45 -07:00
Stephen Toub bae550ef90 Move UseDefaultCredentials_SetToFalseAndServerNeedsAuth_StatusCodeUnauthorized test to OuterLoop (dotnet/corefx#37556)
Commit migrated from https://github.com/dotnet/corefx/commit/ae3262aa29e860eaee9fc5d96eba539a3b4fe084
2019-05-09 17:24:57 -04:00
Stephen Toub 57fb682075 Disable PostAsyncExpect100Continue_FailsAfterContentSendStarted_Throws on non-SocketsHttpHandler (dotnet/corefx#37553)
Commit migrated from https://github.com/dotnet/corefx/commit/a010364670e9a5a8df39d3d7eac97f0e129aaaa1
2019-05-09 17:24:31 -04:00
Jose Perez Rodriguez 7d8177c8c3 Fix VS Configurations for all projects in corefx (dotnet/corefx#37477)
Commit migrated from https://github.com/dotnet/corefx/commit/1c48331eb5784c58b81309665257f454abd7d322
2019-05-06 14:46:10 -07:00
Viktor Hofer 5b301aac62 Fix build break in HttpClientHandlerTest
Caused by https://github.com/dotnet/corefx/commit/dotnet/corefx@c412fa7dc60559dc38050c63b2e34b5156a2499e

Commit migrated from https://github.com/dotnet/corefx/commit/3075793b035cfa51d5b2a8aa0d388ee41faf2bf9
2019-05-03 12:23:37 +02:00
Tomas Weinfurt c5bf93e35c improve error handling on failed Http/2 handshake (dotnet/corefx#37050)
* improve error handling on failed Http/2 handshake

* remove extra space

* add test for HTTP2 client talking to HTTP1 server.

* fix broken tests

* improve exception handling

* update exception handling

* ws update

* fix bad merge

* update test and changes from dotnet/corefx#37223

* use _abortException only if the stream is not aborted already

* fix IsAborted check

* updates to syncup with recent changes


Commit migrated from https://github.com/dotnet/corefx/commit/c412fa7dc60559dc38050c63b2e34b5156a2499e
2019-05-02 23:31:53 -07:00
Tomas Weinfurt dcb8c42cc4 reject invalid pseudo-headers (dotnet/corefx#37069)
* reject invalid pseudo-headers

* feedback from review

* feedback from review

* fix typo in comment

* feedback from review

* syncup with recent changes


Commit migrated from https://github.com/dotnet/corefx/commit/1f159018b21e1f70fa2ade50d5e341f5ce457654
2019-05-02 23:23:27 -07:00
Stephen Toub 2c0c31e8e1 Fix SendAsync_No100ContinueReceived_RequestBodySentEventually test flakiness (dotnet/corefx#37371)
The server in the test was sending down the entire response and then trying to read the data from the client.  If the client sent its whole payload and read the response before the server go around to doing the read, the client might close the connection, in which case the read might fail.  The fix just changes the server code to only send down the headers, then read the data from the client, and only then finish the response, at which point it's fine if the client closes the connection.

Commit migrated from https://github.com/dotnet/corefx/commit/772aa2d1029caa8be3b360168b63dadd42ae788b
2019-05-02 14:56:19 -04:00
Stephen Toub e71767ffb2 Enable HTTP/2 in SocketsHttpHandler via HttpRequestMessage.Version (dotnet/corefx#37234)
We now respect the version: if it's 1.1, we use 1.1, and if it's 2.0, we try to use HTTP/2.  At the same time, the default for HttpRequestMessage.Version goes back to 1.1, so to use HTTP/2, you opt-in by setting the version explicitly to 2.0.

Commit migrated from https://github.com/dotnet/corefx/commit/d69d441dfb0710c2a34155c7c4745db357b14c96
2019-05-02 00:15:28 -04:00
Stephen Toub 36e9813414 Disable GetAsync_UnicodeHostName_SuccessStatusCodeInResponse test
Commit migrated from https://github.com/dotnet/corefx/commit/419a1fe5da1698ea3a380166ab70b11ab37dbde0
2019-05-02 00:12:02 -04:00
David Shulman 5ef49c6883 Implement HttpClient.DefaultProxy property (dotnet/corefx#37333)
This PR implements the new static HttpClient.DefaultProxy property which was approved
during API review.

Modify the SystemProxyInfo.ConstructSystemProxy method to a Singleton.

Modify SocketsHttpHandler to use the HttpClient.DefaultProxy property.

Rename the HttpSystemProxy class to HttpWindowsProxy.

Add some HttpClient tests for the new property.

Closes dotnet/corefx#36553


Commit migrated from https://github.com/dotnet/corefx/commit/c661db6ce2da91033671c0000afc185de1ad3fe9
2019-05-01 15:17:21 -07:00
Viktor Hofer 3c80118cf0 Publish test artifacts to AzDO (dotnet/corefx#37296)
* Publish test artifacts to AzDO

* Disable two flaky UAP tests

* Remove leftover buildconfiguration for netfx

* Disable flaky printer test

* Disable flaky PipeWriter test


Commit migrated from https://github.com/dotnet/corefx/commit/75a54c95e2d31370bf8b5024a5b68b3e83cefb2e
2019-05-01 23:48:48 +02:00
Stephen Toub da9012fbfb Disable AutomaticOrManual_DoesntFailRegardlessOfWhetherClientCertsAreAvailable test (dotnet/corefx#37339)
Commit migrated from https://github.com/dotnet/corefx/commit/07e6ac3476467af0b9825259de1cfa9487f0d9fa
2019-05-01 17:01:07 -04:00
Stephen Toub bf219ee41c Allow Http2Connection header-related processing buffers to grow (dotnet/corefx#37337)
They're currently hard-coded to have a max size.  We need to allow them to grow to deal with arbitrarily large headers. (Separately we'll want to enforce the max header size limit.)

Commit migrated from https://github.com/dotnet/corefx/commit/9bb0c8fd8865fc282ea44b67b0738ffbfef96410
2019-05-01 16:53:28 -04:00
David Shulman 3b63495bbe Internal Http SystemProxyInfo object should never be null (dotnet/corefx#37306)
In order to provide a consistent experience with the HttpClient IWebProxy objects,
the returned internal proxy object which represent the system/platform proxy settings
should never be null. If the platform's settings indicate that no proxy is being used,
then return an instance of the internal HttpNoProxy object.

Note that even if the platform settings indicate that a proxy could be used, any
particular Http request might still not go thru a proxy. The final determination of
what proxy is being used for a request is still governed by the return of the
IWebProxy.IsBypassed and IWebProxy.GetProxy methods.

Contributes to dotnet/corefx#36553


Commit migrated from https://github.com/dotnet/corefx/commit/830bf7fc0346d9453d85ad4ec726c92ac3e72998
2019-04-30 21:14:02 -07:00
Stephen Toub d59bb4ad4f Harden several SocketsHttpHandler streams against unexpected Dispose (dotnet/corefx#37299)
A few tweaks:
- We hand out the ChunkedEncodingWriteStream and ContentLengthWriteStream to an HttpContent.SerializeToStreamAsync.  If that user code disposes of the Stream, then we end up null ref'ing when we try to finish the processing.  We should instead throw a more descriptive error about the misuse.
- Make the non-pooled response streams slightly more robust against concurrent disposal (which is not a supported use, but it happens).

Commit migrated from https://github.com/dotnet/corefx/commit/422565673deb849b42f656f4a68bec791ee4bed9
2019-04-30 14:58:25 -04:00
Stephen Toub 484b1c373d Clean up HTTP/2 protocol exception handling (dotnet/corefx#37223)
* Clean up HTTP/2 protocol exception handling

- Propagate the GOAWAY and RST_STREAM error codes to the calling code via an exception.
- Propagate to the Http2Stream exceptions incurred in the Http2Connection and that result in an Abort.
- Don't Dispose of the Http2Stream before we try to Cancel it.
- Make Http2ProtocolException serializable, as we generally do that for all of our exception types.
- Add tests that verify sufficient HTTP/2 protocol details are in the exception messages.
- Clean up the error message for the exception.
- Separate the error code and exception into their own files.
- Leave Http2ProtocolException internal for now; we can expose it publicly when we design the all-up public error model for HttpClient.

* Address PR feedback


Commit migrated from https://github.com/dotnet/corefx/commit/7237da089c09531c36a2110a3bdd9ccaf7c05d77
2019-04-29 13:51:29 -04:00
David Shulman f5f0e003f1 Add proxy environment variables support for Windows (dotnet/corefx#37238)
Changed the Windows version of SocketsHttpHandler so that it will honor the same environment
variables similar to the Linux and OSX versions. If the environment variables are not set
then it reverts back to the Windows WinInet/IE settings behavior.

I added several kinds of unit and end-to-end tests to verify the SystemProxyInfo class is
making the correct choice for all the different platforms regarding whether the
HttpEnvironmentProxy or platform proxy (HttpSystemProxy for Windows and MacProxy for OSX)
is used.

Fixes dotnet/corefx#37187


Commit migrated from https://github.com/dotnet/corefx/commit/4f27d0f84c17850ef02ea7b330908fddcdf73c86
2019-04-27 17:06:35 -07:00
Stephen Toub 32191265f4 Disable sporadically failing HttpClientHandler test (dotnet/corefx#37253)
Commit migrated from https://github.com/dotnet/corefx/commit/610fa286999c78b841e17ea0c301c0986426635d
2019-04-27 17:11:53 -04:00
Tomas Weinfurt f9cf895271 deal with empty response headers for HTTP2 (dotnet/corefx#37160)
* deal with empty response headers for HTTP2

* fix test for http1.1

* feedback from review

* feedback from review


Commit migrated from https://github.com/dotnet/corefx/commit/e95b369aa20d551cef59f7bda3aff0ddbd4119c7
2019-04-26 11:02:06 -07:00
David Shulman 4f71ca43ed Allow uppercase HTTP_PROXY and NO_PROXY variables (dotnet/corefx#37200)
This is a redo of PR dotnet/corefx#35887.

Added support for uppercase HTTP_PROXY and NO_PROXY environment variables.
The uppercase versions are being used by Docker and other tools. This now
completes the set of environment variables that are already handling both
lower and upper case variants.

Note: This HttpEnvironmentProxy class is currently only used on Linux and OSX.
It is not used on Windows yet. I do plan to add support for this to Windows
at a later time, see dotnet/corefx#37187.

Added detection of CGI environments in order to suppress using the uppercase
HTTP_PROXY environment variable. See https://httpoxy.org/

Fixed some typos in the CSPROJ of the Http Unit Tests.


Commit migrated from https://github.com/dotnet/corefx/commit/dfe7593397bf5c598548486c6cb774ebf60e9d69
2019-04-26 06:23:55 -07:00
Tomas Weinfurt cca9e0d20b make invalidUri more invalid (dotnet/corefx#37109)
Commit migrated from https://github.com/dotnet/corefx/commit/69d2e45a8a8840ba7a90e4ad2d2805d9033aabfc
2019-04-23 10:42:24 -04:00
Tomas Weinfurt 08a48d732d write Host header first if we need to add it (dotnet/corefx#37007)
* write Host header first if we need to add it

* feedback from review


Commit migrated from https://github.com/dotnet/corefx/commit/724d8f73e66b747e079875d431d4c1fa546119e1
2019-04-22 12:28:16 -07:00
Tomas Weinfurt 7f49b1b3fb skip GetAsync_IPv6LinkLocalAddressUri_Success if address is not available (dotnet/corefx#37051)
Commit migrated from https://github.com/dotnet/corefx/commit/8e2e72b2683a4b4b983b184f1e703a3174b8566c
2019-04-20 09:36:43 -04:00
Tomas Weinfurt 0bdef6e6fc add test for connection timeouts (dotnet/corefx#36990)
* add test for connection  timeouts

* feedback from review


Commit migrated from https://github.com/dotnet/corefx/commit/2a6ee34edd98c1746c11c9354bef12654822f5ee
2019-04-19 00:15:37 -04:00
Tomas Weinfurt 56fe92f736 allow Http2 loopback test be unencrypted (dotnet/corefx#36968)
* fix tests with http/2

* make SSL on Loopback server configurable via environment

* update variable names


Commit migrated from https://github.com/dotnet/corefx/commit/95987e3e3aa95b2ae6386b17271a172d20fe50cc
2019-04-18 12:10:31 -07:00
Tomas Weinfurt c1a3326407 handle bad Expires better (dotnet/corefx#36908)
* handle bad Expires better

* update tests

* internal -> private

* feedback from review


Commit migrated from https://github.com/dotnet/corefx/commit/82eedbff6b767c0bd9297d3dd27c89d925a28e93
2019-04-18 08:42:24 -04:00
Stephen Toub 59dfed72f2 Fix SocketsHttpHandler streams to do sync I/O in sync methods (dotnet/corefx#36946)
* Fix SocketsHttpHandler response streams to do sync I/O in sync methods

SocketsHttpHandler hands back response Streams for reading response body content.  While we encourage developers to use the async Stream APIs, Stream does expose synchronous APIs, yet the current implementations are just wrapping the async ones and doing sync-over-async.

This fixes the response stream synchronous APIs to be sync down to the underlying networking stream.

It also fixes a couple other minor issues, e.g. Flush{Async} on read-only stream should be nops rather than throwing, we should include an error message about a stream being read-only when trying to write to it, etc.

* Address PR feedback


Commit migrated from https://github.com/dotnet/corefx/commit/315fd00cb2465390900209919cdb2bf6bc44ae0e
2019-04-18 00:01:04 -04:00
Tomas Weinfurt f4742bcff4 fix tests with http/2 (dotnet/corefx#36945)
Commit migrated from https://github.com/dotnet/corefx/commit/f80cf8c360ef00c9a5fdc990e3abd7df23ee0015
2019-04-16 21:00:27 -07:00
Viktor Hofer ad3bc59e9a Update testdata versions (dotnet/corefx#36938)
* Update testdata versions

* Bump versions in projects and group in TestData

* Fix typo


Commit migrated from https://github.com/dotnet/corefx/commit/e5d2b5291277dbd7444d0a17a2bff4784265d917
2019-04-16 20:40:30 -04:00
David Shulman 5f3d25be72 Fix ClientWebSocket close handshake when using proxy (dotnet/corefx#36928)
When the client websocket was going through a proxy, it would sometimes transition to the
'Aborted' state and not the 'Closed' state after a successful closing handshake.

I first opened this bug a year ago but finally was able to get back to it and root cause the
problem. The problem only occured with the managed websocket. The .NET Framework did not have
this problem. And some proxies didn't cause a problem with managed websocket (such as Fiddler).

The root cause is a misinterpretation of RFC 6455, Section 7.1.1. This describes the behavior
of how the websocket's TCP connection should be closed. The most graceful way is to wait for
the server to initiate the close of the socket. In cases where it is taking too long to wait
for the server to start the TCP close, then the client can start the TCP close of the socket.

But no matter how the socket is finally closed, the websocket state should transition to 'Closed'
as soon as a valid closing handshake was performed (i.e. close frames both sent and received).
And this occurs before any logic for closing the TCP connection.

The code in managed websocket has a timer to wait 1 second for the server to start a close. If
the timer finishes, then the managed websocket calls an Abort() method to close the socket. This
ends up transitioning the websocket to an 'Aborted' state which is incorrect. The state should
only be moved to the 'Aborted' state if a closing handshake was not completed.

I added a new test to support this change and moved the LoopbackProxyServer code to Common.

Fixes dotnet/corefx#28027


Commit migrated from https://github.com/dotnet/corefx/commit/0c9684c2c4057908cf697a366a3b1527326e507d
2019-04-16 17:15:30 -07:00
Tomas Weinfurt 6f2a308ef9 add tests for invalid HTTP headers (dotnet/corefx#36898)
* add SendAsync_InvalidHeader_Throw

* fix tests

* move SendAsync_InvalidHeader_Throw


Commit migrated from https://github.com/dotnet/corefx/commit/18e1fabd13b40eb6ea88c1b7bae8c4e14a927019
2019-04-16 14:53:07 -07:00
Tomas Weinfurt ec218e40b5 support HTTP/2 without TLS (dotnet/corefx#36753)
* support HTTP/2 without ssl

* feedback from review

* revert changes GetAsync->SendAsync

* remove unused variable

* feedback from review

* feedback from review

* add missong Trace().


Commit migrated from https://github.com/dotnet/corefx/commit/7ed0c5338941346a3cacb4e18f19aaddb283da90
2019-04-16 11:54:24 -07:00
Tomas Weinfurt bb20d2572d add test for lower casing header name logic (dotnet/corefx#36708)
* add test for 35164

* update SocketsHttpHandler_HttpClientHandler_Cancellation_Test_Http2

* fix uwp tests

* change port from 123 to 443


Commit migrated from https://github.com/dotnet/corefx/commit/4e3b46c22cec88a1f0deaa2f594634e5553412e1
2019-04-15 15:15:32 -07:00
David Shulman 8bd406c5f7 Improve HttpClient POST with REDIRECT tests (dotnet/corefx#36848)
This PR is similar to dotnet/corefx#36801 and dotnet/corefx#36828 which improved upload tests stability.

Modify the POST with REDIRECT test to use the VerifyUpload endpoint which avoids
having to echo back the large request body.

Closes dotnet/corefx#36220

Commit migrated from https://github.com/dotnet/corefx/commit/52d4723aaa8e561a6f36589a6d1e112287c0308b
2019-04-13 20:16:43 -07:00
Filip Navara d5ebf4d640 Fix encoding of Digest authentication headers (dotnet/corefx#36627)
* Fix encoding of Digest authentication headers for servers that don't understand RFC 5987 encoding

* Quote-prefix special characters when encoding Digest headers

* Address PR feedback


Commit migrated from https://github.com/dotnet/corefx/commit/cce7870129dcca472f4e6108e21e87bc9573b8d2
2019-04-13 09:07:10 -07:00
Paito AndersonandBen Adams c525f50614 Allow cookies with spaces in the name (dotnet/corefx#36566)
* Allow cookies with spaces in the name

* Apply suggestions from code review

Co-Authored-By: PaitoAnderson <[email protected]>

* Added supporting HttpClient functional cookie test

* Updated UWP cookie class and added additional tests

* Prevent cookies with spaces at the start or end

* Forgot UWP

* Fix could allocate on trim

Co-Authored-By: Ben Adams <[email protected]>

* Better cookie space start/end check

Co-Authored-By: Ben Adams <[email protected]>

* Bring checks into line

Co-Authored-By: Ben Adams <[email protected]>

* Skip test on .net framework

* Skip additional tests on .net framework

* Fix typo


Commit migrated from https://github.com/dotnet/corefx/commit/8a22438a1af870cdd04eaf798b155b8a1ab04cb4
2019-04-13 08:28:21 -07:00