Skip to content

Commit ff85849

Browse files
committed
Expect body chunks when aborting during status handling, close AsyncHttpClient#1430
Motivation: When aborting during response status handling, we currently directly offer the channel to the pool. This is wrong as we’ll at least receive the LastHttpContent. Currently, this event is received by the next request being executed with this channel, causing a null response. Modification: Always expect chunks when aborting during status or headers handling, causing channel to be drained before being offered to the pool. Note that AHC 2.1 doesn’t suffer from this issue as aborting now always close the channel. Result: No more null response when aborting on status or headers handling
1 parent 70a2bb4 commit ff85849

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

client/src/main/java/org/asynchttpclient/netty/handler/HttpHandler.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,9 @@ private void notifyHandler(Channel channel, NettyResponseFuture<?> future, HttpR
7777
exitAfterHandlingHeaders(channel, future, response, handler, responseHeaders, httpRequest) || //
7878
exitAfterHandlingReactiveStreams(channel, future, response, handler, httpRequest);
7979

80-
if (exit)
81-
finishUpdate(future, channel, HttpHeaders.isTransferEncodingChunked(httpRequest) || HttpHeaders.isTransferEncodingChunked(response));
80+
if (exit) {
81+
finishUpdate(future, channel, true);
82+
}
8283
}
8384

8485
private boolean exitAfterHandlingStatus(//

0 commit comments

Comments
 (0)