]> granicus.if.org Git - apache/commitdiff
This is the second in a series of clean-ups of the
authorJoshua Slive <slive@apache.org>
Tue, 9 Jan 2001 03:24:50 +0000 (03:24 +0000)
committerJoshua Slive <slive@apache.org>
Tue, 9 Jan 2001 03:24:50 +0000 (03:24 +0000)
environment variable docs.  Here is what I have done:

1. Removed some obsolete CERN references and done a tiny
bit of cleanup of mod_env.html.

2. Included references from mod_env.html and mod_setenvif.html
to env.html.

3. Prettied-up env.html a little bit by including sub-headings.

4. Added some "caveats" to env.html:
- No overriding basic CGI variables
- suexec restrictions
- no non-alphanumeric characters in env variable names

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@87621 13f79535-47bb-0310-9956-ffa450edef68

docs/manual/env.html
docs/manual/env.html.en
docs/manual/mod/mod_env.html
docs/manual/mod/mod_setenvif.html

index b32847fbbff45ef1171fce7c7bf5c9342bc072d6..f436e32819a6f2a2919ee77226dc7527b4559266 100644 (file)
@@ -54,23 +54,60 @@ explains some of the ways to use environment variables in Apache.</p>
 <A HREF="mod/mod_env.html#unsetenv">UnsetEnv</A><br>
 </td></tr></table>
 
+<h3>Basic Environment Manipulation</h3>
+
 <p>The most basic way to set an environment variable in Apache is
 using the unconditional <code>SetEnv</code> directive.  Variables
-may also be passed from the environment when Apache is started
-using the <code>PassEnv</code> directive.</p>
+may also be passed from the environment of the shell which started
+the server using the <code>PassEnv</code> directive.</p>
+
+<h3>Conditional Per-Request Settings</h3>
+
+<p>For additional flexibility, the directives provided by mod_setenvif
+allow environment variables to be set on a per-request basis,
+conditional on characteristics of particular requests.  For example, a
+variable could be set only when a specific browser (User-Agent) is
+making a request, or only when a specific Referer [sic] header is
+found.  Even more flexibility is available through the mod_rewrite's
+<code>RewriteRule</code> which uses the <code>[E=...]</code> option to
+set environment variables.</p>
 
-<p>The directives provided by mod_setenvif allow environment variables
-to be set on a per-request basis based on characteristics of particular
-requests.  For example, a variable could be set only when a specific
-browser (User-Agent) is making a request, or only when a specific
-Referer header is found.  Even more flexibility is available through the
-mod_rewrite's <code>RewriteRule</code> which uses the
-<code>[E=...]</code> option to set environment variables.</p>
+<h3>Unique Identifiers</h3>
 
 <p>Finally, mod_unique_id sets the environment variable
 <code>UNIQUE_ID</code> for each request to a value which is guaranteed
 to be unique across "all" requests under very specific conditions.</p>
 
+<h3>Standard CGI Variables</h3>
+
+<p>In addition to all environment variables set within the Apache
+configuration and passed from the shell, CGI scripts and SSI pages are
+provided with a set of environment variables containing
+meta-information about the request as required by the <a
+href="misc/FAQ.html#cgi-spec">CGI specification</a>.</p>
+
+<h3>Some Caveats</h3>
+
+<ul>
+
+<li>It is not possible to override or change the standard CGI
+variables using the environment manipulation directives.</li> 
+
+<li>When <a href="suexec.html">suexec</a> is used to launch CGI
+scripts, the environment will be cleaned down to a set of
+<em>safe</em> variables before CGI scripts are launched.  The list of
+<em>safe</em> variables is defined at compile-time in
+<code>suexec.c</code>.</li>
+
+<li>For portability reasons, the names of environment variables
+may contain only letters, numbers, and the underscore character.
+In addition, the first character may not be a number.  Characters
+which do not match this restriction will be replaced by an
+underscore when passed to CGI scripts and SSI pages.</li>
+
+</ul>
+
+
 <hr>
 
 <h2><a name="using">Using Environment Variables</a></h2>
@@ -87,34 +124,37 @@ to be unique across "all" requests under very specific conditions.</p>
 </td><td valign="top">
 <strong>Related Directives</strong><br><br>
 
-<A HREF="mod/mod_access.html#allowfromenv">Allow from env=</A><br>
-<a href="mod/mod_log_config.html#customlog-conditional">CustomLog
-(conditional)</a><br>
-<A HREF="mod/mod_access.html#denyfromenv">Deny from env=</A><br>
+<A HREF="mod/mod_access.html#allow">Allow</A><br>
+<a href="mod/mod_log_config.html#customlog">CustomLog</a><br>
+<A HREF="mod/mod_access.html#deny">Deny</A><br>
 <a href="mod/mod_log_config.html#logformat">LogFormat</a><br>
 <A HREF="mod/mod_rewrite.html#RewriteCond">RewriteCond</A><br>
 <A HREF="mod/mod_rewrite.html#RewriteRule">RewriteRule</A><br>
 
 </td></tr></table>
 
+<h3>CGI Scripts</h3>
+
 <p>One of the primary uses of environment variables is to communicate
-information to CGI scripts.  In addition to all environment variables
-set within Apache, CGI scripts are provided with a set of
-meta-information about the request as provided for in the <a
-href="misc/FAQ.html#cgi-spec">CGI specification</a>.  If you are using
-<a href="suexec.html">Suexec</a> to execute CGI scripts under
-different userids, note that the environment will be cleaned down to a
-set of <em>safe</em> environment variables before the CGI script is
-executed.  The set of safe environment variables is defined at
-compile time in <code>suexec.c</code>.
+information to CGI scripts.  As discussed above, the environment
+passed to CGI scripts includes standard meta-information about the request
+in addition to any variables set within the Apache configuration.
+For more details, see the <a href="howto/cgi.html">CGI tutorial</a>.
 </p>
 
+<h3>SSI Pages</h3>
+
 <p>Server-parsed (SSI) documents processed by mod_include's
 <code>server-parsed</code> handler can print environment variables
 using the <code>echo</code> element, and can use environment variables
-in flow control elements.
+in flow control elements to makes parts of a page conditional on
+characteristics of a request.  Apache also provides SSI pages with the
+standard CGI environment variables as discussed above.  For more
+details, see the <a href="howto/ssi.html">SSI tutorial</a>.
 </p>
 
+<h3>Access Control</h3>
+
 <p>Access to the server can be controlled based on the value of
 environment variables using the <code>allow from env=</code> and
 <code>deny from env=</code></a> directives.  In combination with
@@ -124,6 +164,8 @@ can use these directives to deny access to a particular browser
 (User-Agent).
 </p>
 
+<h3>Conditional Logging</h3>
+
 <p>Environment variables can be logged in the access log using the
 <code>LogFormat</code> option <code>%e</code>.  In addition, the
 decision on whether or not to log requests can be made based on the
@@ -135,6 +177,8 @@ for filenames ending in <code>gif</code>, or you can choose to only
 log requests from clients which are outside your subnet.
 </p>
 
+<h3>URL Rewriting</h3>
+
 <p>The <code>%{ENV:...}</code> form of <em>TestString</em> in the
 <code>RewriteCond</code> allows mod_rewrite's rewrite engine to make
 decisions conditional on environment variables.  Note that the
index b32847fbbff45ef1171fce7c7bf5c9342bc072d6..f436e32819a6f2a2919ee77226dc7527b4559266 100644 (file)
@@ -54,23 +54,60 @@ explains some of the ways to use environment variables in Apache.</p>
 <A HREF="mod/mod_env.html#unsetenv">UnsetEnv</A><br>
 </td></tr></table>
 
+<h3>Basic Environment Manipulation</h3>
+
 <p>The most basic way to set an environment variable in Apache is
 using the unconditional <code>SetEnv</code> directive.  Variables
-may also be passed from the environment when Apache is started
-using the <code>PassEnv</code> directive.</p>
+may also be passed from the environment of the shell which started
+the server using the <code>PassEnv</code> directive.</p>
+
+<h3>Conditional Per-Request Settings</h3>
+
+<p>For additional flexibility, the directives provided by mod_setenvif
+allow environment variables to be set on a per-request basis,
+conditional on characteristics of particular requests.  For example, a
+variable could be set only when a specific browser (User-Agent) is
+making a request, or only when a specific Referer [sic] header is
+found.  Even more flexibility is available through the mod_rewrite's
+<code>RewriteRule</code> which uses the <code>[E=...]</code> option to
+set environment variables.</p>
 
-<p>The directives provided by mod_setenvif allow environment variables
-to be set on a per-request basis based on characteristics of particular
-requests.  For example, a variable could be set only when a specific
-browser (User-Agent) is making a request, or only when a specific
-Referer header is found.  Even more flexibility is available through the
-mod_rewrite's <code>RewriteRule</code> which uses the
-<code>[E=...]</code> option to set environment variables.</p>
+<h3>Unique Identifiers</h3>
 
 <p>Finally, mod_unique_id sets the environment variable
 <code>UNIQUE_ID</code> for each request to a value which is guaranteed
 to be unique across "all" requests under very specific conditions.</p>
 
