<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>
+<meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type" />
+<!--
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
This file is generated from xml source: DO NOT EDIT
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-->
-<title>mod_ext_filter - Apache HTTP Server</title>
+<title>mod_ext_filter - Apache HTTP Server Version 2.5</title>
<link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
<link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
-<link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
+<link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" /><link rel="stylesheet" type="text/css" href="../style/css/prettify.css" />
+<script src="../style/scripts/prettify.min.js" type="text/javascript">
+</script>
+
<link href="../images/favicon.ico" rel="shortcut icon" /></head>
<body>
<div id="page-header">
-<p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p>
-<p class="apache">Apache HTTP Server Version 2.1</p>
-<img alt="" src="../images/feather.gif" /></div>
+<p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/quickreference.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p>
+<p class="apache">Apache HTTP Server Version 2.5</p>
+<img alt="" src="../images/feather.png" /></div>
<div class="up"><a href="./"><img title="<-" alt="<-" src="../images/left.gif" /></a></div>
<div id="path">
-<a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs-project/">Documentation</a> > <a href="../">Version 2.1</a> > <a href="./">Modules</a></div>
+<a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs/">Documentation</a> > <a href="../">Version 2.5</a> > <a href="./">Modules</a></div>
<div id="page-content">
<div id="preamble"><h1>Apache Module mod_ext_filter</h1>
+<div class="toplang">
+<p><span>Available Languages: </span><a href="../en/mod/mod_ext_filter.html" title="English"> en </a> |
+<a href="../fr/mod/mod_ext_filter.html" hreflang="fr" rel="alternate" title="Français"> fr </a> |
+<a href="../ja/mod/mod_ext_filter.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |
+<a href="../ko/mod/mod_ext_filter.html" hreflang="ko" rel="alternate" title="Korean"> ko </a></p>
+</div>
<table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Pass the response body through an external program before
delivery to the client</td></tr>
<tr><th><a href="module-dict.html#Status">Status:</a></th><td>Extension</td></tr>
a prototype environment for filters.</p>
</div>
-<div id="quickview"><h3 class="directives">Directives</h3>
+<div id="quickview"><h3>Topics</h3>
+<ul id="topics">
+<li><img alt="" src="../images/down.gif" /> <a href="#examples">Examples</a></li>
+</ul><h3 class="directives">Directives</h3>
<ul id="toc">
<li><img alt="" src="../images/down.gif" /> <a href="#extfilterdefine">ExtFilterDefine</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#extfilteroptions">ExtFilterOptions</a></li>
</ul>
-<h3>Topics</h3>
-<ul id="topics">
-<li><img alt="" src="../images/down.gif" /> <a href="#examples">Examples</a></li>
-</ul><h3>See also</h3>
+<h3>Bugfix checklist</h3><ul class="seealso"><li><a href="https://www.apache.org/dist/httpd/CHANGES_2.4">httpd changelog</a></li><li><a href="https://bz.apache.org/bugzilla/buglist.cgi?bug_status=__open__&list_id=144532&product=Apache%20httpd-2&query_format=specific&order=changeddate%20DESC%2Cpriority%2Cbug_severity&component=mod_ext_filter">Known issues</a></li><li><a href="https://bz.apache.org/bugzilla/enter_bug.cgi?product=Apache%20httpd-2&component=mod_ext_filter">Report a bug</a></li></ul><h3>See also</h3>
<ul class="seealso">
<li><a href="../filter.html">Filters</a></li>
-</ul></div>
+<li><a href="#comments_section">Comments</a></li></ul></div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="section">
<h2><a name="examples" id="examples">Examples</a></h2>
<h3>Generating HTML from some other type of response</h3>
- <div class="example"><p><code>
- # mod_ext_filter directive to define a filter<br />
- # to HTML-ize text/c files using the external<br />
- # program /usr/bin/enscript, with the type of<br />
- # the result set to text/html<br />
- ExtFilterDefine c-to-html mode=output \<br />
- <span class="indent">
- intype=text/c outtype=text/html \<br />
- cmd="/usr/bin/enscript --color -W html -Ec -o - -"<br />
- </span>
- <br />
- <Directory "/export/home/trawick/apacheinst/htdocs/c"><br />
- <span class="indent">
- # core directive to cause the new filter to<br />
- # be run on output<br />
- SetOutputFilter c-to-html<br />
- <br />
- # mod_mime directive to set the type of .c<br />
- # files to text/c<br />
- AddType text/c .c<br />
- <br />
- # mod_ext_filter directive to set the debug<br />
- # level just high enough to see a log message<br />
- # per request showing the configuration in force<br />
- ExtFilterOptions DebugLevel=1<br />
- </span>
- </Directory>
- </code></p></div>
+ <pre class="prettyprint lang-config"># mod_ext_filter directive to define a filter
+# to HTML-ize text/c files using the external
+# program /usr/bin/enscript, with the type of
+# the result set to text/html
+ExtFilterDefine c-to-html mode=output \
+ intype=text/c outtype=text/html \
+ cmd="/usr/bin/enscript --color -W html -Ec -o - -"
+
+<Directory "/export/home/trawick/apacheinst/htdocs/c">
+ # core directive to cause the new filter to
+ # be run on output
+ SetOutputFilter c-to-html
+
+ # mod_mime directive to set the type of .c
+ # files to text/c
+ AddType text/c .c
+</Directory></pre>
+
<h3>Implementing a content encoding filter</h3>
Please refer to <code class="module"><a href="../mod/mod_deflate.html">mod_deflate</a></code> for a practical
implementation.</p>
- <div class="example"><p><code>
- # mod_ext_filter directive to define the external filter<br />
- ExtFilterDefine gzip mode=output cmd=/bin/gzip<br />
- <br />
- <Location /gzipped><br />
- <span class="indent">
- # core directive to cause the gzip filter to be<br />
- # run on output<br />
- SetOutputFilter gzip<br />
- <br />
- # mod_header directive to add<br />
- # "Content-Encoding: gzip" header field<br />
- Header set Content-Encoding gzip<br />
- </span>
- </Location>
- </code></p></div>
+ <pre class="prettyprint lang-config"># mod_ext_filter directive to define the external filter
+ExtFilterDefine gzip mode=output cmd=/bin/gzip
+
+<Location "/gzipped">
+
+ # core directive to cause the gzip filter to be
+ # run on output
+ SetOutputFilter gzip
+
+ # mod_headers directive to add
+ # "Content-Encoding: gzip" header field
+ Header set Content-Encoding gzip
+</Location></pre>
+
<h3>Slowing down the server</h3>
- <div class="example"><p><code>
- # mod_ext_filter directive to define a filter<br />
- # which runs everything through cat; cat doesn't<br />
- # modify anything; it just introduces extra pathlength<br />
- # and consumes more resources<br />
- ExtFilterDefine slowdown mode=output cmd=/bin/cat \<br />
- <span class="indent">
- preservescontentlength<br />
- </span>
- <br />
- <Location /><br />
- <span class="indent">
- # core directive to cause the slowdown filter to<br />
- # be run several times on output<br />
- #<br />
- SetOutputFilter slowdown;slowdown;slowdown<br />
- </span>
- </Location>
- </code></p></div>
+ <pre class="prettyprint lang-config"># mod_ext_filter directive to define a filter
+# which runs everything through cat; cat doesn't
+# modify anything; it just introduces extra pathlength
+# and consumes more resources
+ExtFilterDefine slowdown mode=output cmd=/bin/cat \
+ preservescontentlength
+
+<Location "/">
+ # core directive to cause the slowdown filter to
+ # be run several times on output
+ #
+ SetOutputFilter slowdown;slowdown;slowdown
+</Location></pre>
+
<h3>Using sed to replace text in the response</h3>
- <div class="example"><p><code>
- # mod_ext_filter directive to define a filter which<br />
- # replaces text in the response<br />
- #<br />
- ExtFilterDefine fixtext mode=output intype=text/html \<br />
- <span class="indent">
- cmd="/bin/sed s/verdana/arial/g"<br />
- </span>
- <br />
- <Location /><br />
- <span class="indent">
- # core directive to cause the fixtext filter to<br />
- # be run on output<br />
- SetOutputFilter fixtext<br />
- </span>
- </Location>
- </code></p></div>
+ <pre class="prettyprint lang-config"># mod_ext_filter directive to define a filter which
+# replaces text in the response
+#
+ExtFilterDefine fixtext mode=output intype=text/html \
+ cmd="/bin/sed s/verdana/arial/g"
+
+<Location "/">
+ # core directive to cause the fixtext filter to
+ # be run on output
+ SetOutputFilter fixtext
+</Location></pre>
+
+
+<div class="note">
+<p>You can do the same thing using <code class="module"><a href="../mod/mod_substitute.html">mod_substitute</a></code>
+without invoking an external process.</p>
+</div>
<h3>Tracing another filter</h3>
- <div class="example"><p><code>
- # Trace the data read and written by mod_deflate<br />
- # for a particular client (IP 192.168.1.31)<br />
- # experiencing compression problems.<br />
- # This filter will trace what goes into mod_deflate.<br />
- ExtFilterDefine tracebefore \<br />
- <span class="indent">
- cmd="/bin/tracefilter.pl /tmp/tracebefore" \<br />
- EnableEnv=trace_this_client<br />
- </span>
- <br />
- # This filter will trace what goes after mod_deflate.<br />
- # Note that without the ftype parameter, the default<br />
- # filter type of AP_FTYPE_RESOURCE would cause the<br />
- # filter to be placed *before* mod_deflate in the filter<br />
- # chain. Giving it a numeric value slightly higher than<br />
- # AP_FTYPE_CONTENT_SET will ensure that it is placed<br />
- # after mod_deflate.<br />
- ExtFilterDefine traceafter \<br />
- <span class="indent">
- cmd="/bin/tracefilter.pl /tmp/traceafter" \<br />
- EnableEnv=trace_this_client ftype=21<br />
- </span>
- <br />
- <Directory /usr/local/docs><br />
- <span class="indent">
- SetEnvIf Remote_Addr 192.168.1.31 trace_this_client<br />
- SetOutputFilter tracebefore;deflate;traceafter<br />
- </span>
- </Directory>
- </code></p></div>
-
- <div class="example"><h3>Here is the filter which traces the data:</h3><p><code>
- #!/usr/local/bin/perl -w<br />
- use strict;<br />
- <br />
- open(SAVE, ">$ARGV[0]")<br />
- <span class="indent">
- or die "can't open $ARGV[0]: $?";<br />
- </span>
- <br />
- while (<STDIN>) {<br />
- <span class="indent">
- print SAVE $_;<br />
- print $_;<br />
- </span>
- }<br />
- <br />
- close(SAVE);
- </code></p></div>
+ <pre class="prettyprint lang-config"># Trace the data read and written by mod_deflate
+# for a particular client (IP 192.168.1.31)
+# experiencing compression problems.
+# This filter will trace what goes into mod_deflate.
+ExtFilterDefine tracebefore \
+ cmd="/bin/tracefilter.pl /tmp/tracebefore" \
+ EnableEnv=trace_this_client
+
+# This filter will trace what goes after mod_deflate.
+# Note that without the ftype parameter, the default
+# filter type of AP_FTYPE_RESOURCE would cause the
+# filter to be placed *before* mod_deflate in the filter
+# chain. Giving it a numeric value slightly higher than
+# AP_FTYPE_CONTENT_SET will ensure that it is placed
+# after mod_deflate.
+ExtFilterDefine traceafter \
+ cmd="/bin/tracefilter.pl /tmp/traceafter" \
+ EnableEnv=trace_this_client ftype=21
+
+<Directory "/usr/local/docs">
+ SetEnvIf Remote_Addr 192.168.1.31 trace_this_client
+ SetOutputFilter tracebefore;deflate;traceafter
+</Directory></pre>
+
+
+ <div class="example"><h3>Here is the filter which traces the data:</h3><pre class="prettyprint lang-perl">#!/usr/local/bin/perl -w
+use strict;
+
+open(SAVE, ">$ARGV[0]")
+ or die "can't open $ARGV[0]: $?";
+
+while (<STDIN>) {
+ print SAVE $_;
+ print $_;
+}
+
+close(SAVE);</pre>
+</div>
</div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
run and its arguments.</p>
<p><var>filtername</var> specifies the name of the filter being
- defined. This name can then be used in SetOutputFilter
+ defined. This name can then be used in <code class="directive"><a href="../mod/core.html#setoutputfilter">SetOutputFilter</a></code>
directives. It must be unique among all registered filters.
<em>At the present time, no error is reported by the
register-filter API, so a problem with duplicate names isn't
external command to run. If there are arguments after the
program name, the command line should be surrounded in
quotation marks (<em>e.g.</em>, <code>cmd="<var>/bin/mypgm</var>
- <var>arg1</var> <var>arg2</var>"</code>. Normal shell quoting is
+ <var>arg1</var> <var>arg2</var>"</code>.) Normal shell quoting is
not necessary since the program is run directly, bypassing the shell.
Program arguments are blank-delimited. A backslash can be used to
escape blanks which should be part of a program argument. Any
backslashes which are part of the argument must be escaped with
backslash themselves. In addition to the standard CGI environment
- variables, DOCUMENT_URI, DOCUMENT_PATH_INFO, and
+ variables, DOCUMENT_URI, DOCUMENT_PATH_INFO, and
QUERY_STRING_UNESCAPED will also be set for the program.</dd>
<dt><code>mode=<var>mode</var></code></dt>
- <dd><code>mode</code> should be <code>output</code> for now (the
- default). In the future, <code>mode=input</code> will be used to
- specify a filter for request bodies.</dd>
+ <dd>Use <code>mode=output</code> (the default) for filters which
+ process the response. Use <code>mode=input</code> for filters
+ which process the request. <code>mode=input</code> is available
+ in Apache 2.1 and later.</dd>
<dt><code>intype=<var>imt</var></code></dt>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="directive-section"><h2><a name="ExtFilterOptions" id="ExtFilterOptions">ExtFilterOptions</a> <a name="extfilteroptions" id="extfilteroptions">Directive</a></h2>
<table class="directive">
-<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configure mod_ext_filter options</td></tr>
+<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configure <code class="module"><a href="../mod/mod_ext_filter.html">mod_ext_filter</a></code> options</td></tr>
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ExtFilterOptions <var>option</var> [<var>option</var>] ...</code></td></tr>
-<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ExtFilterOptions DebugLevel=0 NoLogStderr</code></td></tr>
+<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ExtFilterOptions NoLogStderr</code></td></tr>
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory</td></tr>
<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_ext_filter</td></tr>
<var>Option</var> can be one of</p>
<dl>
- <dt><code>DebugLevel=<var>n</var></code></dt>
-
- <dd>
- The <code>DebugLevel</code> keyword allows you to specify
- the level of debug messages generated by
- <code class="module"><a href="../mod/mod_ext_filter.html">mod_ext_filter</a></code>. By default, no debug messages
- are generated. This is equivalent to
- <code>DebugLevel=0</code>. With higher numbers, more debug
- messages are generated, and server performance will be
- degraded. The actual meanings of the numeric values are
- described with the definitions of the DBGLVL_ constants
- near the beginning of <code>mod_ext_filter.c</code>.
-
- <p>Note: The core directive <code class="directive"><a href="../mod/core.html#loglevel">LogLevel</a></code> should be used to cause debug messages to
- be stored in the Apache error log.</p>
- </dd>
-
<dt><code>LogStderr | NoLogStderr</code></dt>
<dd>The <code>LogStderr</code> keyword specifies that
messages written to standard error by the external filter
program will be saved in the Apache error log.
<code>NoLogStderr</code> disables this feature.</dd>
+
+ <dt><code>Onfail=[abort|remove]</code></dt>
+ <dd>Determines how to proceed if the external filter program
+ cannot be started. With <code>abort</code> (the default value)
+ the request will be aborted. With <code>remove</code>, the
+ filter is removed and the request continues without it.</dd>
</dl>
- <div class="example"><h3>Example</h3><p><code>
- ExtFilterOptions LogStderr DebugLevel=0
- </code></p></div>
+ <pre class="prettyprint lang-config">ExtFilterOptions LogStderr</pre>
+
<p>Messages written to the filter's standard error will be stored
- in the Apache error log. No debug messages will be generated by
- <code class="module"><a href="../mod/mod_ext_filter.html">mod_ext_filter</a></code>. </p>
+ in the Apache error log.</p>
</div>
</div>
-<div id="footer">
-<p class="apache">Maintained by the <a href="http://httpd.apache.org/docs-project/">Apache HTTP Server Documentation Project</a></p>
-<p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div>
+<div class="bottomlang">
+<p><span>Available Languages: </span><a href="../en/mod/mod_ext_filter.html" title="English"> en </a> |
+<a href="../fr/mod/mod_ext_filter.html" hreflang="fr" rel="alternate" title="Français"> fr </a> |
+<a href="../ja/mod/mod_ext_filter.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |
+<a href="../ko/mod/mod_ext_filter.html" hreflang="ko" rel="alternate" title="Korean"> ko </a></p>
+</div><div class="top"><a href="#page-header"><img src="../images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">Comments</a></h2><div class="warning"><strong>Notice:</strong><br />This is not a Q&A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our <a href="http://httpd.apache.org/lists.html">mailing lists</a>.</div>
+<script type="text/javascript"><!--//--><![CDATA[//><!--
+var comments_shortname = 'httpd';
+var comments_identifier = 'http://httpd.apache.org/docs/trunk/mod/mod_ext_filter.html';
+(function(w, d) {
+ if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
+ d.write('<div id="comments_thread"><\/div>');
+ var s = d.createElement('script');
+ s.type = 'text/javascript';
+ s.async = true;
+ s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
+ (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
+ }
+ else {
+ d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>');
+ }
+})(window, document);
+//--><!]]></script></div><div id="footer">
+<p class="apache">Copyright 2016 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
+<p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/quickreference.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!--
+if (typeof(prettyPrint) !== 'undefined') {
+ prettyPrint();
+}
+//--><!]]></script>
</body></html>
\ No newline at end of file