📄 mod_ext_filter.html
字号:
<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>
</div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="directive-section"><h2><a name="ExtFilterDefine" id="ExtFilterDefine">ExtFilterDefine</a> <a name="extfilterdefine" id="extfilterdefine">指令</a></h2>
<table border="1" cellpadding="0" cellspacing="0" bordercolor="#AAAAAA" class="directive">
<tr><th><a href="directive-dict.html#Description">说明</a></th><td>Define an external filter</td></tr>
<tr><th><a href="directive-dict.html#Syntax">语法</a></th><td><code>ExtFilterDefine <var>filtername</var> <var>parameters</var></code></td></tr>
<tr><th><a href="directive-dict.html#Context">作用域</a></th><td>server config</td></tr>
<tr><th><a href="directive-dict.html#Status">状态</a></th><td>扩展(E)</td></tr>
<tr><th><a href="directive-dict.html#Module">模块</a></th><td>mod_ext_filter</td></tr>
</table>
<p><code class="directive">ExtFilterDefine</code> directive defines the
characteristics of an external filter, including the program to
run and its arguments.</p>
<p><var>filtername</var> specifies the name of the filter being
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
reported to the user.</em></p>
<p>Subsequent parameters can appear in any order and define the
external command to run and certain other characteristics. The
only required parameter is <code>cmd=</code>. These parameters
are:</p>
<dl>
<dt><code>cmd=<var>cmdline</var></code></dt>
<dd>The <code>cmd=</code> keyword allows you to specify the
external command to run. If there are arguments after the
program name, the command line should be surrounded in
quotation marks (例如,<code>cmd="<var>/bin/mypgm</var>
<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
QUERY_STRING_UNESCAPED will also be set for the program.</dd>
<dt><code>mode=<var>mode</var></code></dt>
<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>
<dd>This parameter specifies the internet media type (<em>i.e.</em>,
MIME type) of documents which should be filtered. By default,
all documents are filtered. If <code>intype=</code> is
specified, the filter will be disabled for documents of other
types.</dd>
<dt><code>outtype=<var>imt</var></code></dt>
<dd>This parameter specifies the internet media type (<em>i.e.</em>,
MIME type) of filtered documents. It is useful when the
filter changes the internet media type as part of the
filtering operation. By default, the internet media type is
unchanged.</dd>
<dt><code>PreservesContentLength</code></dt>
<dd>The <code>PreservesContentLength</code> keyword specifies
that the filter preserves the content length. This is not the
default, as most filters change the content length. In the
event that the filter doesn't modify the length, this keyword
should be specified.</dd>
<dt><code>ftype=<var>filtertype</var></code></dt>
<dd>This parameter specifies the numeric value for filter type
that the filter should be registered as. The default value,
AP_FTYPE_RESOURCE, is sufficient in most cases. If the filter
needs to operate at a different point in the filter chain than
resource filters, then this parameter will be necessary. See
the AP_FTYPE_foo definitions in util_filter.h for appropriate
values.</dd>
<dt><code>disableenv=<var>env</var></code></dt>
<dd>This parameter specifies the name of an environment variable
which, if set, will disable the filter.</dd>
<dt><code>enableenv=<var>env</var></code></dt>
<dd>This parameter specifies the name of an environment variable
which must be set, or the filter will be disabled.</dd>
</dl>
</div>
<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">指令</a></h2>
<table border="1" cellpadding="0" cellspacing="0" bordercolor="#AAAAAA" class="directive">
<tr><th><a href="directive-dict.html#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">语法</a></th><td><code>ExtFilterOptions <var>option</var> [<var>option</var>] ...</code></td></tr>
<tr><th><a href="directive-dict.html#Default">默认值</a></th><td><code>ExtFilterOptions DebugLevel=0 NoLogStderr</code></td></tr>
<tr><th><a href="directive-dict.html#Context">作用域</a></th><td>directory</td></tr>
<tr><th><a href="directive-dict.html#Status">状态</a></th><td>扩展(E)</td></tr>
<tr><th><a href="directive-dict.html#Module">模块</a></th><td>mod_ext_filter</td></tr>
</table>
<p><code class="directive">ExtFilterOptions</code> directive specifies
special processing options for <code class="module"><a href="../mod/mod_ext_filter.html">mod_ext_filter</a></code>.
<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>
</dl>
<div class="example"><h3>示例</h3><p><code>
ExtFilterOptions LogStderr DebugLevel=0
</code></p></div>
<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>
</div>
</div>
<div id="footer">
<p class="apache">本文允许自由使用、分发、转载,但必须保留译者署名;详见:<a href="../translator_announcement.html#announcement">译者声明</a>。</p>
<p class="menu"><a href="../mod/index.html">模块索引</a> | <a href="../mod/directives.html">指令索引</a> | <a href="../faq/index.html">常见问题</a> | <a href="../glossary.html">词汇表</a> | <a href="../sitemap.html">站点导航</a></p></div>
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -