|Summary:||Support precompressed brotli files in addition to gzip files if matching accept-encoding header|
|Product:||Tomcat 9||Reporter:||Mikko Tiihonen <mikko.tiihonen>|
|Component:||Catalina||Assignee:||Tomcat Developers Mailing List <dev>|
Description Mikko Tiihonen 2016-02-17 12:51:31 UTC
I want to serve brotli compressed static files from tomcat DefaultServlet if the browser supports it. They are about 15% smaller than the gzip files. I created a pull request for the feature: https://github.com/apache/tomcat/pull/28 The feature is quite generic, but it does not yet have any way to configure the list compression formats using DefaultServlet parameters. That can be added later if we want to support other compression formats.
Comment 1 Christopher Schultz 2016-02-17 20:27:29 UTC
A few thoughts: 1. This is interesting (Brotli) 2. This pull request has very little Brotli-specific stuff in it (just a unit test that exercises the generic "precompressed" refactoring introduced here) 3. It is forward-compatible with other compression algorithms with obvious filename extensions I'm +1 on this pull request. I'd like some other feedback, though, first.
Comment 2 Christopher Schultz 2016-02-17 21:20:43 UTC
Oh, another thing: there are no license issues, here, since although Brotli has a (modified?) MIT license (and I'm not clear on its compatibility with AL2), there is no specific support for the algorithm: it's merely detecting the presence of a precompressed file using its filename extension and providing the appropriate Content-Encoding response header.
Comment 3 Mikko Tiihonen 2016-03-05 18:10:11 UTC
I updated the pull request a week ago based on feedback from markt-asf. Changes: - possibility to configure the list of precompressed file types for default servlet - parsing accept-encoding header according to RFC7231 (the current functionality in tomcat serves gzip even if explicitly disabled with accept-encoding:gzip;q=0) What would be the process for accepting this feature?
Comment 4 Mark Thomas 2016-03-08 20:48:59 UTC
Thanks for the updated patch. It looks great. I've applied it to 9.0.x and it will be included in 9.0.0.M4 onwards.