From: Jim Jagielski Date: Thu, 21 Feb 2008 20:43:54 +0000 (+0000) Subject: Merge r629615, r629915 from trunk: X-Git-Tag: 2.2.9~356 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9424d540d8fd6bd47d4030576c16d53669dc71a4;p=thirdparty%2Fapache%2Fhttpd.git Merge r629615, r629915 from trunk: *) mod_charset_lite: Add ForceAllMimeTypes sub-option to CharsetOptions, allowing the administrator to skip the mimetype checking that precedes translation. PR 44458 [Eric Covener] rename mod_charset_lite CharsetOption ForceAllMimeTypes to TranslateAllMimeTypes (only about 18 hours old) Submitted by: covener Reviewed by: jim git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@629983 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 81358fe9748..4d5c3e5cf0e 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,11 @@ -*- coding: utf-8 -*- Changes with Apache 2.2.9 + *) mod_charset_lite: Add ForceAllMimeTypes sub-option to + CharsetOptions, allowing the administrator to skip the + mimetype checking that precedes translation. + PR 44458 [Eric Covener] + *) mod_proxy_http: Fix processing of chunked responses if Connection: Transfer-Encoding is set in the response of the proxied system. PR 44311 [Ruediger Pluem] diff --git a/STATUS b/STATUS index 55084806c02..3b47c7ea3af 100644 --- a/STATUS +++ b/STATUS @@ -81,12 +81,6 @@ RELEASE SHOWSTOPPERS: PATCHES ACCEPTED TO BACKPORT FROM TRUNK: [ start all new proposals below, under PATCHES PROPOSED. ] - * mod_charset_lite: Add TranslateAllMimeTypes sub-option to - CharsetOptions. PR 44458 - Trunk version of patch: - http://svn.apache.org/viewvc?rev=629615&view=rev - http://svn.apache.org/viewvc?rev=629915&view=rev - +1: covener, rpluem, jim PATCHES PROPOSED TO BACKPORT FROM TRUNK: [ New proposals should be added at the end of the list ] diff --git a/docs/manual/mod/mod_charset_lite.html.en b/docs/manual/mod/mod_charset_lite.html.en index 72f2d082971..01e27dd5ccc 100644 --- a/docs/manual/mod/mod_charset_lite.html.en +++ b/docs/manual/mod/mod_charset_lite.html.en @@ -166,6 +166,14 @@ explicitly configured using the AddOutputFilter directive, NoImplicitAdd should be specified so that mod_charset_lite doesn't add its filter. + +
TranslateAllMimeTypes | NoTranslateAllMimeTypes
+
Normally, mod_charset_lite will only perform + translation on a small subset of possible mimetypes. When the + TranslateAllMimeTypes keyord is specified for a given + configuration section, translation is performed without regard for + mimetype.
+ diff --git a/docs/manual/mod/mod_charset_lite.xml b/docs/manual/mod/mod_charset_lite.xml index 30f26306827..ecbd412ad23 100644 --- a/docs/manual/mod/mod_charset_lite.xml +++ b/docs/manual/mod/mod_charset_lite.xml @@ -193,6 +193,14 @@ >AddOutputFilter directive, NoImplicitAdd should be specified so that mod_charset_lite doesn't add its filter. + +
TranslateAllMimeTypes | NoTranslateAllMimeTypes
+
Normally, mod_charset_lite will only perform + translation on a small subset of possible mimetypes. When the + TranslateAllMimeTypes keyord is specified for a given + configuration section, translation is performed without regard for + mimetype.
+ diff --git a/modules/filters/mod_charset_lite.c b/modules/filters/mod_charset_lite.c index ed8ecbe5ca2..079876b1d54 100644 --- a/modules/filters/mod_charset_lite.c +++ b/modules/filters/mod_charset_lite.c @@ -76,6 +76,8 @@ typedef struct charset_dir_t { const char *charset_default; /* how to ship on wire */ /** module does ap_add_*_filter()? */ enum {IA_INIT, IA_IMPADD, IA_NOIMPADD} implicit_add; + /** treat all mimetypes as text? */ + enum {FX_INIT, FX_FORCE, FX_NOFORCE} force_xlate; } charset_dir_t; /* charset_filter_ctx_t is created for each filter instance; because the same @@ -138,6 +140,8 @@ static void *merge_charset_dir_conf(apr_pool_t *p, void *basev, void *overridesv over->charset_source ? over->charset_source : base->charset_source; a->implicit_add = over->implicit_add != IA_INIT ? over->implicit_add : base->implicit_add; + a->force_xlate= + over->force_xlate != FX_INIT ? over->force_xlate : base->force_xlate; return a; } @@ -176,6 +180,12 @@ static const char *add_charset_options(cmd_parms *cmd, void *in_dc, else if (!strcasecmp(flag, "NoImplicitAdd")) { dc->implicit_add = IA_NOIMPADD; } + if (!strcasecmp(flag, "TranslateAllMimeTypes")) { + dc->force_xlate = FX_FORCE; + } + else if (!strcasecmp(flag, "NoTranslateAllMimeTypes")) { + dc->force_xlate = FX_NOFORCE; + } else if (!strncasecmp(flag, "DebugLevel=", 11)) { dc->debug = atoi(flag + 11); } @@ -803,7 +813,8 @@ static apr_status_t xlate_out_filter(ap_filter_t *f, apr_bucket_brigade *bb) */ strcmp(mime_type, DIR_MAGIC_TYPE) == 0 || #endif - strncasecmp(mime_type, "message/", 8) == 0) { + strncasecmp(mime_type, "message/", 8) == 0 || + dc->force_xlate == FX_FORCE) { rv = apr_xlate_open(&ctx->xlate, dc->charset_default, dc->charset_source, f->r->pool);