Return-Path: Delivered-To: apmail-httpd-docs-archive@httpd.apache.org Received: (qmail 92892 invoked by uid 500); 12 Feb 2002 22:53:10 -0000 Mailing-List: contact docs-help@httpd.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: docs@httpd.apache.org Delivered-To: mailing list docs@httpd.apache.org Received: (qmail 92871 invoked from network); 12 Feb 2002 22:52:57 -0000 From: "Joshua Slive" To: Subject: xml docs: It's gonna happen (perhaps) Date: Tue, 12 Feb 2002 17:52:43 -0500 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0014_01C1B3EE.124C8E80" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Importance: Normal X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N ------=_NextPart_000_0014_01C1B3EE.124C8E80 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit I started this several months ago, and then abandoned it in a fit of frustration. I'm back. This is very similar to what I posted in December, with the exception that the transformation system is now xslt (Xerces+Xalan) rather than Velocity+Anakia. The most important attached doc is mod_setenvif.xml, which is an example of how the xml source files will look. Please review this to see if you agree with what I have done. Are there tags missing that we should be using? Are the tags named correctly? Is the nesting correct? The other attached files are the site.xsl file, which drives the transformation, and mod_setenvif.html, which is the result. These are rather arbitrary; other transformation engines could be used, and someone should surely spend some time changing them to use CSS. As far as the mechanics go, the site.xsl would be committed somewhere under httpd-2.0/docs/manual/. Transformations would happen "in place", in the sense that the target .html file would be written in the same directory as the source .xml file. To make the release manager's job easier, the .html files would be committed to cvs (even though they are generated from the xml). The actual engine to do the transform (jar files, build.xml, etc) would probably not be committed. We could either make it available on the website, or in a separate cvs repository. Some unresolved issues: - This is only for the module docs at the moment. Others will require some more work. - This will completely kill the parallel between 1.3 and 2.0. Future 1.3 changes will need to be hand-ported to the 2.0 docs (unless somebody feels very strongly that the .xml system should be used in 1.3 as well). - Translations? I'm sure they could be worked in somehow. I plan to proceed with this quite soon, before I lose my momentum. So please speak now or forever hold your peace. Joshua. ------=_NextPart_000_0014_01C1B3EE.124C8E80 Content-Type: text/xml; name="site.xsl" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="site.xsl" =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= <xsl:value-of select=3D"name"/> - Apache HTTP Server=0A= =0A= =0A=
=0A= 3D"[APACHE =0A=

Apache HTTP Server Version 2.0

=0A=
=0A=

Apache Module

=0A= =0A= =0A= =0A=

=0A= =0A= =0A= =0A=
=0A= =0A= =0A= =0A= =0A= =0A=
Status: =
Module Identifier:
=0A=
=0A= =0A= =0A=

Summary

=0A= =0A= =0A= =0A=

See also:

=0A=
    =0A= =0A= =0A= =0A= =0A=
  • =0A=
    =0A=
=0A=
=0A= =0A=

Directives

=0A= =0A=
    =0A= =0A= =0A= =0A= =0A=
  • =0A=
    =0A=
=0A= =0A= =0A= =0A=
=0A= =0A= =0A= =0A=

Apache HTTP Server Version 2.0

=0A= 3D"Index"=0A= 3D"Home"=0A= =0A= =0A= =0A=
=0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A=

=0A=
=0A= =0A=

=0A=
=0A= =0A= =0A=
=0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A=

= Directive

=0A= =0A=
=0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A=
Description:
Syntax:
Default:
Context:
Override:
Status:
Module:
Compatibility:
=0A=
=0A= =0A= =0A= =0A=

See also:

=0A=
    =0A= =0A= =0A= =0A= =0A=
  • =0A=
    =0A=
=0A=
=0A= =0A=
=0A=
=0A= =0A= =0A=
=0A=
=0A= =0A=

=0A=

=0A=
=0A= =0A=
=0A=
=0A=
=0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A=
=0A= ------=_NextPart_000_0014_01C1B3EE.124C8E80 Content-Type: text/html; name="mod_setenvif.html" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="mod_setenvif.html" mod_setenvif - Apache HTTP Server
3D"[APACHE

Apache = HTTP Server Version 2.0

Apache Module mod_setenvif

Allows the setting of environment variables based on characteristics of the request

Status:Base
Module = Identifier:setenvif_module

Summary

