Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 11a9368

Browse files
author
Geoff Kizer
committed
add shutdown call to try to make redirect test more reliable
1 parent 3de3cd7 commit 11a9368

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,6 @@ await LoopbackServer.CreateServerAsync(async (origServer, origUrl) =>
618618

619619
if (useTE)
620620
{
621-
request.Content.Headers.ContentLength = 0;
622621
request.Headers.TransferEncodingChunked = true;
623622
}
624623
}
@@ -633,6 +632,7 @@ await LoopbackServer.CreateServerAsync(async (redirServer, redirUrl) =>
633632
// Send Connection: close so the client will close connection after request is sent,
634633
// meaning we can just read to the end to get the content
635634
await connection.ReadRequestHeaderAndSendResponseAsync((HttpStatusCode)statusCode, $"Location: {redirUrl}\r\nConnection: close\r\n");
635+
connection.Socket.Shutdown(SocketShutdown.Send);
636636
await connection.Reader.ReadToEndAsync();
637637
});
638638

@@ -648,6 +648,7 @@ await LoopbackServer.CreateServerAsync(async (redirServer, redirUrl) =>
648648
// Send Connection: close so the client will close connection after request is sent,
649649
// meaning we can just read to the end to get the content
650650
receivedRequest = await connection.ReadRequestHeaderAndSendResponseAsync(additionalHeaders: "Connection: close\r\n");
651+
connection.Socket.Shutdown(SocketShutdown.Send);
651652
receivedContent = await connection.Reader.ReadToEndAsync();
652653
});
653654

0 commit comments

Comments
 (0)