Return-Path: Delivered-To: apmail-httpd-cvs-archive@httpd.apache.org Received: (qmail 23235 invoked by uid 500); 13 Nov 2002 00:17:14 -0000 Mailing-List: contact cvs-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list cvs@httpd.apache.org Received: (qmail 23224 invoked by uid 500); 13 Nov 2002 00:17:14 -0000 Delivered-To: apmail-httpd-2.0-cvs@apache.org Date: 13 Nov 2002 00:17:05 -0000 Message-ID: <20021113001705.35831.qmail@icarus.apache.org> From: nd@apache.org To: httpd-2.0-cvs@apache.org Subject: cvs commit: httpd-2.0/docs/manual/mod index.html.en mod_ext_filter.html.en quickreference.html.en X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N nd 2002/11/12 16:17:05 Modified: docs/manual/mod index.html.en mod_ext_filter.html.en quickreference.html.en Log: update transformation Revision Changes Path 1.22 +2 -3 httpd-2.0/docs/manual/mod/index.html.en Index: index.html.en =================================================================== RCS file: /home/cvs/httpd-2.0/docs/manual/mod/index.html.en,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- index.html.en 12 Nov 2002 21:43:45 -0000 1.21 +++ index.html.en 13 Nov 2002 00:17:04 -0000 1.22 @@ -67,9 +67,8 @@
mod_example
Illustrates the Apache module API
mod_expires
Generation of Expires HTTP headers according to user-specified criteria
-
mod_ext_filter
Pass the response body - through an external program before delivery to the - client
+
mod_ext_filter
Pass the response body through an external program before +delivery to the client
mod_file_cache
Caches a static list of files in memory
mod_headers
Customization of HTTP request and response headers
1.16 +186 -159 httpd-2.0/docs/manual/mod/mod_ext_filter.html.en Index: mod_ext_filter.html.en =================================================================== RCS file: /home/cvs/httpd-2.0/docs/manual/mod/mod_ext_filter.html.en,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- mod_ext_filter.html.en 7 Oct 2002 15:23:02 -0000 1.15 +++ mod_ext_filter.html.en 13 Nov 2002 00:17:04 -0000 1.16 @@ -5,9 +5,8 @@ This file is generated from xml source: DO NOT EDIT XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -->mod_ext_filter - Apache HTTP Server
<-

Apache Module mod_ext_filter

Description: - Pass the response body - through an external program before delivery to the - client
Status: + Pass the response body through an external program before +delivery to the client
Status: Experimental
Module�Identifier: ext_filter_module
Source�File: mod_ext_filter.c

Summary

@@ -42,128 +41,159 @@ a prototype environment for filters.

Directives

Topics

  • Examples
top

Examples

- -

Generating HTML from some other type of response

-
  -# 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
  -
  -# mod_ext_filter directive to set the debug level just high 
  -# enough to see a log message per request showing the configuration
  -# in force
  -ExtFilterOptions DebugLevel=1
  -
  -</Directory>
  -
- - -

Implementing a content encoding filter

-
  -# 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_header directive to add "Content-Encoding: gzip" header field
  -Header set Content-Encoding gzip
  -
  -</Location>
  -
- -

Note: this gzip example is just for the purposes of illustration. - Please refer to mod_deflate for a practical - implementation.

- - -

Slowing down the server

-
  -# 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>
  -
- - -

Using sed to replace text in the response

-
  -# mod_ext_filter directive to define a filter which replaces text in
  -# the response
  -ExtFilterDefine fixtext mode=output cmd="/bin/sed s/verdana/arial/g" intype=text/html
  -
  -<Location />
  -
  -# core directive to cause the fixtext filter to be run on output
  -# output
  -SetOutputFilter fixtext
  -
  -</Location>
  -
- - -

Tracing another filter

-
  -# 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>
  -
- -

Here is the filter which traces the data:

  -#!/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);
  -
- +

Topics

See also

top

Examples

+

Generating HTML from some other type of response

+

+ # 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
+
+ # mod_ext_filter directive to set the debug
+ # level just high enough to see a log message
+ # per request showing the configuration in force
+ ExtFilterOptions DebugLevel=1
+
+ </Directory> +

+ + +

Implementing a content encoding filter

+

Note: this gzip example is just for the purposes of illustration. + Please refer to mod_deflate for a practical + implementation.

+ +

+ # 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_header directive to add
+ # "Content-Encoding: gzip" header field
+ Header set Content-Encoding gzip
+
+ </Location> +

+ + +

Slowing down the server

+

+ # 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> +

+ + +

Using sed to replace text in the response

+

+ # 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> +

+ + +

Tracing another filter

+

+ # 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> +

+ +

Here is the filter which traces the data:

+ #!/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); +

+
top

ExtFilterDefine Directive