+<h3>Standard CGI Variables</h3>
+
+<p>In addition to all environment variables set within the Apache
+configuration and passed from the shell, CGI scripts and SSI pages are
+provided with a set of environment variables containing
+meta-information about the request as required by the <a
+href="misc/FAQ.html#cgi-spec">CGI specification</a>.</p>
+
+<h3>Some Caveats</h3>
+
+<ul>
+
+<li>It is not possible to override or change the standard CGI
+variables using the environment manipulation directives.</li> 
+
+<li>When <a href="suexec.html">suexec</a> is used to launch CGI
+scripts, the environment will be cleaned down to a set of
+<em>safe</em> variables before CGI scripts are launched.  The list of
+<em>safe</em> variables is defined at compile-time in
+<code>suexec.c</code>.</li>
+
+<li>For portability reasons, the names of environment variables
+may contain only letters, numbers, and the underscore character.
+In addition, the first character may not be a number.  Characters
+which do not match this restriction will be replaced by an
+underscore when passed to CGI scripts and SSI pages.</li>
+
+</ul>
+
+
 <hr>
 
 <h2><a name="using">Using Environment Variables</a></h2>
@@ -87,34 +124,37 @@ to be unique across "all" requests under very specific conditions.</p>
 </td><td valign="top">
 <strong>Related Directives</strong><br><br>
 
-<A HREF="mod/mod_access.html#allowfromenv">Allow from env=</A><br>
-<a href="mod/mod_log_config.html#customlog-conditional">CustomLog
-(conditional)</a><br>
-<A HREF="mod/mod_access.html#denyfromenv">Deny from env=</A><br>
+<A HREF="mod/mod_access.html#allow">Allow</A><br>
+<a href="mod/mod_log_config.html#customlog">CustomLog</a><br>
+<A HREF="mod/mod_access.html#deny">Deny</A><br>
 <a href="mod/mod_log_config.html#logformat">LogFormat</a><br>
 <A HREF="mod/mod_rewrite.html#RewriteCond">RewriteCond</A><br>
 <A HREF="mod/mod_rewrite.html#RewriteRule">RewriteRule</A><br>
 
 </td></tr></table>
 
+<h3>CGI Scripts</h3>
+
 <p>One of the primary uses of environment variables is to communicate
-information to CGI scripts.  In addition to all environment variables
-set within Apache, CGI scripts are provided with a set of
-meta-information about the request as provided for in the <a
-href="misc/FAQ.html#cgi-spec">CGI specification</a>.  If you are using
-<a href="suexec.html">Suexec</a> to execute CGI scripts under
-different userids, note that the environment will be cleaned down to a
-set of <em>safe</em> environment variables before the CGI script is
-executed.  The set of safe environment variables is defined at
-compile time in <code>suexec.c</code>.
+information to CGI scripts.  As discussed above, the environment
+passed to CGI scripts includes standard meta-information about the request
+in addition to any variables set within the Apache configuration.
+For more details, see the <a href="howto/cgi.html">CGI tutorial</a>.
 </p>
 
+<h3>SSI Pages</h3>
+
 <p>Server-parsed (SSI) documents processed by mod_include's
 <code>server-parsed</code> handler can print environment variables
 using the <code>echo</code> element, and can use environment variables
-in flow control elements.
+in flow control elements to makes parts of a page conditional on
+characteristics of a request.  Apache also provides SSI pages with the
+standard CGI environment variables as discussed above.  For more
+details, see the <a href="howto/ssi.html">SSI tutorial</a>.
 </p>
 
+<h3>Access Control</h3>
+
 <p>Access to the server can be controlled based on the value of
 environment variables using the <code>allow from env=</code> and
 <code>deny from env=</code></a> directives.  In combination with
@@ -124,6 +164,8 @@ can use these directives to deny access to a particular browser
 (User-Agent).
 </p>
 
+<h3>Conditional Logging</h3>
+
 <p>Environment variables can be logged in the access log using the
 <code>LogFormat</code> option <code>%e</code>.  In addition, the
 decision on whether or not to log requests can be made based on the
@@ -135,6 +177,8 @@ for filenames ending in <code>gif</code>, or you can choose to only
 log requests from clients which are outside your subnet.
 </p>
 
+<h3>URL Rewriting</h3>
+
 <p>The <code>%{ENV:...}</code> form of <em>TestString</em> in the
 <code>RewriteCond</code> allows mod_rewrite's rewrite engine to make
 decisions conditional on environment variables.  Note that the
