Skip to content

Commit

Permalink
revert test change
Browse files Browse the repository at this point in the history
  • Loading branch information
Geoffrey Kizer committed Apr 18, 2021
1 parent 2ae7aa8 commit 608a96f
Showing 1 changed file with 1 addition and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,17 +94,12 @@ private async Task ReadPrefixAsync()
// Tests that use HttpAgnosticLoopbackServer will attempt to send an HTTP/1.1 request to an HTTP/2 server.
// This is invalid and we should terminate the connection.
// However, if we simply terminate the connection without sending anything, then this could be interpreted
// as a server failure that should be retried by SocketsHttpHandler.
// as a server disconnect that should be retried by SocketsHttpHandler.
// Since those tests are not set up to handle multiple retries, we instead just send back an invalid response here
// so that SocketsHttpHandler will not induce retry.
// The contents of what we send don't really matter, as long as it is interpreted by SocketsHttpHandler as an invalid response.
await _connectionStream.WriteAsync(Encoding.ASCII.GetBytes("HTTP/2.0 400 Bad Request\r\n\r\n"));
_connectionSocket.Shutdown(SocketShutdown.Send);

// Wait for client close to avoid RST which could lead to retry.
byte[] buffer = new byte[1024];
while ((await _connectionStream.ReadAsync(buffer)) != 0) { }
throw new Exception("HTTP 1.1 request received.");
}
}

Expand Down

0 comments on commit 608a96f

Please sign in to comment.