]> granicus.if.org Git - apache/commitdiff
New XML plus transformation.
authorErik Abele <erikabele@apache.org>
Sat, 5 Oct 2002 22:57:34 +0000 (22:57 +0000)
committerErik Abele <erikabele@apache.org>
Sat, 5 Oct 2002 22:57:34 +0000 (22:57 +0000)
Submitted by: Luiz Rocha <luiz@lsdr.net>

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

docs/manual/cgi_path.html.en
docs/manual/cgi_path.xml [new file with mode: 0644]

index b019173b90dd6fd7de8b7311f8cbb6f5220ad2f9..2d4bd19036b9a9ac4d5f42fdf4ad83efdc74d84a 100644 (file)
@@ -1,24 +1,10 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
-<html xmlns="http://www.w3.org/1999/xhtml">
-  <head>
-    <meta name="generator" content="HTML Tidy, see www.w3.org" />
-
-    <title>PATH_INFO Changes in the CGI Environment</title>
-  </head>
-  <!-- Background white, links blue (unvisited), navy (visited), red (active) -->
-
-  <body bgcolor="#FFFFFF" text="#000000" link="#0000FF"
-  vlink="#000080" alink="#FF0000">
-    <!--#include virtual="header.html" -->
-
-    <h1 align="center">PATH_INFO Changes in the CGI
-    Environment</h1>
-    <hr />
-
-    <h2><a id="over" name="over">Overview</a></h2>
-
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
+        XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+              This file is generated from xml source: DO NOT EDIT
+        XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+      --><title>PATH_INFO Changes in the CGI Environment - Apache HTTP Server</title><link href="./style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" /><link href="./style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" /><link href="./style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" /><link href="./images/favicon.ico" rel="shortcut icon" /></head><body id="manual-page"><div id="page-header"><p class="menu"><a href="./mod/">Modules</a> | <a href="./mod/directives.html">Directives</a> | <a href="./faq/">FAQ</a> | <a href="./glossary.html">Glossary</a> | <a href="./sitemap.html">Sitemap</a></p><p class="apache">Apache HTTP Server Version 2.0</p><img alt="" src="./images/feather.gif" /></div><div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="./images/left.gif" /></a></div><div id="path"><a href="http://www.apache.org/">Apache</a> &gt; <a href="http://httpd.apache.org/">HTTP Server</a> &gt; <a href="http://httpd.apache.org/docs-project/">Documentation</a> &gt; <a href="./">Version 2.0</a></div><div id="page-content"><div id="preamble"><h1>PATH_INFO Changes in the CGI Environment</h1>
     <p>As implemented in Apache 1.1.1 and earlier versions, the
     method Apache used to create PATH_INFO in the CGI environment
     was counterintuitive, and could result in crashes in certain
     still compatible with the CGI/1.1 specification, and CGI
     scripts can be easily modified (<a href="#compat">see
     below</a>).</p>
-
-    <h2><a id="prob" name="prob">The Problem</a></h2>
-
+  </div><div id="quickview"><ul id="toc"><li><img alt="" src="./images/down.gif" /> <a href="#prob">The Problem</a></li><li><img alt="" src="./images/down.gif" /> <a href="#solution">The Solution</a></li><li><img alt="" src="./images/down.gif" /> <a href="#compat">Compatibility with Previous Servers</a></li></ul></div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div><div class="section"><h2><a name="prob" id="prob">The Problem</a></h2>
     <p>Apache 1.1.1 and earlier implemented the PATH_INFO and
     SCRIPT_NAME environment variables by looking at the filename,
     not the URL. While this resulted in the correct values in many
     cases, when the filesystem path was overloaded to contain path
     information, it could result in errant behavior. For example,
     if the following appeared in a config file:</p>
-<pre>
-     Alias /cgi-ralph /usr/local/httpd/cgi-bin/user.cgi/ralph
-</pre>
 
+    <div class="example"><p><code>
+      Alias /cgi-ralph /usr/local/httpd/cgi-bin/user.cgi/ralph
+    </code></p></div>    
+    
     <p>In this case, <code>user.cgi</code> is the CGI script, the
     "/ralph" is information to be passed onto the CGI. If this
     configuration was in place, and a request came for
@@ -48,9 +33,7 @@
     to "<code>/ralph/script</code>", and SCRIPT_NAME to
     "<code>/cgi-</code>". Obviously, the latter is incorrect. In
     certain cases, this could even cause the server to crash.</p>
-
-    <h2><a id="solution" name="solution">The Solution</a></h2>
-
+  </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div><div class="section"><h2><a name="solution" id="solution">The Solution</a></h2>
     <p>Apache 1.2 and later now determine SCRIPT_NAME and PATH_INFO
     by looking directly at the URL, and determining how much of the
     URL is client-modifiable, and setting PATH_INFO to it. To use
@@ -70,9 +53,8 @@
     information is not a recommended method, and a script making
     use of it "deserves" not to work. Apache 1.2b3 and later,
     however, do provide <a href="#compat">a workaround.</a></p>
-
-    <h2><a id="compat" name="compat">Compatibility with Previous
-    Servers</a></h2>
+  </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div><div class="section"><h2><a name="compat" id="compat">Compatibility with Previous Servers</a></h2>
+    
 
     <p>It may be necessary for a script that was designed for
     earlier versions of Apache or other servers to need the
     earlier versions can simply test for the existence of
     FILEPATH_INFO, and use it if available. Otherwise, it can use
     PATH_INFO. For example, in Perl, one might use:</p>
