How can I decode a http response compressed with Brotli in Delphi, with either Indy or ICS libraries? Neither of them seem to include support for it by default.
Asked
Active
Viewed 682 times
0
-
1[YuBrotli](https://www.yunqa.de/delphi/products/brotli/index) - Freeware Delphi component for compress/decompress using Brotli algorithm. – zed Feb 02 '20 at 15:31
-
1I can't speak for ICS, but Indy does not natively support Brotli at this time. But it is possible to manually set TIdHTTP is accept Brotli on HTTP responses if you are prepared to decode the Brotli data manually. – Remy Lebeau Feb 02 '20 at 18:07
-
@zed I guess you can rather directly call the Open Source official https://github.com/google/brotli c library from your code. I don't like YuBrotli asking you to pay for using an Open Source library. But anyway, I don't see any benefit of decoding Brotli content in Delphi. What is wrong with deflate/gzip for the client side? It would be fast enough, with very good compression ratio. – Arnaud Bouchez Feb 03 '20 at 11:08
-
@ArnaudBouchez Yes, you can. But at first, you have to write a pascal wrapper around dll and understand how to work with low-level API. As for me, I always prefer this way, but for other people who not very familiar with such low-level things I will recommend to use YuBrotli until there is no any other open source components. And to clarify - YuBrotli is free (you can use it everywhere, linking with precompiled .dcu) but not opensource. – zed Feb 03 '20 at 12:12
-
1@zed There are Open Source alternatives, at least one in a side project of mORMot - see my answer. I would never put some third-party component with no source in any project. – Arnaud Bouchez Feb 04 '20 at 09:00
1 Answers
3
There is an Open Source wrapper of Brotli headers in the Open Source mORMot BoilerPlate project.
This project offers a hardened and highly optimized web server, based on the mORMot HTTP core, with efficient compression and caching of static resources - in which Zopfli and Brotli are supported. For Delphi and Linux - with a permissive MIT license.
Check https://github.com/eugeneilyin/mORMotBP/tree/master/Tools/Brotli for the compression unit.

Arnaud Bouchez
- 42,305
- 3
- 71
- 159