Commit Graph
2312 Commits
Author SHA1 Message Date
Eirik Tsarpalis 32b8f50c85 HttpStress: Randomize cancellation of requests
Commit migrated from https://github.com/dotnet/corefx/commit/c4167ed11e1444433a33cc5d44a4aa33e0ffd651
2019-07-15 23:44:45 +01:00
Stephen Toub 343728ed3b Propagate correct exception in Http2Connection.Abort (dotnet/corefx#39496)
Ensure we pass the `_abortException`, not `abortException`, to the streams, and log any non-duplicate exception.

Commit migrated from https://github.com/dotnet/corefx/commit/cfccc26f9e77fa9f745857ec48a256309e29f39d
2019-07-15 17:17:18 -04:00
Anirudh Agnihotry 7adca638bd Added client operation for posting form data (dotnet/corefx#39437)
* added client operation for post data

* client operation for multipart data content

* remove the subset test


Commit migrated from https://github.com/dotnet/corefx/commit/eee164d069f36ed4d8f850799bd6b9e414b2d23b
2019-07-15 14:13:30 -07:00
Stephen Toub d2c2aba33e Ensure that CancellationToken is propagated to built-in request content types (dotnet/corefx#39474)
* Ensure that CancellationToken is propagated to built-in request content types

We don't currently expose the overload that would allow CancellationToken to be accessed by HttpContent-derived types in general, but we can at least ensure that when using the built-in content types, the CancellationToken provided to SendAsync is appropriately threaded through.  We were doing this previously in only a few cases, where we knew that the previous overload wouldn't be overridden (namely internal types and sealed types), but we can enable the 90% scenario as well by doing a type check at run-time.

* Disable cancellation test for UAP handler


Commit migrated from https://github.com/dotnet/corefx/commit/450f49a1a80663529b31d3defafbd5e59822a16a
2019-07-15 16:17:56 -04:00
Stephen Toub 920886e407 Fix SocketsHttpHandler canceling request when response stream dropped (dotnet/corefx#39471)
* Fix SocketsHttpHandler canceling request when response stream dropped

Good code using HttpClient should Dispose of the HttpResponseMessage and/or response Stream when its done with it.  However, if code fails to do so, we still want to ensure that we don't leak connections/requests to the server or leak resources on the client.  If the response isn't disposed but the code reads all the way to the end of it, then internally things are cleaned up.  But if the response isn't disposed and hasn't read to the end, for both HTTP/1.1 and HTTP/2, we have some issues.

For HTTP/1.1, we rely on the Socket's finalization to close the associated connection.  However, we use a cache of SocketAsyncEventArgs instances to handle creating connections, and it turns out that these SocketAsyncEventArgs instances are keeping around a reference to the last created Socket.  If the SAEA is reused for another connection, then there's no issue, but until it is, it maintains several references to the socket: in ConnectSocket, in _currentSocket, in _multipleConnect, and then further within another SAEA instance that the _multipleConnect itself is creating for some reason.  We should go through and clean all that up in SAEA, but for now, this just removes the SAEA cache.

For HTTP/2, nothing was cleaning up in this case.  To handle it, we:
1. Make the response stream finalizable, such that when finalized it behaves as if Dispose were called.
2. When SendAsync completes, we remove the strong reference from the Http2Stream to the response message, such that the response (and in turn the response stream) doesn't get rooted by the Http2Connection storing the Http2Stream in its dictionary).
3. The only reason that reference was still needed was to support trailing headers.  So we create a lazily-allocated list on the Http2Stream for storing trailers if any should arrive, and then when the response body completes, the response stream pulls those headers in from the temporary collection into the response that it then has a reference to.  This also helps to avoid a race condition where consuming code erroneously accesses TrailingHeaders before the request has completed, in which case we previously could have been trying to write to the collection while user code was reading from it; with this change, that mutation happens as part of a call the consumer makes.

* Address PR feedback


Commit migrated from https://github.com/dotnet/corefx/commit/8b5eb8d9fb7857e5b40e763287f8f8832c15af31
2019-07-15 13:12:27 -04:00
Cory Nelson fdf096a524 Update Http2_FlowControl_ClientDoesNotExceedWindows to use ByteAtATimeContent for compat with recent buffering change. (dotnet/corefx#39472)
Clear ActiveIssue as original issue in dotnet/corefx#38799 could not be reproduced.

Commit migrated from https://github.com/dotnet/corefx/commit/929bd81ee11728434ebf9c06152408b4b9940d12
2019-07-14 21:19:34 -07:00
Geoff Kizer cd11208e18 revert workarounds for 39372
Commit migrated from https://github.com/dotnet/corefx/commit/0aea825037c13e522bec6f6bc21df37720a1b414
2019-07-13 17:19:39 -07:00
Geoff Kizer 6a5753c061 disable cert validation for HTTP2 endpoint on Linux
Commit migrated from https://github.com/dotnet/corefx/commit/d34a2579ad53d72fd2482b4faada174416497041
2019-07-13 17:17:33 -07:00
Geoff Kizer f1c413c0b4 revert change to CreateHttpClient, now that CreateHttpClientForRemoteServer is used instead
Commit migrated from https://github.com/dotnet/corefx/commit/14f9968db06634919b03a438763f10522834fc23
2019-07-13 17:17:33 -07:00
Geoff Kizer 94daa1bd35 convert a few more tests to also use HTTP2 remote server
Commit migrated from https://github.com/dotnet/corefx/commit/1db9d56078f729d3079e95cd1c9183e64413c8f2
2019-07-13 17:17:32 -07:00
Geoff Kizer bb2fa10f05 disable version check on platforms that don't support ALPN
Commit migrated from https://github.com/dotnet/corefx/commit/c11af5504d806fd02874457d80db2e92b072385e
2019-07-13 17:17:32 -07:00
Geoff Kizer c1bb738b53 fix NETFX and UWP build issues
Commit migrated from https://github.com/dotnet/corefx/commit/b2216d60d2a2f9416eadb4bae015eb1524407d71
2019-07-13 17:17:32 -07:00
Geoff Kizer e89fbd6b5e ensure remote server HTTP2 tests are actually using HTTP2 and modify some remote server tests to run over HTTP2 as well as HTTP/1.1
Commit migrated from https://github.com/dotnet/corefx/commit/f013baadc511567f012d6132f9e710fb3acafb66
2019-07-13 17:17:31 -07:00
Krzysztof Wicher 03a36223e9 Retry on GOAWAY (dotnet/corefx#39127)
* Retry on GOAWAY

* send correct GOAWAY on retried connection, update comment

* Harden against flakiness

* Fix: Connection refused error is different on Debian

* apply feedback

* Make partial body/received headers case deterministic, pass error code on REFUSED_STREAM

* apply latest feedback


Commit migrated from https://github.com/dotnet/corefx/commit/1841042b99062de13dc80098cede9413be569238
2019-07-12 21:07:20 -07:00
Anirudh Agnihotry f6ba5eabd4 Added client operation for get query with parameters (dotnet/corefx#39398)
* added client operation for get query with parameters

* using stringBuilder for expected string and allowing user to control size when query parameters are present

* typo corrected


Commit migrated from https://github.com/dotnet/corefx/commit/54a2443797b070db11dcd82014a2d8c56f7cbc78
2019-07-12 11:51:18 -07:00
Cory Nelson d030f6ae8a Read WinHTTP's proxy format correctly (dotnet/corefx#39371)
Fix SocketsHttpHandler to properly read WinHTTP's proxy string format, preventing an exception when a PAC script returns multiple proxies. Resolves dotnet/corefx#39104.

Commit migrated from https://github.com/dotnet/corefx/commit/70b45baaf36eab34fcfb44056b030654dba9a4dc
2019-07-12 09:58:34 -07:00
Eirik Tsarpalis 648f0316ba Http2Connection: Wrap InvalidOperationExceptions (dotnet/corefx#39400)
* Http2Connection: Wrap InvalidOperationExceptions

To achieve parity with the v1.1 implementation. Fixes dotnet/corefx#39295

* do not shutdown connection on server side

* prevent disposal of client before server has established connection


Commit migrated from https://github.com/dotnet/corefx/commit/68e7999c846131bd8cd43899671fa6a4a7b5da53
2019-07-12 09:39:52 -07:00
Geoff Kizer 2fbfaa8f8a Merge pull request dotnet/corefx#39242 from scalablecory/38788-ping-race
Fix a race in buffer usage of Http2Connection.ProcessPingFrame

Commit migrated from https://github.com/dotnet/corefx/commit/1d03a9106905278e82ee98ceee2d451b0e008000
2019-07-12 01:58:00 -07:00
Cory Nelson 92a10fefb4 Move integer read into ProcessPingFrame.
Commit migrated from https://github.com/dotnet/corefx/commit/790f53719c3816a0d010966848fbdaeb412928a3
2019-07-11 23:29:05 -07:00
Stephen Toub 3f5503e4ab Remove GetWaiterTask allocation for display class (dotnet/corefx#39411)
Using an async local function here that accesses its outer function's state is resulting in the compiler allocating a display class at the beginning of GetWaiterTask.

Commit migrated from https://github.com/dotnet/corefx/commit/59b60a232ecf3df2319fadd0193f5dcb42948e29
2019-07-11 20:28:47 -04:00
Cory Nelson a51feabc78 Capitalize comment.
Commit migrated from https://github.com/dotnet/corefx/commit/484aa6450871027f7576e5cc00495a7ab0c4fc50
2019-07-11 11:38:54 -07:00
Stephen Toub aaf1ef73a4 Several additional HttpStress improvements (dotnet/corefx#39388)
- Enable HTTP/1.1 and HTTP/2 to be used concurrently
- Fix duplex tests now that only custom content may be duplex
- Add option to set pooled connection lifetime to stress connection management
- Add client operation for reading portion of response and throwing the rest away

Commit migrated from https://github.com/dotnet/corefx/commit/88ab17433f45c37e4e28e2bb6dce3c74aea81c0d
2019-07-11 10:02:38 -07:00
Eirik Tsarpalis aaa184733d HttpStress: Use randomized content lengths (dotnet/corefx#39368)
* HttpStress: use randomized content lengths

Adds pseudo-random content payloads in the http stress test harness.
All random data derives from a single seed which can be optionally specified at the CLI.

* address feedback

* Remove dead code


Commit migrated from https://github.com/dotnet/corefx/commit/e642ef9c661680c3d3eb650e37fb28d82f2fafec
2019-07-11 08:59:25 -04:00
Eirik Tsarpalis dd3714b7c4 Merge pull request dotnet/corefx#39222 from eiriktsarpalis/fix-ignored-settings-ack
Http2LoopbackConnection: Wait for pending ACK before setting up for new ignored settings frames

Commit migrated from https://github.com/dotnet/corefx/commit/a393ffee970c6d962c5830bb1c6fa4c3a3e268a6
2019-07-11 12:06:47 +01:00
Stephen Toub 83c48a4aab Exclude built-in HttpContent types from duplex with SocketsHttpHandler's HTTP/2 (dotnet/corefx#39352)
For 3.0:
- Adds an internal virtual AllowDuplex to HttpContent that defaults to true
- Override that on all of our HttpContent-derived types to return false
- SocketsHttpHandler's HTTP/2 implementation checks that, and if it returns false, awaits the sending of the request body as part of SendAsync.

Post-3.0, we'll revisit, likely with public surface area.

Commit migrated from https://github.com/dotnet/corefx/commit/e75dd151c9e5aa94cf33c7c9d14a53180df747dd
2019-07-10 23:31:30 -04:00
Cory Nelson 6c30a34e3d Add comment for Discard.
Commit migrated from https://github.com/dotnet/corefx/commit/fd83c71e4e5ef5b21f04ceff9f5c535f92c082ce
2019-07-10 20:19:41 -07:00
Cory Nelson ccb94e59b7 Optimize out an array allocation
Commit migrated from https://github.com/dotnet/corefx/commit/69b57934d5fa13147b44908e5a9d9d2e01e5d9bc
2019-07-10 20:07:26 -07:00
Tomas Weinfurt c7c606cfec Don't close connection for responses to session based authentication and 100-Continue (dotnet/corefx#38744)
* don't close connection for responses to session based authenticatin

* move sendRequestContentTask

* feedback from review


Commit migrated from https://github.com/dotnet/corefx/commit/2e73965a126946afc986175fd667ce3c31f03731
2019-07-09 12:25:14 -07:00
Eirik Tsarpalis 9f54c9395a make ExpectSettingsAck timeout parameter optional
Commit migrated from https://github.com/dotnet/corefx/commit/5787e8ec90207b400e4f9fc13cd51a31fb48adfc
2019-07-08 10:21:25 +01:00
Stephen Toub a920982227 Don't force flush for data packets in SocketsHttpHandler HTTP/2 (dotnet/corefx#39236)
* Don't force flush for data packets in SocketsHttpHandler HTTP/2

Allow the write stream to request a flush via FlushAsync, but don't internally force a flush on each data packet.

* Address PR feedback

Also tweak use of ArrayBuffer.ActiveSpan/Memory.Length to just ArrayBuffer.ActiveLength.


Commit migrated from https://github.com/dotnet/corefx/commit/15abdfc3816352c64098735b79a98dd97524ee36
2019-07-06 18:45:11 -04:00
Cory Nelson 2a5cc8cdfc Fix a race in buffer usage of Http2Connection.ProcessPingFrame: incoming buffer might be reused before we've sent it. Resolve dotnet/corefx#38788.
Commit migrated from https://github.com/dotnet/corefx/commit/1a2c478ee975a1214afc7f23c75e3e99c292c521
2019-07-05 16:04:38 -07:00
Geoff Kizer 4146ff70cc Small improvements to HTTP2 testing (dotnet/corefx#39209)
* method tests

* in debug, start with very small buffer sizes to induce buffer growing


Commit migrated from https://github.com/dotnet/corefx/commit/3fdc11c8d4720b6ae361cfa306710d2f20b5536e
2019-07-05 11:19:16 -07:00
Eirik Tsarpalis 70f83f075c Make the Http2LoopbackConnection.ExpectSettingsAck() method handle outstanding acks more gracefully. Should fix dotnet/corefx#39082
Commit migrated from https://github.com/dotnet/corefx/commit/5458bdac1cc3dd0989d35060b72d83c08499ca53
2019-07-05 16:55:07 +01:00
Stephen Toub b59a62791c Add more options to HttpStress program (dotnet/corefx#39188)
- "listOps" option, to see what numbers correspond to which client operations
- New client operation for HEAD
- New client operation for PUT
- New client operation for POST duplex, but that dribbles a byte at a time
- Fixed POST duplex to use ResponseHeadersRead
- Enable HTTP logging to be started to the console during a run

Commit migrated from https://github.com/dotnet/corefx/commit/2f42dde968da92f1c67a91ab7b915af7c63848e5
2019-07-04 07:30:25 -04:00
Stephen Toub c81ef3c73b Augment HttpStress app to track socket reuse errors (dotnet/corefx#39179)
Commit migrated from https://github.com/dotnet/corefx/commit/b21ca5fddd281f835de98dbe950405bcf9397ac4
2019-07-03 19:57:22 -04:00
Stephen Toub a06b1dab45 Ensure HttpClient.Get*Async helpers wrap IOExceptions (dotnet/corefx#39137)
IOExceptions may emerge from the underlying response streams, but GetString/ByteArrayAsync should throw a wrapper HttpRequestException in this case.

Commit migrated from https://github.com/dotnet/corefx/commit/1c3d001566b0d38c90e074e33d7394d507311956
2019-07-03 13:05:41 -04:00
Geoff Kizer c59a75c204 Merge pull request dotnet/corefx#39107 from geoffkizer/http2exceptionfix
clean up HTTP2 protocol exception handling

Commit migrated from https://github.com/dotnet/corefx/commit/d0a88cf805724b9a58e272dc3eff8ce45ff48322
2019-07-02 20:17:08 -07:00
Stephen Toub d9702e8fdc Stop using EDI.Throw for shared exception objects in HTTP/2 (dotnet/corefx#39135)
Commit migrated from https://github.com/dotnet/corefx/commit/4d56f6ddc5ec0901414e161199fe891cfe183e5d
2019-07-02 22:34:06 -04:00
Geoff Kizer 5901fee80c address feedback
Commit migrated from https://github.com/dotnet/corefx/commit/490593ffa52cd818a8c0ebeb5298b48b3844237b
2019-07-02 18:39:25 -07:00
Stephen Toub 3e6b7ba4bb Update HttpStress app to accomodate recent changes (dotnet/corefx#39125)
Commit migrated from https://github.com/dotnet/corefx/commit/64310c8da5c631a7271609a3cdbf2b0d58366783
2019-07-02 17:21:10 -04:00
Tomas Weinfurt a9807f6304 correct sending RST when request body fails (dotnet/corefx#39117)
* correct sending RST when request body fails

* move test back to OuterLoop

* remove unnecesary ConfigureAwait()


Commit migrated from https://github.com/dotnet/corefx/commit/26360c82c55c0c8dfc1c358614872b3c160c3bf6
2019-07-02 23:14:10 +02:00
Geoff Kizer 61c51f7429 clean up HTTP2 protocol exception handling
Commit migrated from https://github.com/dotnet/corefx/commit/63e8aa4481928d4dc58c4cb563bfab7fdde322d0
2019-07-02 04:00:31 -07:00
Tomas Weinfurt f92e38e26a improve Http2_PendingSend_SendsReset test. (dotnet/corefx#39097)
* improve Http2_PendingSend_SendsReset

* style update


Commit migrated from https://github.com/dotnet/corefx/commit/ec138afba514ce9b53d931d66129e02e8be147a1
2019-07-02 10:07:50 +02:00
Krzysztof Wicher 61de06b2d5 Do not directly abort connection on GOAWAY (dotnet/corefx#39036)
* Do not directly abort connection on GOAWAY

* Address feedback and add disabled GOAWAY tests

* remove redundant frame ignoring logic


Commit migrated from https://github.com/dotnet/corefx/commit/cc6435bb9ec069c57a3d155944b5729b3f06439f
2019-07-01 13:44:59 -07:00
Stephen Toub bfc97b2976 Fix MaxResponseHeadersLength assert for value string (dotnet/corefx#39085)
I'd fixed the assert message to contain the right value when MaxResponseHeadersLength was exceeded, but this error message isn't used for WinHttpHandler, and thus it doesn't contain the value.  Special-case the check for just SocketsHttpHandler.

Commit migrated from https://github.com/dotnet/corefx/commit/e78b22b59d52e14d6099fd96cd713dc9d400103c
2019-07-01 15:12:54 -04:00
Stephen Toub 193728d210 Disable Http2_PendingSend_SendsReset test sporadically failing in CI (dotnet/corefx#39077)
Commit migrated from https://github.com/dotnet/corefx/commit/3a3c44a93ba968ada2d0c3ea0e997fcb4849a7d5
2019-07-01 11:09:52 -04:00
Tomas Weinfurt b22cfb472b move tests with SlowTestStream to outerloop (dotnet/corefx#39071)
Commit migrated from https://github.com/dotnet/corefx/commit/fcaeb097c91b1dbf75ff675442a624802460fb47
2019-07-01 06:35:16 -07:00
Viktor Hofer 0f67ef28f8 Make CoreFx.Private.TestUtilites RID-agnostic (dotnet/corefx#36207)
* Make CoreFx.Private.TestUtilites RID-agnostic

* Add version checks for other distros

https://github.com/dotnet/corefx/commit/dotnet/corefx@4f0d10773ccbb4849b869b6a0a73d5938f1804bd
Porting fix over into PlatformDetection.

* Build test lib in advance for VS support

* Disable pretest in AllConfigurations

Commit migrated from https://github.com/dotnet/corefx/commit/d3d144fad9b600a0fc1ca6fc7d65c247fddd9f04
2019-06-29 21:53:19 +02:00
Stephen Toub 5ba66fefdb Fix exception messages for max response headers length (dotnet/corefx#39038)
Some of the call sites use a value whose units is kbytes, but the exception message refers to bytes.

Commit migrated from https://github.com/dotnet/corefx/commit/0decf070fb59b22b13d43082ac5333028ff53b1b
2019-06-29 15:38:08 -04:00
Geoff Kizer 76bc9d0634 review feedback
Commit migrated from https://github.com/dotnet/corefx/commit/95bca001973dfcd512de1830fd3898306462d1cf
2019-06-28 20:18:27 -07:00