Author: markt
Date: Thu Feb 15 11:38:11 2018
New Revision: 1824297

URL: http://svn.apache.org/viewvc?rev=1824297&view=rev
Log:
Prevent Tomcat from applying gzip compression to content that is already 
compressed with brotli compression.
Patch provided by burka.
This closes #99

Modified:
    tomcat/trunk/java/org/apache/coyote/CompressionConfig.java
    tomcat/trunk/webapps/docs/changelog.xml

Modified: tomcat/trunk/java/org/apache/coyote/CompressionConfig.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/CompressionConfig.java?rev=1824297&r1=1824296&r2=1824297&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/CompressionConfig.java (original)
+++ tomcat/trunk/java/org/apache/coyote/CompressionConfig.java Thu Feb 15 
11:38:11 2018
@@ -186,9 +186,10 @@ public class CompressionConfig {
 
         MimeHeaders responseHeaders = response.getMimeHeaders();
 
-        // Check if content is not already gzipped
+        // Check if content is not already compressed
         MessageBytes contentEncodingMB = 
responseHeaders.getValue("Content-Encoding");
-        if ((contentEncodingMB != null) && (contentEncodingMB.indexOf("gzip") 
!= -1)) {
+        if ((contentEncodingMB != null) && (contentEncodingMB.indexOf("gzip") 
!= -1) &&
+                    (contentEncodingMB.indexOf("br") != -1)) {
             return false;
         }
 

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1824297&r1=1824296&r2=1824297&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Thu Feb 15 11:38:11 2018
@@ -60,6 +60,10 @@
         specific error codes and/or exception types with the
         <code>ErrorReportValve</code>. (markt)
       </add>
+      <fix>
+        Prevent Tomcat from applying gzip compression to content that is 
already
+        compressed with brotli compression. Patch provided by burka. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Coyote">



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to