Commit 9273b4ab authored by Andre Malo's avatar Andre Malo
Browse files

Remove "PATH_INFO Changes in CGI Environment" documentation.

Reason: It's outdated and wrong. For 7 years and 3 months.
The behaviour was changed back during Apache 1.2 (!) development.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/APACHE_2_0_BRANCH@104663 13f79535-47bb-0310-9956-ffa450edef68
parent d95df305
Loading
Loading
Loading
Loading

docs/manual/cgi_path.html

deleted100644 → 0
+0 −11
Changes for docs/manual/cgi_path.html: 0 added lines, 11 removed lines.
Original line number Diff line number Diff line
URI: cgi_path.html.en
Content-Language: en
Content-type: text/html; charset=ISO-8859-1

URI: cgi_path.html.ja.euc-jp
Content-Language: ja
Content-type: text/html; charset=EUC-JP

URI: cgi_path.html.ko.euc-kr
Content-Language: ko
Content-type: text/html; charset=EUC-KR

docs/manual/cgi_path.html.en

deleted100644 → 0
+0 −115
Changes for docs/manual/cgi_path.html.en: 0 added lines, 115 removed lines.
Original line number Diff line number Diff line
<?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>
<div class="toplang">
<p><span>Available Languages: </span><a href="./en/cgi_path.html" title="English">&nbsp;en&nbsp;</a> |
<a href="./ja/cgi_path.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a> |
<a href="./ko/cgi_path.html" hreflang="ko" rel="alternate" title="Korean">&nbsp;ko&nbsp;</a></p>
</div>

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

    <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
    "<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>
  </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
    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>
  </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
    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>

    <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>
  </div></div>
<div class="bottomlang">
<p><span>Available Languages: </span><a href="./en/cgi_path.html" title="English">&nbsp;en&nbsp;</a> |
<a href="./ja/cgi_path.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a> |
<a href="./ko/cgi_path.html" hreflang="ko" rel="alternate" title="Korean">&nbsp;ko&nbsp;</a></p>
</div><div id="footer">
<p class="apache">Copyright 1999-2004 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</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
+0 −115
Changes for docs/manual/cgi_path.html.ja.euc-jp: 0 added lines, 115 removed lines.
Original line number Diff line number Diff line
<?xml version="1.0" encoding="EUC-JP"?>
<!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="ja" xml:lang="ja"><head><!--
        XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
              This file is generated from xml source: DO NOT EDIT
        XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
      -->
<title>CGI 環境での PATH_INFO の変更 - Apache HTTP サーバ</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/">モジュール</a> | <a href="./mod/directives.html">ディレクティブ</a> | <a href="./faq/">FAQ</a> | <a href="./glossary.html">用語</a> | <a href="./sitemap.html">サイトマップ</a></p>
<p class="apache">Apache HTTP サーバ バージョン 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 サーバ</a> &gt; <a href="http://httpd.apache.org/docs-project/">ドキュメンテーション</a> &gt; <a href="./">バージョン 2.0</a></div><div id="page-content"><div id="preamble"><h1>CGI 環境での PATH_INFO の変更</h1>
<div class="toplang">
<p><span>Available Languages: </span><a href="./en/cgi_path.html" hreflang="en" rel="alternate" title="English">&nbsp;en&nbsp;</a> |
<a href="./ja/cgi_path.html" title="Japanese">&nbsp;ja&nbsp;</a> |
<a href="./ko/cgi_path.html" hreflang="ko" rel="alternate" title="Korean">&nbsp;ko&nbsp;</a></p>
</div>

    <p>Apache 1.1.1 およびそれ以前のバージョンで実装されていた
    CGI 環境で PATH_INFO を作成する方法は直観的でなく、
    場合によってはクラッシュすることもありました。
    Apache 1.2 及びそれ以降において、この動作が変更されました。
    このことにより特定の古い CGI アプリケーションにおいていくつか
    互換性の問題が生じることがありますが、それでも Apache 1.2 の動作は
    CGI/1.1 仕様と互換があり、CGI スクリプトは容易に修正できます(<a href="#compat">以下参照</a>)。</p>
  </div>
<div id="quickview"><ul id="toc"><li><img alt="" src="./images/down.gif" /> <a href="#prob">問題</a></li>
<li><img alt="" src="./images/down.gif" /> <a href="#solution">解決</a></li>
<li><img alt="" src="./images/down.gif" /> <a href="#compat">以前のサーバとの互換性</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">問題</a></h2>

    <p>Apache 1.1.1 およびそれ以前では、URL ではなくファイル名を参照して
    PATH_INFO と SCRIPT_NAME 環境変数を設定していました。
    多くの場合はこれが正しい結果を返しますが、パス情報を含むように
    filesystem パスがオーバーロードされた場合は、
    誤った結果を返す場合がありました。
    たとえば、設定ファイルに以下がある場合</p>

    <div class="example"><p><code>
      Alias /cgi-ralph /usr/local/httpd/cgi-bin/user.cgi/ralph
    </code></p></div>

    <p>この場合、<code>user.cgi</code> は CGI スクリプトであり、
    "/ralph" は、CGI に渡される情報です。もし上の設定がなされていて、
    "<code>/cgi-ralph/script/</code>" へのリクエストが来れば、
    PATH_INFO には "<code>/ralph/script/</code>" が、
    SCRIPT_NAME には "<code>/cgi-</code>" が設定されます。
    明らかに、後者は間違っています。特定の場合には、これにより
    サーバがクラッシュすることさえありました。</p>
  </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">解決</a></h2>
    <p>Apache 1.2 以降では SCRIPT_NAME と PATH_INFO の決定には URL
    を直接参照して、URL
    のどれだけの部分がクライアントが変更可能なのかを確定させた上で
    PATH_INFO を設定するようになりました。上の例では、PATH_INFO には
    "<code>/script</code>" が、SCRIPT_NAME には
    "<code>/cgi-ralph</code>" が設定されます。
    これは正しく、さらに、サーバの動作に問題を起こすこともありません。また、
    "<code>http://$SERVER_NAME:$SERVER_PORT$SCRIPT_NAME$PATH_INFO</code>"
    が、常に最新のスクリプトを指す、アクセス可能な URL であることを
    保証します。これは、以前のバージョンの Apache
    では必ずしもそうとは限らなかったことです。
    </p>

    <p>しかし <code>Alias</code> ディレクティブからの
    "<code>/ralph</code>" 情報は失われます。
    これは残念ですが、filesystem を通してこの種類の情報を
    渡すのは薦められた方法ではなく、
    またそれを使ったスクリプトは動作しなくても当然だと考えます。
    ただし、Apache 1.2b3 以降では<a href="#compat">代替手段</a>を用意しています。</p>
  </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">以前のサーバとの互換性</a></h2>
    

    <p>以前のバージョンの Apache や他のサーバ向けに設計された
    スクリプトには古い PATH_INFO 変数により提供される情報が
    必要であるかもしれません。
    この目的のために、
    Apache 1.2 (1.2b3 以降) では追加の変数、FILEPATH_INFO
    を設定します。この環境変数には、Apache 1.1.1 で
    PATH_INFO であったであろう値が設定されます。</p>

    <p>Apache 1.2 およびそれ以前のバージョンの両方で動作させたいスクリプトは、
    FILEPATH_INFO の存在を単に調べて、それがあれば
    使う、ということができます。そうでなければ、PATH_INFO
    を使うことができます。たとえば、Perl では次のものを使うことができます</p>

    <div class="example"><p><code>
      $path_info = $ENV{'FILEPATH_INFO'} || $ENV{'PATH_INFO'};
    </code></p></div>

    <p>これにより、スクリプトはすべてのバージョンの Apache を含む、
    CGI/1.1 をサポートするすべてのサーバで動作することができます。
    </p>
  </div></div>
<div class="bottomlang">
<p><span>Available Languages: </span><a href="./en/cgi_path.html" hreflang="en" rel="alternate" title="English">&nbsp;en&nbsp;</a> |
<a href="./ja/cgi_path.html" title="Japanese">&nbsp;ja&nbsp;</a> |
<a href="./ko/cgi_path.html" hreflang="ko" rel="alternate" title="Korean">&nbsp;ko&nbsp;</a></p>
</div><div id="footer">
<p class="apache">Copyright 1999-2004 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
<p class="menu"><a href="./mod/">モジュール</a> | <a href="./mod/directives.html">ディレクティブ</a> | <a href="./faq/">FAQ</a> | <a href="./glossary.html">用語</a> | <a href="./sitemap.html">サイトマップ</a></p></div>
</body></html>
 No newline at end of file
+0 −103
Changes for docs/manual/cgi_path.html.ko.euc-kr: 0 added lines, 103 removed lines.
Original line number Diff line number Diff line
<?xml version="1.0" encoding="EUC-KR"?>
<!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="ko" xml:lang="ko"><head><!--
        XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
              This file is generated from xml source: DO NOT EDIT
        XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
      -->
<title>CGI 환경에서 PATH_INFO의 변화 - 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/">모듈</a> | <a href="./mod/directives.html">지시어들</a> | <a href="./faq/">FAQ</a> | <a href="./glossary.html">용어</a> | <a href="./sitemap.html">사이트맵</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>CGI 환경에서 PATH_INFO의 변화</h1>
<div class="toplang">
<p><span>가능한 언어: </span><a href="./en/cgi_path.html" hreflang="en" rel="alternate" title="English">&nbsp;en&nbsp;</a> |
<a href="./ja/cgi_path.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a> |
<a href="./ko/cgi_path.html" title="Korean">&nbsp;ko&nbsp;</a></p>
</div>

    <p>아파치 1.1.1과 그 이전 버전의 경우 CGI 환경에서
    PATH_INFO를 만드는 방법이 직관적이지 않고 어떤 경우 서버를
    죽이기도 했다. 아파치 1.2 이후 이 방법이 변했다. 기존의
    어떤 CGI 프로그램들과 약간의 호환문제가 있지만
    아파치 1.2의 행동은 아직도 CGI/1.1 규약을 벋어나지않으며,
    쉽게 CGI 스크립트를 수정할 수 있다. (<a href="#compat">아래
    참고</a>)</p>
  </div>
