From ea50c3d516c03aaf28a30282e69505f81cbcb2c1 Mon Sep 17 00:00:00 2001 From: Jeff Trawick Date: Thu, 18 Jul 2002 20:31:14 +0000 Subject: [PATCH] mod_ext_filter: Ignore any content-type parameters when checking if the response should be filtered. Previously, "intype=text/html" wouldn't match something like "text/html;charset=8859_1". git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@96115 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES | 5 +++++ modules/experimental/mod_ext_filter.c | 25 +++++++++++++++++-------- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/CHANGES b/CHANGES index 06cb6cb8fa..5c89114bbd 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,10 @@ Changes with Apache 2.0.40 + *) mod_ext_filter: Ignore any content-type parameters when checking if + the response should be filtered. Previously, "intype=text/html" + wouldn't match something like "text/html;charset=8859_1". + [Jeff Trawick] + *) mod_ext_filter: Set up environment variables for external programs. [Craig Sebenik ] diff --git a/modules/experimental/mod_ext_filter.c b/modules/experimental/mod_ext_filter.c index 0ce3832c79..eafe3adb06 100644 --- a/modules/experimental/mod_ext_filter.c +++ b/modules/experimental/mod_ext_filter.c @@ -536,13 +536,21 @@ static apr_status_t init_filter_instance(ap_filter_t *f) } ctx->p = f->r->pool; if (ctx->filter->intype && - ctx->filter->intype != INTYPE_ALL && - (!f->r->content_type || - strcasecmp(ctx->filter->intype, f->r->content_type))) { - /* wrong IMT for us; don't mess with the output */ - ctx->noop = 1; + ctx->filter->intype != INTYPE_ALL) { + if (!f->r->content_type) { + ctx->noop = 1; + } + else { + const char *ctypes = f->r->content_type; + const char *ctype = ap_getword(f->r->pool, &ctypes, ';'); + + if (strcasecmp(ctx->filter->intype, ctype)) { + /* wrong IMT for us; don't mess with the output */ + ctx->noop = 1; + } + } } - else { + if (!ctx->noop) { rv = init_ext_filter_process(f); if (rv != APR_SUCCESS) { return rv; @@ -560,9 +568,10 @@ static apr_status_t init_filter_instance(ap_filter_t *f) if (dc->debug >= DBGLVL_SHOWOPTIONS) { ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, f->r, - "%sfiltering `%s' through `%s', cfg %s", - ctx->noop ? "skipping: " : "", + "%sfiltering `%s' of type `%s' through `%s', cfg %s", + ctx->noop ? "NOT " : "", f->r->uri ? f->r->uri : f->r->filename, + f->r->content_type ? f->r->content_type : "(unspecified)", ctx->filter->command, get_cfg_string(dc, ctx->filter, f->r->pool)); } -- 2.50.1