Skip to content

Commit

Permalink
Complete writing a response before checking unconsumed request payloa…
Browse files Browse the repository at this point in the history
…d that may trigger a connection reset. See #651. (#699)

Signed-off-by: Santiago Pericas-Geertsen <Santiago.PericasGeertsen@oracle.com>
  • Loading branch information
spericas committed May 16, 2019
1 parent 6d1d82e commit 8d48020
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ private void completeInternal(Throwable throwable) {
if (keepAlive) {
LOGGER.finest(() -> log("Writing an empty last http content; keep-alive: true"));

writeLastContent(throwable, ChannelFutureListener.CLOSE_ON_FAILURE);

if (!requestContentConsumed.getAsBoolean()) {
// the request content wasn't read, close the connection once the content is fully written.
LOGGER.finer(() -> log("Request content not fully read; trying to keep the connection; keep-alive: true"));
Expand All @@ -199,7 +201,6 @@ private void completeInternal(Throwable throwable) {
ctx.channel().read();
}

writeLastContent(throwable, ChannelFutureListener.CLOSE_ON_FAILURE);
} else {

LOGGER.finest(() -> log("Closing with an empty buffer; keep-alive: " + keepAlive));
Expand Down

0 comments on commit 8d48020

Please sign in to comment.