From 9222fb95a4e33eb8e634cf240c6db59e3c1e7349 Mon Sep 17 00:00:00 2001
From: Thomas Berezansky <tsbere@mvlc.org>
Date: Thu, 12 Jan 2012 15:37:48 -0500
Subject: [PATCH] Disable mod_deflate on XMLENT filtered files

Default configs for Ubuntu, at least, enable mod_deflate too broadly, and
XMLENT filtering needs to happen before mod_deflate kicks in.

Because we can't change the filter order, instead disable mod_deflate for
those files we have enabled XMLENT filtering, by use of the no-gzip ENV.

Signed-off-by: Thomas Berezansky <tsbere@mvlc.org>
Signed-off-by: Mike Rylander <mrylander@gmail.com>
---
 Open-ILS/examples/apache/eg_vhost.conf | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/Open-ILS/examples/apache/eg_vhost.conf b/Open-ILS/examples/apache/eg_vhost.conf
index a2ba0b2cf4..688f10b05a 100644
--- a/Open-ILS/examples/apache/eg_vhost.conf
+++ b/Open-ILS/examples/apache/eg_vhost.conf
@@ -231,6 +231,7 @@ RewriteRule . - [E=locale:en-US]
     XMLEntContentType "text/html; charset=utf-8"
     AddOutputFilter INCLUDES;XMLENT .xhtml
     AddOutputFilter INCLUDES;XMLENT .html
+    SetEnv no-gzip
     allow from all
 </LocationMatch>
 
@@ -239,6 +240,7 @@ RewriteRule . - [E=locale:en-US]
     Options +Includes
     XMLEntContentType "application/vnd.mozilla.xul+xml"
     AddOutputFilter INCLUDES;XMLENT .xul
+    SetEnv no-gzip
     allow from all
 </LocationMatch>
 
@@ -622,6 +624,21 @@ RewriteRule ^/openurl$ ${openurl:%1} [NE,PT]
 
     LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate
     CustomLog /var/log/apache2/deflate_log deflate
+
+    # There are problems with XMLENT and mod_deflate - so lets disable it
+    # This is where we don't have a pre-existing LocationMatch directive earlier
+    <LocationMatch /opac/.*\.xml$>
+        SetEnv no-gzip
+    </LocationMatch>
+    <LocationMatch /opac/[a-z]{2}-[A-Z]{2}/extras/slimpac/.*\.html$>
+        SetEnv no-gzip
+    </LocationMatch>
+    <LocationMatch /reports/.*\.xhtml$>
+        SetEnv no-gzip
+    </LocationMatch>
+    <LocationMatch /conify/.*\.html$>
+        SetEnv no-gzip
+    </LocationMatch>
 </IfModule>
 
 
-- 
2.11.0