Skip to content

Commit

Permalink
[UNDERTOW-2133] Handle RequestTooBigException
Browse files Browse the repository at this point in the history
If the request is too big, throw an excpetion to allow the connection to
be cleaned up closed properly up the call stack.
  • Loading branch information
jasondlee authored and fl4via committed Aug 11, 2022
1 parent b67e821 commit 7d3a045
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import io.undertow.conduits.ConduitListener;
import io.undertow.server.Connectors;
import io.undertow.server.HttpServerExchange;
import io.undertow.server.RequestTooBigException;
import io.undertow.util.ImmediatePooledByteBuffer;
import org.xnio.IoUtils;
import org.xnio.channels.StreamSinkChannel;
Expand Down Expand Up @@ -202,6 +203,8 @@ public int read(ByteBuffer dst) throws IOException {
}
assert STATE_FINISHED == state;
return -1;
} catch (RequestTooBigException e) {
throw e;
} catch (IOException | RuntimeException e) {
IoUtils.safeClose(exchange.getConnection());
throw e;
Expand Down

0 comments on commit 7d3a045

Please sign in to comment.