<div id="quickview"><ul id="toc"><li><img alt="" src="./images/down.gif" /> <a href="#prob">문제점</a></li>
<li><img alt="" src="./images/down.gif" /> <a href="#solution">해결책</a></li>
<li><img alt="" src="./images/down.gif" /> <a href="#compat">이전 서버와 호환성</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">문제점</a></h2>
    <p>아파치 1.1.1과 그 이전 버전은 URL 대신 파일명을
    가지고 PATH_INFO와 SCRIPT_NAME 환경변수를 구현했다. 많은
    경우 올바른 결과를 얻지만, 파일시스템 경로가 path
    정보를 포함한다면 잘못된 결과가 나올 수 있다. 예를 들어,
    설정파일에 다음과 같은 내용이 있다면:</p>

    <div class="example"><p><code>
      Alias /cgi-ralph /usr/local/httpd/cgi-bin/user.cgi/ralph
    </code></p></div>    

    <p>이 경우 <code>user.cgi</code>는 CGI 스크립트이고, "/ralph"는
    CGI에 넘겨지는 정보다. 이 경우
    "<code>/cgi-ralph/script/</code>"로 요청이 들어오면 PATH는
    "<code>/ralph/script</code>"가 되고, SCRIPT_NAME은
    "<code>/cgi-</code>"가 된다. 후자는 분명히 잘못되었다.
    심지어 어떤 경우 서버가 죽기도 한다.</p>
  </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">해결책</a></h2>
    <p>아파치 1.2 이후에서는 URL에서 클라이언트가 조절가능한
    부분을 판단하여 SCRIPT_NAME과 PATH_INFO를 설정한다. 위의
    예에서 PATH_INFO는 "<code>/script</code>"가 되고, SCRIPT_NAME은
    "<code>/cgi-ralph</code>"가 된다. 이는 합리적이며 서버에
    문제를 일으키지 않는다. 또, 이전 버전과 달리 스크립트에서
    "<code>http://$SERVER_NAME:$SERVER_PORT$SCRIPT_NAME$PATH_INFO</code>"가
    현재 스크립트를 가리키는 URL임을 보장할 수 있다.</p>

    <p>그러나 불행히도 <code>Alias</code> 지시어의
    "<code>/ralph</code>" 정보는 사라진다. 그러나 우리는
    파일시스템을 사용하여 이런 정보를 넘겨주는 것이 바람직한
    방법이 아니며, 이를 사용하는 스크립트는 작동할"만하지"
    않다고 생각한다. 그러나 아파치 1.2b3 이후에는 이에 대한
    <a href="#compat">해결책</a>이 있다.</p>
  </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">이전 서버와 호환성</a></h2>
    

    <p>아파치 이전 버전이나 다른 서버용으로 설계된 스크립트는
    이전 PATH_INFO 변수가 제공했던 정보가 필요할 수 있다. 그래서
    아파치 1.2 (1.2b3 이후)는 FILEPATH_INFO라는 변수를 더 설정한다.
    이 환경변수는 아파치 1.1.1의 PATH_INFO 값을 가진다.</p>

    <p>스크립트가 아파치 1.2와 이전 버전 모두에서 동작하게하려면,
    먼저 FILEPATH_INFO가 있는지 검사하고 있다면 그것을
    사용한다. 없다면 PATH_INFO를 사용한다. 예를 들어,
    Perl로는 다음과 같다:</p>

    <div class="example"><p><code>
      $path_info = $ENV{'FILEPATH_INFO'} || $ENV{'PATH_INFO'};
    </code></p></div>

    <p>이렇게 하면 모든 아파치를 포함하여 CGI/1.1 규정을 따르는
    모든 서버에서 스크립트가 동작할 수 있다.</p>
  </div></div>
<div class="bottomlang">
<p><span>가능한 언어: </span><a href="./en/cgi_path.html" hreflang="en" rel="alternate" title="English">&nbsp;en&nbsp;</a> |
<a href="./ja/cgi_path.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a> |
<a href="./ko/cgi_path.html" title="Korean">&nbsp;ko&nbsp;</a></p>
</div><div id="footer">
<p class="apache">Copyright 1999-2004 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
<p class="menu"><a href="./mod/">모듈</a> | <a href="./mod/directives.html">지시어들</a> | <a href="./faq/">FAQ</a> | <a href="./glossary.html">용어</a> | <a href="./sitemap.html">사이트맵</a></p></div>
</body></html>
 No newline at end of file

docs/manual/cgi_path.xml

deleted100644 → 0
+0 −104
Changes for docs/manual/cgi_path.xml: 0 added lines, 104 removed lines.
Original line number Diff line number Diff line
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE manualpage SYSTEM "./style/manualpage.dtd">
<?xml-stylesheet type="text/xsl" href="./style/manual.en.xsl"?>
<!-- $Revision: 1.1.2.6 $ -->

<!--
 Copyright 2002-2004 The Apache Software Foundation

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
-->

<manualpage metafile="cgi_path.xml.meta">

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