OSDN Git Service

* Fixed Bug.
authorkonn <konn@1a406e8e-add9-4483-a2c8-d8cac5b7c224>
Mon, 24 Mar 2008 10:31:20 +0000 (10:31 +0000)
committerkonn <konn@1a406e8e-add9-4483-a2c8-d8cac5b7c224>
Mon, 24 Mar 2008 10:31:20 +0000 (10:31 +0000)
    - When mpeg is downloaded, it memory a large amount of consumes it.

git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/modchxj/mod_chxj/branches/RELEASE_0_9_0@1914 1a406e8e-add9-4483-a2c8-d8cac5b7c224

include/mod_chxj.h
src/mod_chxj.c

index 1f33673..6a2ec86 100644 (file)
@@ -58,6 +58,8 @@
 
 #define STRCASEEQ(a,b,c,d) \
   ((((a) == *(d))|| ((b) == *(d))) && strcasecmp((c),(d)) == 0)
+#define STRNCASEEQ(a,b,c,d,e) \
+  ((((a) == *(d))|| ((b) == *(d))) && strncasecmp((c),(d),(e)) == 0)
 
 #include "qs_ignore_sp.h"
 #include "qs_log.h"
index 4c5ff49..e5f94ae 100644 (file)
@@ -639,6 +639,29 @@ chxj_output_filter(ap_filter_t *f, apr_bucket_brigade *bb)
     &&  !f->r->prev) 
       f->r->chunked = 1;
   }
+  if (r->content_type) {
+    if (! STRNCASEEQ('t','T',"text/html",r->content_type, sizeof("text/html")-1)
+    &&  ! STRNCASEEQ('t','T',"text/xml", r->content_type, sizeof("text/xml")-1)
+    &&  ! (STRNCASEEQ('i','I',"image/",  r->content_type, sizeof("image/") -1)
+          && ( STRCASEEQ('j','J',"jpeg",            &r->content_type[6])         /* JPEG */
+            || STRCASEEQ('j','J',"jp2",             &r->content_type[6])         /* JPEG2000 */
+            || STRCASEEQ('j','J',"jpeg2000",        &r->content_type[6])         /* JPEG2000 */
+            || STRCASEEQ('j','J',"jpeg2000-image",  &r->content_type[6])         /* JPEG2000 */
+            || STRCASEEQ('x','X',"x-jpeg2000-image",&r->content_type[6])         /* JPEG2000 */
+            || STRCASEEQ('p','P',"png",             &r->content_type[6])         /* PNG */
+            || STRCASEEQ('x','X',"x-png",           &r->content_type[6])         /* PNG */
+            || STRCASEEQ('g','G',"gif",             &r->content_type[6])))) {     /* GIF */
+      
+      DBG(r, "not convert content-type:[%s]", r->content_type);
+      ap_pass_brigade(f->next, bb);
+      return APR_SUCCESS;
+    }
+  }
+  else {
+    DBG(r, "not convert content-type:[(null)]");
+    ap_pass_brigade(f->next, bb);
+    return APR_SUCCESS;
+  }
 
   dconf      = ap_get_module_config(r->per_dir_config, &chxj_module);
   entryp     = chxj_apply_convrule(r, dconf->convrules);