This is an automated email from the ASF dual-hosted git repository. remm pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/9.0.x by this push: new 2f285843e6 Further improve with feedback from 69575 2f285843e6 is described below commit 2f285843e6153249ae148cb2a47c6e6f9a40dab6 Author: remm <r...@apache.org> AuthorDate: Thu Feb 20 21:41:26 2025 +0100 Further improve with feedback from 69575 Add to existing content-encoding header values when compressing. Skip compression with content-encoding with "identity". Add more content-encoding values based on HTTP Content Coding Registry (skip deprecated values). --- java/org/apache/coyote/CompressionConfig.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/java/org/apache/coyote/CompressionConfig.java b/java/org/apache/coyote/CompressionConfig.java index 7bd2c186db..1ef26d93b5 100644 --- a/java/org/apache/coyote/CompressionConfig.java +++ b/java/org/apache/coyote/CompressionConfig.java @@ -221,6 +221,7 @@ public class CompressionConfig { } boolean useTE = false; + boolean useCE = true; MimeHeaders responseHeaders = response.getMimeHeaders(); @@ -238,8 +239,13 @@ public class CompressionConfig { log.warn(sm.getString("compressionConfig.ContentEncodingParseFail"), e); return false; } - if (tokens.contains("gzip") || tokens.contains("compress") || tokens.contains("deflate") - || tokens.contains("br") || tokens.contains("zstd")) { + if (tokens.contains("identity")) { + // If identity, do not do content modifications + useCE = false; + } else if (tokens.contains("br") || tokens.contains("compress") || tokens.contains("dcb") + || tokens.contains("dcz") || tokens.contains("deflate") || tokens.contains("gzip") + || tokens.contains("pack200-gzip") || tokens.contains("zstd")) { + // Content should not be compressed twice return false; } } @@ -291,7 +297,7 @@ public class CompressionConfig { } } - if (!useTE) { + if (useCE && !useTE) { // If processing reaches this far, the response might be compressed. // Therefore, set the Vary header to keep proxies happy ResponseUtil.addVaryFieldName(responseHeaders, "accept-encoding"); @@ -347,7 +353,7 @@ public class CompressionConfig { responseHeaders.addValue("Transfer-Encoding").setString("gzip"); } else { // Configure the content encoding for compressed content - responseHeaders.setValue("Content-Encoding").setString("gzip"); + responseHeaders.addValue("Content-Encoding").setString("gzip"); } return true; --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org