dream-encoding icon indicating copy to clipboard operation
dream-encoding copied to clipboard

Dream error_handler footgun

Open reynir opened this issue 1 year ago • 0 comments

Hi! Thanks for this project. I discovered a footgun which is possibly more to blame dream than dream-encoding.

The case is when you use an error handler the suggested response will have gone through dream-encoding and be compressed. Then, an error handler may alter the response to have some nicer looking html. The problem is this will not go through Dream_encoding.compress again so the body will be uncompressed, but keep the Transfer-encoding header added by dream-encoding.

The example snippet in the documentation for Dream.error_template is subject to this: https://aantron.github.io/dream/#val-error_template

I think it would be worth mentioning this somewhere. Perhaps both in the README and in the .mli. (I apologize if I missed this being mentioned somewhere)

reynir avatar Jan 21 '25 10:01 reynir