Description: -
Syntax: - ExtFilterDefine filtername parameters
Context: + Define an external filter
Syntax: + ExtFilterDefine filtername parameters
Context: server config
Status: Experimental
Module: mod_ext_filter
@@ -171,7 +201,7 @@ characteristics of an external filter, including the program to run and its arguments.

-

filtername specifies the name of the filter being +

filtername specifies the name of the filter being defined. This name can then be used in SetOutputFilter directives. It must be unique among all registered filters. At the present time, no error is reported by the @@ -180,48 +210,48 @@

Subsequent parameters can appear in any order and define the external command to run and certain other characteristics. The - only required parameter is cmd=. These parameters + only required parameter is cmd=. These parameters are:

-
cmd=cmdline
+
cmd=cmdline
The cmd= 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 (e.g., cmd="/bin/mypgm arg1 arg2". - 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 + quotation marks (e.g., cmd="/bin/mypgm + arg1 arg2". 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.
-
mode=mode
+
mode=mode
-
mode should be output for now (the - default). In the future, mode=input will be used to +
mode should be output for now (the + default). In the future, mode=input will be used to specify a filter for request bodies.
-
intype=imt
+
intype=imt
-
This parameter specifies the internet media type (i.e., +
This parameter specifies the internet media type (i.e., MIME type) of documents which should be filtered. By default, all documents are filtered. If intype= is specified, the filter will be disabled for documents of other types.
-
outtype=imt
+
outtype=imt
-
This parameter specifies the internet media type (i.e., +
This parameter specifies the internet media type (i.e., 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.
-
PreservesContentLength
+
PreservesContentLength
The PreservesContentLength keyword specifies that the filter preserves the content length. This is not the @@ -229,7 +259,7 @@ event that the filter doesn't modify the length, this keyword should be specified.
-
ftype=filtertype
+
ftype=filtertype
This parameter specifies the numeric value for filter type that the filter should be registered as. The default value, @@ -239,36 +269,34 @@ the AP_FTYPE_foo definitions in util_filter.h for appropriate values.
-
disableenv=env
+
disableenv=env
This parameter specifies the name of an environment variable which, if set, will disable the filter.
-
enableenv=env
+
enableenv=env
This parameter specifies the name of an environment variable which must be set, or the filter will be disabled.
-
top

ExtFilterOptions Directive

Description: -
Syntax: - ExtFilterOptions - option [option] ...
Default: + Configure mod_ext_filter options
Syntax: + ExtFilterOptions option [option] ...
Default: ExtFilterOptions DebugLevel=0 NoLogStderr
Context: directory
Status: Experimental
Module: mod_ext_filter

The ExtFilterOptions directive specifies - special processing options for mod_ext_filter. - Option can be one of

+ special processing options for mod_ext_filter. + Option can be one of

-
DebugLevel=n
+
DebugLevel=n
The DebugLevel keyword allows you to specify the level of debug messages generated by - mod_ext_filter. By default, no debug messages + mod_ext_filter. By default, no debug messages are generated. This is equivalent to DebugLevel=0. With higher numbers, more debug messages are generated, and server performance will be @@ -276,12 +304,11 @@ described with the definitions of the DBGLVL_ constants near the beginning of mod_ext_filter.c. -

Note: The core directive LogLevel should be used to - cause debug messages to be stored in the Apache error - log.

+

Note: The core directive LogLevel should be used to cause debug messages to + be stored in the Apache error log.

-
LogStderr | NoLogStderr
+
LogStderr | NoLogStderr
The LogStderr keyword specifies that messages written to standard error by the external filter @@ -289,9 +316,9 @@ NoLogStderr disables this feature.
-

Example

- ExtFilterOptions LogStderr DebugLevel=0 -

+

Example

+ ExtFilterOptions LogStderr DebugLevel=0 +

Messages written to the filter's standard error will be stored in the Apache error log. No debug messages will be generated by 1.37 +2 -3 httpd-2.0/docs/manual/mod/quickreference.html.en Index: quickreference.html.en =================================================================== RCS file: /home/cvs/httpd-2.0/docs/manual/mod/quickreference.html.en,v retrieving revision 1.36 retrieving revision 1.37 diff -u -r1.36 -r1.37 --- quickreference.html.en 12 Nov 2002 21:43:45 -0000 1.36 +++ quickreference.html.en 13 Nov 2002 00:17:04 -0000 1.37 @@ -254,9 +254,8 @@ ExpiresDefault <code>secondssvdhEDefault algorithm for calculating expiration time ExtendedStatus On|Off Off sBKeep track of extended status information for each request -ExtFilterDefine filtername parameterssX- -ExtFilterOptions - option [option] ... DebugLevel=0 NoLogS +dX- +ExtFilterDefine filtername parameterssXDefine an external filter +ExtFilterOptions option [option] ... DebugLevel=0 NoLogS +dXConfigure mod_ext_filter options FileETag component ... INode MTime Size svdhCFile attributes used to create the ETag HTTP response header <Files filename> ... </Files>svdhCContains directives that apply to matched