{"id":8241,"date":"2015-09-30T08:20:09","date_gmt":"2015-09-30T06:20:09","guid":{"rendered":"http:\/\/daniel.haxx.se\/blog\/?p=8241"},"modified":"2017-11-28T11:58:54","modified_gmt":"2017-11-28T10:58:54","slug":"libbrotli-is-brotli-in-lib-form","status":"publish","type":"post","link":"https:\/\/daniel.haxx.se\/blog\/2015\/09\/30\/libbrotli-is-brotli-in-lib-form\/","title":{"rendered":"libbrotli is brotli in lib form"},"content":{"rendered":"<p><a href=\"https:\/\/github.com\/google\/brotli\">Brotli<\/a> is this new cool compression algorithm that <a href=\"http:\/\/bitsup.blogspot.se\/2015\/09\/brotli-content-encoding-for-firefox-44.html\">Firefox now has support for<\/a> in Content-Encoding, <a href=\"https:\/\/groups.google.com\/a\/chromium.org\/forum\/#!msg\/blink-dev\/xdVm8c2GOMQ\/DsIZc8mhkPcJ\">Chrome will too<\/a> soon and Eric Lawrence wrote up <a href=\"http:\/\/textslashplain.com\/2015\/09\/10\/brotli\/\">this nice summary<\/a> about.<\/p>\n<p>So I&#8217;d love to see brotli supported as <a href=\"http:\/\/curl.haxx.se\/docs\/todo.html#More_compressions\">a Content-Encoding in curl too<\/a>, and then we just basically have to write some conditional code to detect the brotli library, add the adaption code for it and we should be in a good position. But&#8230;<\/p>\n<p><strong>There is (was) no brotli library!<\/strong><\/p>\n<p>It turns out the brotli team just writes their code to be linked with their tools, without making any library nor making it easy to install and use for third party applications.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignright wp-image-6196 size-full\" src=\"http:\/\/daniel.haxx.se\/blog\/wp-content\/uploads\/2014\/08\/circle-saw.jpg\" alt=\"an unmotivated circle saw\" width=\"248\" height=\"224\" srcset=\"https:\/\/daniel.haxx.se\/blog\/wp-content\/uploads\/2014\/08\/circle-saw.jpg 248w, https:\/\/daniel.haxx.se\/blog\/wp-content\/uploads\/2014\/08\/circle-saw-150x135.jpg 150w\" sizes=\"auto, (max-width: 248px) 100vw, 248px\" \/>We can&#8217;t have it like that! I rolled up my imaginary sleeves (imaginary since my swag tshirt doesn&#8217;t really have sleeves) and I now offer <a href=\"https:\/\/github.com\/bagder\/libbrotli\">libbrotli<\/a> to the world. It is just a bunch of files and a build system that sucks in the brotli upstream repo as a submodule and then it builds a decoder library (brotlidec) and an encoder library (brotlienc) out of them. So there&#8217;s no code of our own here. Just building on top of the great stuff done by others.<\/p>\n<p>It&#8217;s not complicated. It&#8217;s nothing fancy. But you can configure, make and make install two libraries and I can now go on and write a <a href=\"http:\/\/curl.haxx.se\/\">curl<\/a> adaption for this library so that we can get brotli support for it done. Ideally, this (making a library) is something the brotli project will do on their own at some point, but until they do I don&#8217;t mind handling this.<\/p>\n<p>As always, dive in and try it out, file any <a href=\"https:\/\/github.com\/bagder\/libbrotli\/issues\">issues<\/a> you find and send us your <a href=\"https:\/\/github.com\/bagder\/libbrotli\/pulls\">pull-requests<\/a> for everything you can help us out with!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Brotli is this new cool compression algorithm that Firefox now has support for in Content-Encoding, Chrome will too soon and Eric Lawrence wrote up this nice summary about. So I&#8217;d love to see brotli supported as a Content-Encoding in curl too, and then we just basically have to write some conditional code to detect the &hellip; <a href=\"https:\/\/daniel.haxx.se\/blog\/2015\/09\/30\/libbrotli-is-brotli-in-lib-form\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">libbrotli is brotli in lib form<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7,393,13,6,45],"tags":[467,292,433,33,419,86,230],"class_list":["post-8241","post","type-post","status-publish","format-standard","hentry","category-curl","category-firefox-floss","category-net","category-floss","category-web","tag-brotli","tag-chrome","tag-compression","tag-curl-and-libcurl","tag-development","tag-firefox","tag-http"],"_links":{"self":[{"href":"https:\/\/daniel.haxx.se\/blog\/wp-json\/wp\/v2\/posts\/8241","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/daniel.haxx.se\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/daniel.haxx.se\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/daniel.haxx.se\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/daniel.haxx.se\/blog\/wp-json\/wp\/v2\/comments?post=8241"}],"version-history":[{"count":5,"href":"https:\/\/daniel.haxx.se\/blog\/wp-json\/wp\/v2\/posts\/8241\/revisions"}],"predecessor-version":[{"id":8252,"href":"https:\/\/daniel.haxx.se\/blog\/wp-json\/wp\/v2\/posts\/8241\/revisions\/8252"}],"wp:attachment":[{"href":"https:\/\/daniel.haxx.se\/blog\/wp-json\/wp\/v2\/media?parent=8241"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/daniel.haxx.se\/blog\/wp-json\/wp\/v2\/categories?post=8241"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/daniel.haxx.se\/blog\/wp-json\/wp\/v2\/tags?post=8241"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}