Jeff Trawick wrote:
jean-frederic clere wrote:

Hi,

When using mod_jk2 and mod_charset_lite mod_charset_lite cores because r->filename is NULL.


patch looks reasonable... unfortunately, I lifted some bad style from somewhere (the code around your patch)... I'll fix that up and then commit the appropriate patch

I have to fix a little more in the file because binary files were incorrectly convert by xlate_in_filter().


Find the new patch enclosed (I have also (tried) to arrange the style around the patch).

Cheers

Jean-Frederic


     if (r->proxyreq) return DECLINED;
+    if (r->filename == NULL) return DECLINED;




Index: modules/experimental/mod_charset_lite.c
===================================================================
RCS file: /home/cvs/apache/httpd-2.0/modules/experimental/mod_charset_lite.c,v
retrieving revision 1.72
diff -u -r1.72 mod_charset_lite.c
--- modules/experimental/mod_charset_lite.c     29 Jun 2004 13:46:54 -0000      1.72
+++ modules/experimental/mod_charset_lite.c     9 Jul 2004 16:04:16 -0000
@@ -225,12 +225,25 @@
     }
 
     /* catch proxy requests */
-    if (r->proxyreq) return DECLINED;
+    if (r->proxyreq) {
+        return DECLINED;
+    }
+    if (r->filename == NULL) {
+        return DECLINED;
+    }
     /* mod_rewrite indicators */
-    if (!strncmp(r->filename, "redirect:", 9)) return DECLINED; 
-    if (!strncmp(r->filename, "gone:", 5)) return DECLINED; 
-    if (!strncmp(r->filename, "passthrough:", 12)) return DECLINED; 
-    if (!strncmp(r->filename, "forbidden:", 10)) return DECLINED; 
+    if (!strncmp(r->filename, "redirect:", 9)) {
+        return DECLINED;
+    }
+    if (!strncmp(r->filename, "gone:", 5)) {
+        return DECLINED;
+    }
+    if (!strncmp(r->filename, "passthrough:", 12)) {
+        return DECLINED;
+    }
+    if (!strncmp(r->filename, "forbidden:", 10)) {
+        return DECLINED;
+    }
     
     mime_type = r->content_type ? r->content_type : ap_default_type(r);
 
@@ -1037,6 +1050,15 @@
                      dc && dc->charset_default ? dc->charset_default : "(none)");
     }
 
+    /* Copy from the xlate_out_filter */
+    if (!ctx->noop) {
+        const char *mime_type = f->r->content_type ? f->r->content_type : 
ap_default_type(f->r);
+        if (strncasecmp(mime_type, "text/", 5) != 0 &&
+            strncasecmp(mime_type, "message/", 8) != 0) {
+            ctx->noop = 1;
+        }
+    }
+
     if (!ctx->ran) {  /* filter never ran before */
         chk_filter_chain(f);
         ctx->ran = 1;

Reply via email to