Return-Path: Delivered-To: apmail-httpd-docs-archive@httpd.apache.org Received: (qmail 84049 invoked by uid 500); 10 Nov 2001 01:55:12 -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 83860 invoked from network); 10 Nov 2001 01:55:10 -0000 From: "Joshua Slive" To: , Subject: module docs in xml Date: Fri, 9 Nov 2001 20:56:38 -0500 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0017_01C16961.06C1E880" 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_0017_01C16961.06C1E880 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Here goes nothing... Attached are some examples for a proposed format for an xml version of the module docs along with an Anakia vsl file to transform it to html and an example of the resulting html. I am mostly interested in feedback on the xml format. Some things I don't care about right now: 1. Critiques of the resulting html. The html can obviously be beautified considerably, and we will hash that out later. 2. Arguing with anyone about the best xml->html transformation tool. At the moment I'm most familiar with Anakia, so that's what I'm using. If other people have other preferences, feel free to supply the transformation tools. 3. A DTD. Actually, I'd love to have one, but I'm not going to spend the time to figure it out right now, since the tools to actually use them are so lame. 4. The non-module docs. We can work that out later. To integrate this with the existing docs with the least amount of hassle, I suggest transforming "in place". That is, the xml files would live in the same directory as the html files. I would need to commit the .vsl file and some build scripts to httpd-2.0/docs/manual/. We probably wouldn't want to commit the .jar files, but we could keep them in an easily accessible place. So what I want to know is: 1. Is there a basic buy-in that this is the correct direction to go? 2. Does anyone have major concerns or suggestions about the xml format? The only things that I can think of adding right now are some inline elements like and . Conditional on the answers to those two, we can take this discussion over to docs@httpd to hash out the details. Joshua. ------=_NextPart_000_0017_01C16961.06C1E880 Content-Type: text/plain; name="site.vsl.txt" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="site.vsl.txt" ## ## Content Stylesheet for httpd-docs ## ## Defined variables ## ## =20 ## Start and end the processing ## #module() ## ## This is where the macros live ## ## #macro ( make_note $note)
#processtext($note)
#end #macro (block_example $example) #if ($example.getChild("title")) #set ($heading =3D $example.getChildText("title")) #else #set ($heading =3D "") #end

$heading

$example
#end #macro ( section $section $level ) #if ($section.getChild("title")) #set ($heading =3D $section.getChildText("title")) #elseif ($section.getAttributeValue("id")) #set ($heading =3D $section.getAttributeValue("id")) #else #set ($heading =3D "") #end

#if ($section.getAttributeValue("id")) $heading #else $heading #end

## Output the section-level children with transformers #foreach ( $items in $section.getChildren() ) #if ($items.getName().equals("note")) #make_note ($items) #elseif ($items.getName().equals("section")) #set ($sublevel =3D $level + 1) #section ($items $sublevel) #elseif ($items.getName().equals("title")) ## we already handled this one #else $items #end #end #end #macro (processtext $text) #foreach ( $items in $text.getChildren() ) #if ($items.getName().equals("note")) #make_note($items) #elseif ($items.getName().equals("blockexample")) #block_example($items) #else $items #end #end #end #macro (directive $thedirective $modulename $status)

$thedirective.getChild("name").getText() directive

Description: = $thedirective.getChild("description")
Syntax: = $thedirective.getChild("syntax")
Default: = $thedirective.getChild("default")
Context: = $thedirective.getChild("context")
Override: = $thedirective.getChild("override")
Status: = $status
Module: = $modulename
Compatibility: = $thedirective.getChild("compatibility")
#processtext($thedirective.getChild("usage")) #end #macro ( module ) $root.getChild("name").getText() - Apache HTTP Server =20
3D"[APACHE=20

Apache HTTP Server Version 2.0

Apache Module $root.getChild("name").getText()

$root.getChild("description").getText()

Status: = $root.getChild("status").getText()
Module = Identifier: = $root.getChild("identifier").getText()

Summary

#processtext($root.getChild("summary"))

Directives

#set ($allSections =3D $root.getChild("module").getChildren("section")) #foreach ( $section in $allSections ) #section ($section 1) #end
#foreach ($directive in $alldirectives) #directive ($directive $root.getChild("name").getText() = $root.getChild("status").getText())



#end

Apache HTTP Server Version 2.0

3D"Index" 3D"Home"
#end ------=_NextPart_000_0017_01C16961.06C1E880 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 =20
3D"[APACHE=20

Apache HTTP Server Version 2.0

Apache Module mod_setenvif

Allows the setting of environment variables based=0A= on characteristics of the request

Status: = Base
Module = Identifier: setenvif_module

Summary

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

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

=0A= BrowserMatch ^Mozilla netscape
=0A= BrowserMatch MSIE !netscape
=0A=

For additional information, we provide a document on Environment Variables in Apache.

Directives


BrowserMatch directive

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

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

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

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

For example:

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

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

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

=0A= BrowserMatchNoCase Robot is_a_robot
=0A= SetEnvIfNoCase User-Agent Robot is_a_robot
=0A=



BrowserMatchNoCase directive

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

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

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

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

=0A= BrowserMatchNoCase Robot is_a_robot
=0A= SetEnvIfNoCase User-Agent Robot is_a_robot
=0A=



SetEnvIf directive

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

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

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

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

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

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

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

Example:

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

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

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




SetEnvIfNoCase directive

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

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

=0A= SetEnvIfNoCase Host Apache\.Org site=3Dapache=0A=

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




Apache HTTP Server Version 2.0

3D"Index" 3D"Home"
------=_NextPart_000_0017_01C16961.06C1E880 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 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

For additional information, we provide a document on 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_0017_01C16961.06C1E880 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_0017_01C16961.06C1E880--