=20

The mod_setenvif module allows you to set environment variables according to whether different aspects of the request match regular expressions you specify. These environment variables can be used by other parts of the server to make decisions about actions to be taken.

=20

The directives are considered in the order they appear in the configuration files. So more complex sequences can be used, such as this example, which sets netscape if the browser is mozilla but not MSIE.

BrowserMatch ^Mozilla netscape
BrowserMatch MSIE !netscape

See also:

Directives


BrowserMatch Directive

Description:Sets environment variables = conditional on HTTP User-Agent
Syntax: BrowserMatch regex env-variable[=3Dvalue] [env-variable[=3Dvalue]] ...
Default:none
Context:server config, virtual host, = directory, .htaccess
Override:FileInfo
Status:
Module:mod_setenvif
Compatibility:Apache 1.2 and above (in Apache 1.2 this directive was found in the now-obsolete mod_browser module)
=20

The BrowserMatch directive defines environment variables based on the User-Agent HTTP request header field. The first argument should be a POSIX.2 extended regular expression (similar to an egrep-style regex). The rest of the arguments give the names of variables to set, and optionally values to which they should be set. These take the form of

=20
    =20
  1. varname, or
  2. =20
  3. !varname, or
  4. =20
  5. varname=3Dvalue
  6. =20
=20

In the first form, the value will be set to "1". The second will remove the given variable if already defined, and the third will set the variable to the value given by value. If a User-Agent string matches more than one entry, they will be merged. Entries are processed in the order in which they appear, and later entries can override earlier ones.

=20

For example:

BrowserMatch ^Mozilla forms jpeg=3Dyes browser=3Dnetscape
BrowserMatch "^Mozilla/[2-3]" tables agif frames javascript
BrowserMatch MSIE !javascript
=20 =20

Note that the regular expression string is case-sensitive. For case-INsensitive matching, see the BrowserMatchNoCase directive.

=20

The BrowserMatch and BrowserMatchNoCase directives are special cases of the SetEnvIf and SetEnvIfNoCase directives. The following two lines have the same effect:

BrowserMatchNoCase Robot is_a_robot
SetEnvIfNoCase User-Agent Robot is_a_robot

BrowserMatchNoCase Directive

Description:Sets environment variables = conditional on User-Agent without respect to case
Syntax: BrowserMatchNoCase regex = env-variable[=3Dvalue] [env-variable[=3Dvalue]] ...
Default:none
Context:server config, virtual host, = directory, .htaccess
Override:FileInfo
Status:
Module:mod_setenvif
Compatibility:Apache 1.2 and above (in Apache 1.2 this directive was found in the now-obsolete mod_browser module)
=20

The BrowserMatchNoCase directive is semantically identical to the BrowserMatch directive. However, it provides for case-insensitive matching. For example:

BrowserMatchNoCase mac platform=3Dmacintosh
BrowserMatchNoCase win platform=3Dwindows
=20

The BrowserMatch and BrowserMatchNoCase directives are special cases of the SetEnvIf and SetEnvIfNoCase directives. The following two lines have the same effect:

BrowserMatchNoCase Robot is_a_robot
SetEnvIfNoCase User-Agent Robot is_a_robot

SetEnvIf Directive

Description:Sets environment variables = based on attributes of the request
Syntax: SetEnvIf attribute regex env-variable[=3Dvalue] [env-variable[=3Dvalue]] ...
Default:none
Context: server config, virtual host, = directory, .htaccess
Override:FileInfo
Status:
Module:mod_setenvif
Compatibility:Apache 1.3 and above; the Request_Protocol keyword and environment-variable matching are only available with 1.3.7 and later
=20

The SetEnvIf directive defines environment variables based on attributes of the request. These attributes can be the values of various HTTP request header fields (see RFC2616 for more information about these), or of other aspects of the request, including the following:

=20
    =20
  • Remote_Host - the hostname (if available) of the client making the request
  • =20
  • Remote_Addr - the IP address of the client making the request
  • =20
  • Remote_User - the authenticated username (if available)
  • =20
  • Request_Method - the name of the method being used (GET, POST, et cetera)
  • =20
  • Request_Protocol - the name and version of the protocol with which the request was made (e.g., "HTTP/0.9", "HTTP/1.1", etc.)
  • =20
  • Request_URI - the portion of the URL following the scheme and host portion
  • =20
=20

