Skip to content

Commit

Permalink
[Test] Flush response body for progress (#115177) (#115209)
Browse files Browse the repository at this point in the history
In JDK23, response headers are no longer always immediately sent. See
also https://bugs.openjdk.org/browse/JDK-8331847 This PR adds flush call
for the response body to make progress.

Resolves: #115145 Resolves: #115164
(cherry picked from commit 8c23fd7)
  • Loading branch information
ywangd authored Oct 21, 2024
1 parent cc05e6d commit b69d23d
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -573,16 +573,16 @@ public void handle(HttpExchange exchange) throws IOException {
),
-1
);
exchange.getResponseBody().flush();
} else if (randomBoolean()) {
final var bytesSent = sendIncompleteContent(exchange, bytes);
if (bytesSent < meaningfulProgressBytes) {
failuresWithoutProgress += 1;
} else {
exchange.getResponseBody().flush();
}
} else {
failuresWithoutProgress += 1;
}
exchange.getResponseBody().flush();
exchange.close();
}
}
Expand Down Expand Up @@ -627,6 +627,7 @@ public void handle(HttpExchange exchange) throws IOException {
failureCount += 1;
Streams.readFully(exchange.getRequestBody());
sendIncompleteContent(exchange, bytes);
exchange.getResponseBody().flush();
exchange.close();
}
}
Expand Down

0 comments on commit b69d23d

Please sign in to comment.