From 29c48072956f526ce982d910e40395de43c9345f Mon Sep 17 00:00:00 2001
From: Ian Holsman
Date: Wed, 7 Aug 2002 15:26:17 +0000
Subject: mod-deflate now checks to make sure gzip-only-text-html is set to 1,
not anything. This will allow things like... SetEnv gzip-only-text/html 1
BrowserMatch "GECKO" gzip-only-text/html=0
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Obtained from: Andr� Schild
Reviewed by: Ian Holsman
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@96318 13f79535-47bb-0310-9956-ffa450edef68
---
CHANGES | 4 ++++
docs/manual/mod/mod_deflate.xml | 10 +++++++---
modules/filters/mod_deflate.c | 11 +++++++----
3 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/CHANGES b/CHANGES
index 6fa53aeeb8..8a8bcaef2b 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,9 @@
Changes with Apache 2.0.40
+ *) mod-defalte now checks to make sure that 'gzip-only-text/html' is
+ set to 1, so we can exclude things from the general case with
+ browsermatch. [Ian Holsman, Andre Schild ]
+
*) Accept multiple leading /'s for requests within the DocumentRoot.
PR 10946 [William Rowe, David Shane Holden ]
diff --git a/docs/manual/mod/mod_deflate.xml b/docs/manual/mod/mod_deflate.xml
index 041243e0c8..214ccad4be 100644
--- a/docs/manual/mod/mod_deflate.xml
+++ b/docs/manual/mod/mod_deflate.xml
@@ -25,9 +25,13 @@
filter. The following directive
will enable compression for documents in the container where it
is placed:
- Most popular browsers can not handle compression of all content
- so you may want to enable the 'gzip-only-text/html' note (see below)
-
+
+ Most popular browsers can not handle compression of all content
+ so you may want to set the 'gzip-only-text/html' note to 1 to only
+ allow html files to be compressed (see below)
+ if you set this to anything but '1' it will be ignored, so you can do
+ negative matches
+
SetEnv gzip-only-text/html 1
SetOutputFilter DEFLATE
diff --git a/modules/filters/mod_deflate.c b/modules/filters/mod_deflate.c
index 83e45446df..a456b0258e 100644
--- a/modules/filters/mod_deflate.c
+++ b/modules/filters/mod_deflate.c
@@ -277,10 +277,13 @@ static apr_status_t deflate_out_filter(ap_filter_t *f,
* other than text/html, so set gzip-only-text/html
* (with browsermatch) for them
*/
- if ((r->content_type == NULL
- || strncmp(r->content_type, "text/html", 9))
- && apr_table_get(r->subprocess_env, "gzip-only-text/html")) {
- ap_remove_output_filter(f);
+ if (r->content_type == NULL
+ || strncmp(r->content_type, "text/html", 9)) {
+ const char *env_value = apr_table_get(r->subprocess_env,
+ "gzip-only-text/html");
+ if ( env_value == NULL || strcmp(env_value,"1") ) {
+ ap_remove_output_filter(f);
+ }
return ap_pass_brigade(f->next, bb);
}
--
cgit v1.2.1