From 118e4aa479dcb6960ae567dbd046efe59d1c720c Mon Sep 17 00:00:00 2001 From: Eirik Tsarpalis Date: Tue, 30 Jul 2019 19:28:02 +0100 Subject: [PATCH] HttpStress: Add duplex operation that disposes response content (dotnet/corefx#39860) HttpStress: add duplex operation that disposes response content Commit migrated from https://github.com/dotnet/corefx/commit/5b6a74d8455aab11f64377f3200ace1df71110ea --- .../tests/StressTests/HttpStress/ClientOperations.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/ClientOperations.cs b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/ClientOperations.cs index 382e8f5..f856fc0 100644 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/ClientOperations.cs +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/ClientOperations.cs @@ -324,6 +324,22 @@ namespace HttpStress ValidateContent(content, await m.Content.ReadAsStringAsync()); } }), + + ("POST Duplex Dispose", + async ctx => + { + // try to reproduce conditions described in https://github.com/dotnet/corefx/issues/39819 + string content = ctx.GetRandomString(0, ctx.MaxContentLength); + Version httpVersion = ctx.GetRandomHttpVersion(); + + using (var req = new HttpRequestMessage(HttpMethod.Post, "/duplex") { Version = httpVersion, Content = new StringDuplexContent(content) }) + using (HttpResponseMessage m = await ctx.SendAsync(req, HttpCompletionOption.ResponseHeadersRead)) + { + ValidateHttpVersion(m, httpVersion); + ValidateStatusCode(m); + // Cause the response to be disposed without reading the response body, which will cause the client to cancel the request + } + }), ("POST ExpectContinue", async ctx => -- 2.7.4