Skip to content

Commit

Permalink
Do not emit error code when stream is committed
Browse files Browse the repository at this point in the history
If an error occurs when writing the body of a response, e.g.,
TimeoutException, previously S3Proxy would try to emit the AWS error
code.  Since this stream was already opened and closed, this failed
and Jetty emitted this warning:

Could not send response error 500: java.lang.IllegalStateException:
STREAM

References #303.
  • Loading branch information
gaul committed Nov 10, 2019
1 parent 3db5a8a commit 0ff8ec0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main/java/org/gaul/s3proxy/S3ProxyHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -2856,6 +2856,11 @@ protected final void sendSimpleErrorResponse(
Map<String, String> elements) throws IOException {
logger.debug("sendSimpleErrorResponse: {} {}", code, elements);

if (response.isCommitted()) {
// Another handler already opened and closed the writer.
return;
}

response.setStatus(code.getHttpStatusCode());

if (request.getMethod().equals("HEAD")) {
Expand Down

0 comments on commit 0ff8ec0

Please sign in to comment.