added a note regarding Location: headers and relative URIs

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@58045 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Hartmut Holzgraefe 2001-09-22 08:39:02 +00:00
parent 65e1ce4d92
commit 0948cfe1fb

View file

@ -1,5 +1,5 @@
<?xml encoding="iso-8859-1"?>
<!-- $Revision: 1.26 $ -->
<!-- $Revision: 1.27 $ -->
<reference id="ref.http">
<title>HTTP functions</title>
<titleabbrev>HTTP</titleabbrev>
@ -60,6 +60,24 @@ exit; /* Make sure that code below does
</programlisting>
</informalexample>
</para>
<note>
<para>
HTTP 1.1 requires an absolute URI as argument to
<ulink url="&spec.http1.1;/rfc2616-sec14.html#sec14.30">Location:</ulink>
including protocol, hostname and absolute path. Some clients
might accept relative URIs but you definetly should not rely on
it. You can usually use $HTTP_SERVER_VARS['HTTP_HOST'],
$HTTP_SERVER_VARS['PHP_SELF'] and <function>dirname</function>
to make an absolute URI from a relative one yourself:
<informalexample>
<programlisting>
Header ("Location: http://".$HTTP_SERVER_VARS['HTTP_HOST']
."/".dirname($HTTP_SERVER_VARS['PHP_SELF']
."/".$relative_url);
</programlisting>
</informalexample>
</para>
</note>
<para>
The second special-case is any header that starts with the
string, &quot;HTTP/&quot; (case is not significant). For