-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
2.3.19.Final
-
None
We have services that use UndertowOptions.MAX_ENTITY_SIZE to limit the size of incoming bodies.
Our error management handles undertow's RequestTooBigException by returning 413: Payload too large http status code.
This does not work since upgrading to undertow version 2.3.19. Undertow automatically return 400: Bad Request }}and our error management is not notified of{{ {{RequestTooBigException}} anymore.
After troubleshooting I found this change in 2.3.19:
io.undertow.server.protocol.http.HttpTransferEncoding.handleRequestEncoding() method now contains in lines 126 to 129:
if (exchange.getMaxEntitySize() > 0 && exchange.getMaxEntitySize() < contentLength && exchange.isResponseChannelAvailable()) { persistentConnection = false; Connectors.terminateRequest(exchange); throw UndertowMessages.MESSAGES.requestEntityWasTooLarge(exchange.getMaxEntitySize()); }
The exception is caught in io.undertow.server.protocol.http.HttpReadListener line 267 and 400 is returned and connection closed.
In 2.3.18 RequestTooBigException was thrown in io.undertow.conduits.FixedLengthStreamSourceConduit.requestEntityWasTooLarge(final long size) lines 166 to 173
if (exchange.getMaxEntitySize() > 0 && exchange.getMaxEntitySize() < (state & MASK_COUNT)) { //max entity size is exceeded //we need to forcibly close the read side Connectors.terminateRequest(exchange); exchange.setPersistent(false); finishListener.handleEvent(this); this.state |= FLAG_FINISHED | FLAG_CLOSED; throw UndertowMessages.MESSAGES.requestEntityWasTooLarge(exchange.getMaxEntitySize()); }
This allowed our error management to catch it and return 413: Payload too large.
- duplicates
-
UNDERTOW-2611 Ensure max-request-size of a Multipart servlet can override a listener max-post-size
-
- Pull Request Sent
-