[PATCH] Re: mod_deflate in 2.0.40

2002-08-30 Thread Kris Verbeeck

Hi again,

After testing I discovered that some more changes were needed to get it to work.
Patch has been attached.  This patch should still have the behaviour of enabling
compression when gzip-only-text/html is set to something other than 1.  It
will also enable compression if gzip-only-text/html is not set at all.

Kris Verbeeck wrote:
 
 Hi,
 
 The 2.0.39 code:
 
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);
   return ap_pass_brigade(f-next, bb);
}
 
 says 'if we have a response with a content-type other than text/html AND
 the environment variable gzip-only-text/html is defined then we will
 not deflate (remove filter)'
 
 The 2.0.40 code:
 
if (r-content_type == NULL || strncmp(r-content_type, text/html, 9)) {
   const char *env_value = apr_table_get(r-subprocess_env, );
   if ( env_value == NULL || strcmp(env_value,1) ) {
   ap_remove_output_filter(f);
   }
   return ap_pass_brigade(f-next, bb);
}
 
 says 'if we have a response with a content-type other than text/html AND
 gzip-only-text/html is not defined OR it is defined but different from 1
 then we will not deflate (remove filter)'
 
 IMHO this is something completely different.  With the new code the filter is always
 removed unless you define gzip-only-text/html to be 1.  So you can't compress
 other files, e.g. .txt. I think the strcmp test should be strcmp(...) == 0.
 
 Or am I missing something??
 
 --
 ir. Kris Verbeeck
 Development Engineer
 
 Ubizen - Ubicenter - Philipssite 5 - 3001 Leuven - Belgium
 T:  +32 16 28 70 64
 F:  +32 16 28 70 77
 
 Ubizen - We Secure e-business - www.ubizen.com

-- 
ir. Kris Verbeeck
Development Engineer

Ubizen - Ubicenter - Philipssite 5 - 3001 Leuven - Belgium
T:  +32 16 28 70 64
F:  +32 16 28 70 77

Ubizen - We Secure e-business - www.ubizen.com


--- httpd-2.0.40/modules/filters/mod_deflate.c  Wed Aug  7 17:26:17 2002
+++ httpd-2.0.40-PATCHED/modules/filters/mod_deflate.c  Fri Aug 30 13:15:22 2002
 -281,10 +281,10 
  || 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) ) {
+if ( (env_value != NULL)  (strcmp(env_value,1) == 0) ) {
 ap_remove_output_filter(f);
+return ap_pass_brigade(f-next, bb);
 }
-return ap_pass_brigade(f-next, bb);
 }
 
 /* Let's see what our current Content-Encoding is.



Re: [PATCH] Re: mod_deflate in 2.0.40

2002-08-30 Thread Ian Holsman

Thanks Kris.
I've applied your change.