index bda93ec2db0daa83b93de34dda9f8f64c06b091c..3d6d610fe93fc1c7b26220af073636f55bf46cf1 100644 (file)
@@ -15,8 +15,8 @@
 <!--#include virtual="header.html" -->
 <H1 ALIGN="CENTER">Apache module mod_env</H1>
 
-<p>This module provides for
-passing environment variables to CGI/SSI scripts.</p>
+<p>This module provides for modifying the environment which
+is passed to CGI scripts and SSI pages.</p>
 
 <P><A
 HREF="module-dict.html#Status"
@@ -40,12 +40,15 @@ REL="Help"
 </P>
 
 <H2>Summary</H2>
-<!-- XXX: Should mention mod_setenvif and the effect of suexec -->
-<p>This module allows Apache's CGI and SSI environment to inherit
-environment variables from the shell which invoked the httpd process.
-CERN web-servers are able to do this, so this module is especially
-useful to web-admins who wish to migrate from CERN to Apache without
-rewriting all their scripts</p>
+
+<p>This module allows for control of the environment that will be
+provided to CGI scripts and SSI pages.  Environment variables may be
+passed from the shell which invoked the httpd process.  Alternatively,
+environment variables may be set or unset within the configuration
+process.</p>
+
+<p>For additional information, we provide a document on
+<a href="../env.html">Environment Variables in Apache</a>.</p>
 
 <H2>Directives</H2>
 <UL>
@@ -81,7 +84,8 @@ rewriting all their scripts</p>
 Apache 1.1 and later.<P>
 
 Specifies one or more environment variables to pass to CGI scripts
-from the server's own environment. Example:
+and SSI pages from the environment of the shell which invoked
+the httpd process. Example:
 <PRE>
     PassEnv LD_LIBRARY_PATH
 </PRE>
@@ -112,7 +116,7 @@ from the server's own environment. Example:
 Apache 1.1 and later.<P>
 
 Sets an environment variable, which is then passed on to CGI
-scripts. Example:
+scripts and SSI pages. Example:
 <PRE>
     SetEnv SPECIAL_PATH /foo/bin
 </PRE>
@@ -144,14 +148,11 @@ scripts. Example:
 Apache 1.1 and later.<P>
 
 Removes one or more environment variables from those passed on to
-CGI scripts. Example:
+CGI scripts and SSI pages. Example:
 <PRE>
     UnsetEnv LD_LIBRARY_PATH
 </PRE>
 
-
-
-<P>
 <!--#include virtual="footer.html" -->
 </BODY>
 </HTML>
index 0ae7bd135d37b158d706ff11ae13b3af64017fe0..12e816333d6cc50b7656d697aa1174f399621aa7 100644 (file)
@@ -43,7 +43,8 @@ REL="Help"
   <P>
   The <SAMP>mod_setenvif</SAMP> module allows you to set environment
   variables according to whether different aspects of the request match
-  regular expressions you specify.  These envariables can be used by
+  <a href="../misc/FAQ.html#regex">regular expressions</a>
+  you specify.  These environment variables can be used by
   other parts of the server to make decisions about actions to be taken.
   </P>
   <P>The directives are considered in the order they appear in the
@@ -56,6 +57,9 @@ REL="Help"
   </PRE></BLOCKQUOTE>
   </P>
 
+  <p>For additional information, we proved a document on
+  <a href="../env.html">Environment Variables in Apache</a>.</p>
+
   <H2>Directives</H2>
   <UL>
    <LI><A HREF="#BrowserMatch">BrowserMatch</A>
@@ -346,7 +350,7 @@ REL="Help"
    SetEnvIf object_is_image xbm XBIT_PROCESSING=1
   </PRE>
   <P>
-  The first three will set the envariable <SAMP>object_is_image</SAMP> if the
+  The first three will set the environment variable <SAMP>object_is_image</SAMP> if the
   request was for an image file, and the fourth sets
   <SAMP>intra_site_referral</SAMP> if the referring page was somewhere
   on the <SAMP>www.mydomain.com</SAMP> Web site.
@@ -407,7 +411,7 @@ REL="Help"
    SetEnvIfNoCase Host Apache\.Org site=apache
   </PRE>
   <P>
-  This will cause the <SAMP>site</SAMP> envariable to be set to
+  This will cause the <SAMP>site</SAMP> environment variable to be set to
   &quot;<SAMP>apache</SAMP>&quot; if the HTTP request header field
   <SAMP>Host:</SAMP> was included and contained <SAMP>Apache.Org</SAMP>,
   <SAMP>apache.org</SAMP>, or any other combination.