Some of the more commonly used request header field names include Host, User-Agent, and Referer.

=20

If the attribute name doesn't match any of the special keywords, nor any of the request's header field names, it is tested as the name of an environment variable in the list of those associated with the request. This allows SetEnvIf directives to test against the result of prior matches.

=20 Only those environment variables defined by earlier SetEnvIf[NoCase] directives are available for testing in this manner. 'Earlier' means that they were defined at a broader scope (such as server-wide) or previously in the current directive's scope. =20

attribute may be a regular expression when used to match a request header. If attribute is a regular expression and it doesn't match any of the request's header names, then attribute is not tested against the request's environment variable list.

Example:

Example: SetEnvIf Request_URI "\.gif$" object_is_image=3Dgif
SetEnvIf Request_URI "\.jpg$" object_is_image=3Djpg
SetEnvIf Request_URI "\.xbm$" object_is_image=3Dxbm
:
SetEnvIf Referer www\.mydomain\.com intra_site_referral
:
SetEnvIf object_is_image xbm XBIT_PROCESSING=3D1
:
SetEnvIf ^TS* ^[a-z].* HAVE_TS
=20

The first three will set the environment variable object_is_image if the request was for an image file, and the fourth sets intra_site_referral if the referring page was somewhere on the www.mydomain.com Web site.

=20

The last example will set environment variable HAVE_TS if the request contains any headers that begin with "TS" whose values begins with any character in the set [a-z].


SetEnvIfNoCase Directive

Description:Sets environment variables = based on attributes of the request without respect to case
Syntax: SetEnvIfNoCase attribute regex = env-variable[=3Dvalue] [env-variable[=3Dvalue]] ...
Default:none
Context:server config, virtual host, = directory, .htaccess
Override:FileInfo
Status:
Module:mod_setenvif
Compatibility:Apache 1.3 and above
=20

The SetEnvIfNoCase is semantically identical to the SetEnvIf directive, and differs only in that the regular expression matching is performed in a case-insensitive manner. For example:

SetEnvIfNoCase Host Apache\.Org site=3Dapache
=20

This will cause the site environment variable to be set to "apache" if the HTTP request header field Host: was included and contained Apache.Org, apache.org, or any other combination.


Apache HTTP Server Version 2.0

3D"Index"3D"Home" ------=_NextPart_000_0014_01C1B3EE.124C8E80 Content-Type: text/xml; name="mod_setenvif.xml" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="mod_setenvif.xml" mod_setenvif Base setenvif_module mod_setenvif.c Available in Apache 1.3 and later Allows the setting of environment variables based on characteristics of the request

The mod_setenvif module allows you to set environment variables according to whether different aspects of the request match regular expressions you specify. These environment variables can be used by other parts of the server to make decisions about actions to be taken.

The directives are considered in the order they appear in the configuration files. So more complex sequences can be used, such as this example, which sets netscape if the browser is mozilla but not MSIE.

BrowserMatch ^Mozilla netscape
BrowserMatch MSIE !netscape
Environment Variables in Apache BrowserMatch Sets environment variables conditional on HTTP User-Agent BrowserMatch regex env-variable[=3Dvalue] [env-variable[=3Dvalue]] ... none server config, virtual host, directory, .htaccess FileInfo Apache 1.2 and above (in Apache 1.2 this directive was found in the now-obsolete mod_browser module)

The BrowserMatch directive defines environment variables based on the User-Agent HTTP request header field. The first argument should be a POSIX.2 extended regular expression (similar to an egrep-style regex). The rest of the arguments give the names of variables to set, and optionally values to which they should be set. These take the form of

  1. varname, or
  2. !varname, or
  3. varname=3Dvalue

In the first form, the value will be set to "1". The second will remove the given variable if already defined, and the third will set the variable to the value given by value. If a User-Agent string matches more than one entry, they will be merged. Entries are processed in the order in which they appear, and later entries can override earlier ones.

For example:

BrowserMatch ^Mozilla forms jpeg=3Dyes browser=3Dnetscape
BrowserMatch "^Mozilla/[2-3]" tables agif frames javascript
BrowserMatch MSIE !javascript
=20

Note that the regular expression string is case-sensitive. For case-INsensitive matching, see the BrowserMatchNoCase directive.

The BrowserMatch and BrowserMatchNoCase directives are special = cases of the SetEnvIf and = SetEnvIfNoCase directives. The following two lines have the same effect:

BrowserMatchNoCase Robot is_a_robot
SetEnvIfNoCase User-Agent Robot is_a_robot
BrowserMatchNoCase Sets environment variables conditional on User-Agent = without respect to case BrowserMatchNoCase regex = env-variable[=3Dvalue] [env-variable[=3Dvalue]] ... none server config, virtual host, directory, .htaccess FileInfo Apache 1.2 and above (in Apache 1.2 this directive was found in the now-obsolete mod_browser module)

The BrowserMatchNoCase directive is semantically identical to the BrowserMatch directive. However, it provides for case-insensitive matching. For example:

BrowserMatchNoCase mac platform=3Dmacintosh
BrowserMatchNoCase win platform=3Dwindows

The BrowserMatch and BrowserMatchNoCase directives are special = cases of the SetEnvIf and = SetEnvIfNoCase directives. The following two lines have the same effect:

BrowserMatchNoCase Robot is_a_robot
SetEnvIfNoCase User-Agent Robot is_a_robot
SetEnvIf Sets environment variables based on attributes of the = request SetEnvIf attribute regex env-variable[=3Dvalue] [env-variable[=3Dvalue]] ... none server config, virtual host, directory, .htaccess FileInfo Apache 1.3 and above; the Request_Protocol keyword and environment-variable matching are only available with 1.3.7 and later

The SetEnvIf directive defines environment variables based on attributes of the request. These attributes can be the values of various HTTP request header fields (see RFC2616 for more information about these), or of other aspects of the request, including the following:

  • Remote_Host - the hostname (if available) of the client making the request
  • Remote_Addr - the IP address of the client making the request
  • Remote_User - the authenticated username (if available)
  • Request_Method - the name of the method being used (GET, POST, et cetera)
  • Request_Protocol - the name and version of the protocol with which the request was made (e.g., "HTTP/0.9", "HTTP/1.1", etc.)
  • Request_URI - the portion of the URL following the scheme and host portion

Some of the more commonly used request header field names include Host, User-Agent, and Referer.

If the attribute name doesn't match any of the special keywords, nor any of the request's header field names, it is tested as the name of an environment variable in the list of those associated with the request. This allows SetEnvIf directives to test against the = result of prior matches.

Only those environment variables defined by earlier SetEnvIf[NoCase] directives are available for testing in this manner. 'Earlier' means that they were defined at a broader scope (such as server-wide) or previously in the current directive's scope.

attribute may be a regular expression when used to match a request header. If attribute is a regular expression and it doesn't match any of the request's header names, then attribute is not tested against the request's environment variable list.

Example: SetEnvIf Request_URI "\.gif$" object_is_image=3Dgif
SetEnvIf Request_URI "\.jpg$" object_is_image=3Djpg
SetEnvIf Request_URI "\.xbm$" object_is_image=3Dxbm
:
SetEnvIf Referer www\.mydomain\.com intra_site_referral
:
SetEnvIf object_is_image xbm XBIT_PROCESSING=3D1
:
SetEnvIf ^TS* ^[a-z].* HAVE_TS

The first three will set the environment variable object_is_image if the request was for an image file, and the fourth sets intra_site_referral if the referring page was somewhere on the www.mydomain.com Web site.

The last example will set environment variable HAVE_TS if the request contains any headers that begin with "TS" whose values begins with any character in the set [a-z].

SetEnvIfNoCase Sets environment variables based on attributes of the = request without respect to case SetEnvIfNoCase attribute regex = env-variable[=3Dvalue] [env-variable[=3Dvalue]] ... none server config, virtual host, directory, .htaccess FileInfo Apache 1.3 and above

The SetEnvIfNoCase is semantically = identical to the SetEnvIf directive, and differs only in that the regular expression matching is performed in a case-insensitive manner. For example:

SetEnvIfNoCase Host Apache\.Org site=3Dapache

This will cause the site environment variable to be set to "apache" if the HTTP request header field Host: was included and contained Apache.Org, apache.org, or any other combination.

------=_NextPart_000_0014_01C1B3EE.124C8E80 Content-Type: text/plain; charset=us-ascii --------------------------------------------------------------------- To unsubscribe, e-mail: docs-unsubscribe@httpd.apache.org For additional commands, e-mail: docs-help@httpd.apache.org ------=_NextPart_000_0014_01C1B3EE.124C8E80--