Skip to content

Commit

Permalink
do not add connection: close to the response when the error is transient
Browse files Browse the repository at this point in the history
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
  • Loading branch information
lorban committed Nov 6, 2023
1 parent e8f2006 commit 3aa877f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,8 @@ public void run()
if (LOG.isDebugEnabled())
LOG.debug("running failure={} {}", failure, this);
// TODO is this necessary to add here?
_servletChannel.getServletContextResponse().getHeaders().add(HttpFields.CONNECTION_CLOSE);
if (chunk.isLast())
_servletChannel.getServletContextResponse().getHeaders().add(HttpFields.CONNECTION_CLOSE);
_readListener.onError(failure);
}
else if (chunk.isLast() && !chunk.hasRemaining())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ public void onError(Throwable t)
HttpTester.Response response = HttpTester.parseResponse(localEndPoint.getResponse(false, 5, TimeUnit.SECONDS));

assertThat("Unexpected response status\n" + response + response.getContent(), response.getStatus(), is(HttpStatus.OK_200));
assertThat(response.get(HttpHeader.CONNECTION), nullValue());
assertThat(response.get(HttpHeader.CONTENT_TYPE), is("text/plain;charset=UTF-8"));
assertThat(response.getContent(), containsString("read=10"));
assertInstanceOf(TimeoutException.class, failure.get());
Expand Down

0 comments on commit 3aa877f

Please sign in to comment.