pekko-http icon indicating copy to clipboard operation
pekko-http copied to clipboard

More descriptive failure messages in HttpMessageParser

Open SkyTrix opened this issue 1 year ago • 0 comments

I'm currently investigating an issue where we're suddenly running into the following error: HTTP chunk size exceeds the configured limit of 1048576 bytes.

This is possibly due to an infrastructure change we made which results in a change of behavior when chunked transfer encoding is used. I did not find a way to determine the actual size of the incoming chunks and it would be really helpful if it was part of that error message.

My proposal here would be to extend all relevant errors in HttpMessageParser with extra parameter values. e.g. for the max chunk size, the full hex size could be read before validating against maxChunkSize and then including the size parameter in the error message:

https://github.com/apache/incubator-pekko-http/blob/4f80b1ef7cad2833382a659e7dd0b1a54078d126/http-core/src/main/scala/org/apache/pekko/http/impl/engine/parsing/HttpMessageParser.scala#L309-L320

Given that on line 318 the actual encountered illegal char is part of the error message, I think having the size in the other error is warranted. Apart from max chunk size there are a few other messages that could be improved such as max chunk extensions and amount of chunk trailer headers.

Any thoughts on this proposal?

SkyTrix avatar Jan 03 '24 13:01 SkyTrix