-<pre>
-    $path_info = $ENV{'FILEPATH_INFO'} || $ENV{'PATH_INFO'};
-</pre>
+
+    <div class="example"><p><code>
+      $path_info = $ENV{'FILEPATH_INFO'} || $ENV{'PATH_INFO'};
+    </code></p></div>
 
     <p>By doing this, a script can work with all servers supporting
     the CGI/1.1 specification, including all versions of
     Apache.</p>
-    <!--#include virtual="footer.html" -->
-  </body>
-</html>
-
+  </div></div><div id="footer"><p class="apache">Maintained by the <a href="http://httpd.apache.org/docs-project/">Apache HTTP Server Documentation Project</a></p><p class="menu"><a href="./mod/">Modules</a> | <a href="./mod/directives.html">Directives</a> | <a href="./faq/">FAQ</a> | <a href="./glossary.html">Glossary</a> | <a href="./sitemap.html">Sitemap</a></p></div></body></html>
\ No newline at end of file
diff --git a/docs/manual/cgi_path.xml b/docs/manual/cgi_path.xml
new file mode 100644 (file)
index 0000000..e1c6894
--- /dev/null
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE manualpage SYSTEM "./style/manualpage.dtd">
+<?xml-stylesheet type="text/xsl" href="./style/manual.en.xsl"?>
+
+<manualpage>
+  <relativepath href="."/>
+
+  <title>PATH_INFO Changes in the CGI Environment</title>
+
+  <summary>
+    <p>As implemented in Apache 1.1.1 and earlier versions, the
+    method Apache used to create PATH_INFO in the CGI environment
+    was counterintuitive, and could result in crashes in certain
+    cases. In Apache 1.2 and beyond, this behavior has changed.
+    Although this results in some compatibility problems with
+    certain legacy CGI applications, the Apache 1.2 behavior is
+    still compatible with the CGI/1.1 specification, and CGI
+    scripts can be easily modified (<a href="#compat">see
+    below</a>).</p>
+  </summary>
+
+  <section id="prob"><title>The Problem</title>
+    <p>Apache 1.1.1 and earlier implemented the PATH_INFO and
+    SCRIPT_NAME environment variables by looking at the filename,
+    not the URL. While this resulted in the correct values in many
+    cases, when the filesystem path was overloaded to contain path
+    information, it could result in errant behavior. For example,
+    if the following appeared in a config file:</p>
+
+    <example>
+      Alias /cgi-ralph /usr/local/httpd/cgi-bin/user.cgi/ralph
+    </example>    
+    
+    <p>In this case, <code>user.cgi</code> is the CGI script, the
+    "/ralph" is information to be passed onto the CGI. If this
+    configuration was in place, and a request came for
+    "<code>/cgi-ralph/script/</code>", the code would set PATH_INFO
+    to "<code>/ralph/script</code>", and SCRIPT_NAME to
+    "<code>/cgi-</code>". Obviously, the latter is incorrect. In
+    certain cases, this could even cause the server to crash.</p>
+  </section>
+
+  <section id="solution"><title>The Solution</title>
+    <p>Apache 1.2 and later now determine SCRIPT_NAME and PATH_INFO
+    by looking directly at the URL, and determining how much of the
+    URL is client-modifiable, and setting PATH_INFO to it. To use
+    the above example, PATH_INFO would be set to
+    "<code>/script</code>", and SCRIPT_NAME to
+    "<code>/cgi-ralph</code>". This makes sense and results in no
+    server behavior problems. It also permits the script to be
+    guaranteed that
+    "<code>http://$SERVER_NAME:$SERVER_PORT$SCRIPT_NAME$PATH_INFO</code>"
+    will always be an accessible URL that points to the current
+    script, something which was not necessarily true with previous
+    versions of Apache.</p>
+
+    <p>However, the "<code>/ralph</code>" information from the
+    <code>Alias</code> directive is lost. This is unfortunate, but
+    we feel that using the filesystem to pass along this sort of
+    information is not a recommended method, and a script making
+    use of it "deserves" not to work. Apache 1.2b3 and later,
+    however, do provide <a href="#compat">a workaround.</a></p>
+  </section>
+
+  <section id="compat">
+    <title>Compatibility with Previous Servers</title>
+
+    <p>It may be necessary for a script that was designed for
+    earlier versions of Apache or other servers to need the
+    information that the old PATH_INFO variable provided. For this
+    purpose, Apache 1.2 (1.2b3 and later) sets an additional
+    variable, FILEPATH_INFO. This environment variable contains the
+    value that PATH_INFO would have had with Apache 1.1.1.</p>
+
+    <p>A script that wishes to work with both Apache 1.2 and
+    earlier versions can simply test for the existence of
+    FILEPATH_INFO, and use it if available. Otherwise, it can use
+    PATH_INFO. For example, in Perl, one might use:</p>
+
+    <example>
+      $path_info = $ENV{'FILEPATH_INFO'} || $ENV{'PATH_INFO'};
+    </example>
+
+    <p>By doing this, a script can work with all servers supporting
+    the CGI/1.1 specification, including all versions of
+    Apache.</p>
+  </section>
+</manualpage>