Apache モジュール mod_ext_filter
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
core directive to cause the new filter to
be run on output
mod_mime directive to set the type of .c
files to text/c
mod_ext_filter directive to set the debug
level just high enough to see a log message
per request showing the configuration in force
mod_ext_filter directive to define the external filter
core directive to cause the gzip filter to be
run on output
mod_header directive to add
"Content-Encoding: gzip" header field
which runs everything through cat; cat doesn't
modify anything; it just introduces extra pathlength
and consumes more resources
core directive to cause the slowdown filter to
be run several times on output
SetOutputFilter slowdown;slowdown;slowdown
mod_ext_filter directive to define a filter which
replaces text in the response
ExtFilterDefine fixtext mode=output intype=text/html \
core directive to cause the fixtext filter to
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
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
注: この gzip の例はデモ用です。実用的な実装は
cmd="/bin/sed s/verdana/arial/g"
cmd="/bin/tracefilter.pl /tmp/tracebefore" \
EnableEnv=tracethisclient ftype=21
SetEnvIf RemoteAddr 192.168.1.31 tracethis_client
SetOutputFilter tracebefore;deflate;traceafter
open(SAVE, ">$ARGV[0]")
or die "can't open $ARGV[0]: $?";
ディレクティブで指定できます。名前は登録されるすべてのフィルタで 一意でなくてはなりません。SetOutputFilter現時点では、フィルタの登録 API からは エラーは報告されません。ですから、重複する名前を使ってしまったときでも ユーザにはそのことは報告されません。
続くパラメータの順番は関係無く、それらは実行する外部コマンドと、 他の特性を定義します。cmd=
キーワードは実行する外部コマンドを指定します。 プログラム名の後に引数がある場合は、コマンド行は引用符で囲む 必要があります (cmd="/bin/mypgm arg1 arg2"
(デフォルト) を使います。リクエストを処理するフィルタには mode=input
が指定されていれば、フィルタは指定されていない ドキュメントには適用されなくなります。outtype=imt
キーワードはフィルタが content length (ftype=filtertype
ExtFilterOptions DebugLevel=0 NoLogStderr
の生成するデバッグメッセージのレベルを設定できます。 デフォルトでは、デバッグメッセージは生成されません。 これは DebugLevel=0
と設定するのと同じです。 数字が大きくなればなるほど、より多くのデバッグメッセージが 生成され、サーバの性能は落ちます。数値の実際の意味は modextfilter.c
の先頭近くの DBGLVL_ 定数の 定義で説明されています。 注: デバッグメッセージを Apache のエラーログに 保存するようにするためには、core のディレクティブ
は 逆に保存しないようにします。 ExtFilterOptions LogStderr DebugLevel=0
この例では、フィルタの標準出力に書かれたメッセージは Apache のエラーログに保存されます。
モジュール | ディレクティブ | FAQ | 用語 | サイトマップ
Apache HTTP サーバ バージョン 2.4
Apache モジュール mod_ext_filter
翻訳済み言語: en | fr | ja | ko
例
# 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 - -"
ExtFilterDefine ディレクティブ
ExtFilterDefine は、実行するプログラムや 引数など、外部フィルタの特性を定義します。
ExtFilterOptions ディレクティブ
ExtFilterOptions ディレクティブは mod_ext_filter の特別な処理用のオプションを 指定します。Option には以下のどれかを指定します。