Skip to content

Commit

Permalink
feat: make closing connection immediately when the response was alrea…
Browse files Browse the repository at this point in the history
…dy sent on HTTP1.1
  • Loading branch information
dachshu committed May 6, 2024
1 parent 151ff7a commit 12a536d
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,11 @@ public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception
req = null;
final boolean shouldReset;
if (encoder instanceof ServerHttp1ObjectEncoder) {
keepAliveHandler.disconnectWhenFinished();
if (encoder.isResponseHeadersSent(id, 1)) {
ctx.channel().close();
} else {
keepAliveHandler.disconnectWhenFinished();
}
shouldReset = false;
} else {
// Upgraded to HTTP/2. Reset only if the remote peer is still open.
Expand Down

0 comments on commit 12a536d

Please sign in to comment.