Dear Undertow team,
I am using Undertow with RESTHeart, and I have encountered an issue where certain malformed requests fail during parsing within the io.undertow.server.protocol.http.HttpRequestParser
class.
Specifically, if a query parameter contains an invalid percent-encoded value (e.g., %
not followed by two valid hexadecimal characters), Undertow throws a UrlDecodeException
, logs the error, and does not proceed to build the HttpServerExchange
. Consequently, the request never reaches the handler chain, where RESTHeart would normally manage and log such errors.
Here is an example of the logged message:
10:33:01.044 [XNIO-1 I/O-1] DEBUG io.undertow.request.io - UT005014: Failed to parse request
io.undertow.util.UrlDecodeException: UT000072: Failed to decode url a=%2f&a=1&wrong=%n to charset UTF-8
at io.undertow.util.URLUtils.decode(URLUtils.java:142)
at io.undertow.server.protocol.http.HttpRequestParser.decode(HttpRequestParser.java:628)
In this scenario, since the HttpServerExchange
is never created, RESTHeart cannot handle the error. To address this, I am looking for a way to either:
I wanted to ask if there is already a mechanism in place to handle such cases that I might have overlooked. If not, would it be feasible to introduce a feature that allows users to specify an error handler for request parsing failures? This would be particularly useful for propagating these errors to custom logging systems and monitoring solutions.
Thank you for your time and for the excellent work on Undertow. I would greatly appreciate your guidance on how best to address this issue or if such a feature could be considered for future releases.