httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r344369 - in /httpd/httpd/trunk: ./ docs/manual/ docs/manual/mod/ include/ server/
Date Tue, 15 Nov 2005 14:50:48 GMT
Author: jim
Date: Tue Nov 15 06:50:39 2005
New Revision: 344369

URL: http://svn.apache.org/viewcvs?rev=344369&view=rev
Log:
Add in the UseCanonicalPhysicalPort directive, which
basically allows Apache to configurably ( :) )
use the physical port when constructing the
canonical port. Also add the exact ordering to
the docs, so people can easily see how it works.
We now have compatibility with both 2.0 and 1.3.

Modified:
    httpd/httpd/trunk/CHANGES
    httpd/httpd/trunk/docs/manual/mod/core.html.en
    httpd/httpd/trunk/docs/manual/mod/core.xml
    httpd/httpd/trunk/docs/manual/mod/directives.html.en
    httpd/httpd/trunk/docs/manual/mod/quickreference.html.en
    httpd/httpd/trunk/docs/manual/server-wide.html.en
    httpd/httpd/trunk/docs/manual/server-wide.xml
    httpd/httpd/trunk/include/http_core.h
    httpd/httpd/trunk/server/core.c

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/CHANGES?rev=344369&r1=344368&r2=344369&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Tue Nov 15 06:50:39 2005
@@ -2,6 +2,10 @@
 Changes with Apache 2.3.0
   [Remove entries to the current 2.0 and 2.2 section below, when backported]
 
+  *) Add in new UseCanonicalPhysicalPort directive, which controls
+     whether or not Apache will ever use the actual physical port
+     when constructing the canonical port number. [Jim Jagielski]
+
   *) Asynchronous write completion for the Event MPM.  [Brian Pane]
 
   *) Added an End-Of-Request bucket type.  The logging of a request and

Modified: httpd/httpd/trunk/docs/manual/mod/core.html.en
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/docs/manual/mod/core.html.en?rev=344369&r1=344368&r2=344369&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/mod/core.html.en (original)
+++ httpd/httpd/trunk/docs/manual/mod/core.html.en Tue Nov 15 06:50:39 2005
@@ -93,6 +93,7 @@
 <li><img alt="" src="../images/down.gif" /> <a href="#timeout">TimeOut</a></li>
 <li><img alt="" src="../images/down.gif" /> <a href="#traceenable">TraceEnable</a></li>
 <li><img alt="" src="../images/down.gif" /> <a href="#usecanonicalname">UseCanonicalName</a></li>
+<li><img alt="" src="../images/down.gif" /> <a href="#usecanonicalphysicalport">UseCanonicalPhysicalPort</a></li>
 <li><img alt="" src="../images/down.gif" /> <a href="#virtualhost">&lt;VirtualHost&gt;</a></li>
 </ul>
 </div>
@@ -2762,7 +2763,8 @@
     <code>Host:</code> header to match this virtual host.</p>
 
     <p>See the description of the
-    <code class="directive"><a href="#usecanonicalname">UseCanonicalName</a></code>
directive for
+    <code class="directive"><a href="#usecanonicalname">UseCanonicalName</a></code>
and
+    <code class="directive"><a href="#usecanonicalphysicalport">UseCanonicalPhysicalPort</a></code>directives
for
     settings which determine whether self-referential URL's (e.g., by the
     <code class="module"><a href="../mod/mod_dir.html">mod_dir</a></code>
module) will refer to the
     specified port, or to the port number given in the client's request.
@@ -2775,6 +2777,7 @@
 <li><a href="../vhosts/">Apache virtual host
     documentation</a></li>
 <li><code class="directive"><a href="#usecanonicalname">UseCanonicalName</a></code></li>
+<li><code class="directive"><a href="#usecanonicalphysicalport">UseCanonicalPhysicalPort</a></code></li>
 <li><code class="directive"><a href="#namevirtualhost">NameVirtualHost</a></code></li>
 <li><code class="directive"><a href="#serveralias">ServerAlias</a></code></li>
 </ul>
@@ -3106,7 +3109,7 @@
 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configures
how the server determines its own name and
 port</td></tr>
 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>UseCanonicalName
On|Off|DNS</code></td></tr>
-<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>UseCanonicalName
Off</code></td></tr>
+<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>UseCanonicalName
On</code></td></tr>
 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server
config, virtual host, directory</td></tr>
 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
@@ -3159,6 +3162,57 @@
 
 <h3>See also</h3>
 <ul>
+<li><code class="directive"><a href="#usecanonicalphysicalport">UseCanonicalPhysicalPort</a></code></li>
+<li><code class="directive"><a href="#servername">ServerName</a></code></li>
+<li><code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code></li>
+</ul>
+</div>
+<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif"
/></a></div>
+<div class="directive-section"><h2><a name="UseCanonicalPhysicalPort" id="UseCanonicalPhysicalPort">UseCanonicalPhysicalPort</a>
<a name="usecanonicalphysicalport" id="usecanonicalphysicalport">Directive</a></h2>
+<table class="directive">
+<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configures
how the server determines its own name and
+port</td></tr>
+<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>UseCanonicalPhysicalPort
On|Off</code></td></tr>
+<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>UseCanonicalPhysicalPort
Off</code></td></tr>
+<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server
config, virtual host, directory</td></tr>
+<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr>
+<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
+</table>
+    <p>In many situations Apache must construct a <em>self-referential</em>
+    URL -- that is, a URL that refers back to the same server. With
+    <code>UseCanonicalPhysicalPort On</code> Apache will, when
+    constructing the canonical port for the server to honor
+    the <code class="directive"><a href="#usecanonicalname">UseCanonicalName</a></code>
directive,
+    provide the actual physical port number being used by this request
+    as a potential port. With <code>UseCanonicalPhysicalPort Off</code>
+    Apache will not ever use the actual physical port number, instead
+    relying on all configured information to construct a valid port number.</p>
+
+    <div class="note"><h3>Note</h3>
+    <p>The ordering of when the physical port is used is as follows:<br /><br
/>
+     <code>UseCanonicalName On</code>
+     <ul>
+      <li>Port provided in <code>Servername</code></li>
+      <li>Physical port</li>
+      <li>Default port</li>
+     </ul>
+     <code>UseCanonicalName Off | DNS</code>
+     <ul>
+      <li>Parsed port from <code>Host:</code> header</li>
+      <li>Physical port</li>
+      <li>Port provided in <code>Servername</code></li>
+      <li>Default port</li>
+     </ul>
+    </p>
+    
+    <p>With <code>UseCanonicalPhysicalPort Off</code>, the
+    physical ports are removed from the ordering.</p>
+    </div>
+
+
+<h3>See also</h3>
+<ul>
+<li><code class="directive"><a href="#usecanonicalname">UseCanonicalName</a></code></li>
 <li><code class="directive"><a href="#servername">ServerName</a></code></li>
 <li><code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code></li>
 </ul>

Modified: httpd/httpd/trunk/docs/manual/mod/core.xml
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/docs/manual/mod/core.xml?rev=344369&r1=344368&r2=344369&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/mod/core.xml (original)
+++ httpd/httpd/trunk/docs/manual/mod/core.xml Tue Nov 15 06:50:39 2005
@@ -2748,7 +2748,8 @@
     <code>Host:</code> header to match this virtual host.</p>
 
     <p>See the description of the
-    <directive module="core">UseCanonicalName</directive> directive for
+    <directive module="core">UseCanonicalName</directive> and
+    <directive module="core">UseCanonicalPhysicalPort</directive>directives for
     settings which determine whether self-referential URL's (e.g., by the
     <module>mod_dir</module> module) will refer to the
     specified port, or to the port number given in the client's request.
@@ -2760,6 +2761,7 @@
 <seealso><a href="../vhosts/">Apache virtual host
     documentation</a></seealso>
 <seealso><directive module="core">UseCanonicalName</directive></seealso>
+<seealso><directive module="core">UseCanonicalPhysicalPort</directive></seealso>
 <seealso><directive module="core">NameVirtualHost</directive></seealso>
 <seealso><directive module="core">ServerAlias</directive></seealso>
 </directivesynopsis>
@@ -3077,7 +3079,7 @@
 <description>Configures how the server determines its own name and
 port</description>
 <syntax>UseCanonicalName On|Off|DNS</syntax>
-<default>UseCanonicalName Off</default>
+<default>UseCanonicalName On</default>
 <contextlist><context>server config</context><context>virtual host</context>
 <context>directory</context></contextlist>
 
@@ -3130,6 +3132,54 @@
     then it should be just fine.</p>
     </note>
 </usage>
+<seealso><directive module="core">UseCanonicalPhysicalPort</directive></seealso>
+<seealso><directive module="core">ServerName</directive></seealso>
+<seealso><directive module="mpm_common">Listen</directive></seealso>
+</directivesynopsis>
+
+<directivesynopsis>
+<name>UseCanonicalPhysicalPort</name>
+<description>Configures how the server determines its own name and
+port</description>
+<syntax>UseCanonicalPhysicalPort On|Off</syntax>
+<default>UseCanonicalPhysicalPort Off</default>
+<contextlist><context>server config</context><context>virtual host</context>
+<context>directory</context></contextlist>
+
+<usage>
+    <p>In many situations Apache must construct a <em>self-referential</em>
+    URL -- that is, a URL that refers back to the same server. With
+    <code>UseCanonicalPhysicalPort On</code> Apache will, when
+    constructing the canonical port for the server to honor
+    the <directive module="core">UseCanonicalName</directive> directive,
+    provide the actual physical port number being used by this request
+    as a potential port. With <code>UseCanonicalPhysicalPort Off</code>
+    Apache will not ever use the actual physical port number, instead
+    relying on all configured information to construct a valid port number.</p>
+
+    <note><title>Note</title>
+    <p>The ordering of when the physical port is used is as follows:<br /><br
/>
+     <code>UseCanonicalName On</code>
+     <ul>
+      <li>Port provided in <code>Servername</code></li>
+      <li>Physical port</li>
+      <li>Default port</li>
+     </ul>
+     <code>UseCanonicalName Off | DNS</code>
+     <ul>
+      <li>Parsed port from <code>Host:</code> header</li>
+      <li>Physical port</li>
+      <li>Port provided in <code>Servername</code></li>
+      <li>Default port</li>
+     </ul>
+    </p>
+    
+    <p>With <code>UseCanonicalPhysicalPort Off</code>, the
+    physical ports are removed from the ordering.</p>
+    </note>
+
+</usage>
+<seealso><directive module="core">UseCanonicalName</directive></seealso>
 <seealso><directive module="core">ServerName</directive></seealso>
 <seealso><directive module="mpm_common">Listen</directive></seealso>
 </directivesynopsis>

Modified: httpd/httpd/trunk/docs/manual/mod/directives.html.en
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/docs/manual/mod/directives.html.en?rev=344369&r1=344368&r2=344369&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/mod/directives.html.en (original)
+++ httpd/httpd/trunk/docs/manual/mod/directives.html.en Tue Nov 15 06:50:39 2005
@@ -413,6 +413,7 @@
 <li><a href="mod_mime.html#typesconfig">TypesConfig</a></li>
 <li><a href="mod_env.html#unsetenv" id="U" name="U">UnsetEnv</a></li>
 <li><a href="core.html#usecanonicalname">UseCanonicalName</a></li>
+<li><a href="core.html#usecanonicalphysicalport">UseCanonicalPhysicalPort</a></li>
 <li><a href="mpm_common.html#user">User</a></li>
 <li><a href="mod_userdir.html#userdir">UserDir</a></li>
 <li><a href="mod_vhost_alias.html#virtualdocumentroot" id="V" name="V">VirtualDocumentRoot</a></li>

Modified: httpd/httpd/trunk/docs/manual/mod/quickreference.html.en
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/docs/manual/mod/quickreference.html.en?rev=344369&r1=344368&r2=344369&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/mod/quickreference.html.en (original)
+++ httpd/httpd/trunk/docs/manual/mod/quickreference.html.en Tue Nov 15 06:50:39 2005
@@ -722,25 +722,27 @@
 <tr class="odd"><td><a href="mod_mime.html#typesconfig">TypesConfig <var>file-path</var></a></td><td>
conf/mime.types </td><td>s</td><td>B</td></tr><tr class="odd"><td
class="descr" colspan="4">The location of the <code>mime.types</code> file</td></tr>
 <tr><td><a href="mod_env.html#unsetenv" id="U" name="U">UnsetEnv <var>env-variable</var>
[<var>env-variable</var>]
 ...</a></td><td></td><td>svdh</td><td>B</td></tr><tr><td
class="descr" colspan="4">Removes variables from the environment</td></tr>
-<tr class="odd"><td><a href="core.html#usecanonicalname">UseCanonicalName
On|Off|DNS</a></td><td> Off </td><td>svd</td><td>C</td></tr><tr
class="odd"><td class="descr" colspan="4">Configures how the server determines its
own name and
+<tr class="odd"><td><a href="core.html#usecanonicalname">UseCanonicalName
On|Off|DNS</a></td><td> On </td><td>svd</td><td>C</td></tr><tr
class="odd"><td class="descr" colspan="4">Configures how the server determines its
own name and
 port</td></tr>
-<tr><td><a href="mpm_common.html#user">User <var>unix-userid</var></a></td><td>
#-1 </td><td>s</td><td>M</td></tr><tr><td class="descr"
colspan="4">The userid under which the server will answer
+<tr><td><a href="core.html#usecanonicalphysicalport">UseCanonicalPhysicalPort
On|Off</a></td><td> Off </td><td>svd</td><td>C</td></tr><tr><td
class="descr" colspan="4">Configures how the server determines its own name and
+port</td></tr>
+<tr class="odd"><td><a href="mpm_common.html#user">User <var>unix-userid</var></a></td><td>
#-1 </td><td>s</td><td>M</td></tr><tr class="odd"><td
class="descr" colspan="4">The userid under which the server will answer
 requests</td></tr>
-<tr class="odd"><td><a href="mod_userdir.html#userdir">UserDir <em>directory-filename</em></a></td><td></td><td>sv</td><td>B</td></tr><tr
class="odd"><td class="descr" colspan="4">Location of the user-specific directories</td></tr>
-<tr><td><a href="mod_vhost_alias.html#virtualdocumentroot" id="V" name="V">VirtualDocumentRoot
<em>interpolated-directory</em>|none</a></td><td> none </td><td>sv</td><td>E</td></tr><tr><td
class="descr" colspan="4">Dynamically configure the location of the document root
+<tr><td><a href="mod_userdir.html#userdir">UserDir <em>directory-filename</em></a></td><td></td><td>sv</td><td>B</td></tr><tr><td
class="descr" colspan="4">Location of the user-specific directories</td></tr>
+<tr class="odd"><td><a href="mod_vhost_alias.html#virtualdocumentroot" id="V"
name="V">VirtualDocumentRoot <em>interpolated-directory</em>|none</a></td><td>
none </td><td>sv</td><td>E</td></tr><tr class="odd"><td
class="descr" colspan="4">Dynamically configure the location of the document root
 for a given virtual host</td></tr>
-<tr class="odd"><td><a href="mod_vhost_alias.html#virtualdocumentrootip">VirtualDocumentRootIP
<em>interpolated-directory</em>|none</a></td><td> none </td><td>sv</td><td>E</td></tr><tr
class="odd"><td class="descr" colspan="4">Dynamically configure the location of the
document root
+<tr><td><a href="mod_vhost_alias.html#virtualdocumentrootip">VirtualDocumentRootIP
<em>interpolated-directory</em>|none</a></td><td> none </td><td>sv</td><td>E</td></tr><tr><td
class="descr" colspan="4">Dynamically configure the location of the document root
 for a given virtual host</td></tr>
-<tr><td><a href="core.html#virtualhost">&lt;VirtualHost
+<tr class="odd"><td><a href="core.html#virtualhost">&lt;VirtualHost
     <var>addr</var>[:<var>port</var>] [<var>addr</var>[:<var>port</var>]]
-    ...&gt; ... &lt;/VirtualHost&gt;</a></td><td></td><td>s</td><td>C</td></tr><tr><td
class="descr" colspan="4">Contains directives that apply only to a specific
+    ...&gt; ... &lt;/VirtualHost&gt;</a></td><td></td><td>s</td><td>C</td></tr><tr
class="odd"><td class="descr" colspan="4">Contains directives that apply only to
a specific
 hostname or IP address</td></tr>
-<tr class="odd"><td><a href="mod_vhost_alias.html#virtualscriptalias">VirtualScriptAlias
<em>interpolated-directory</em>|none</a></td><td> none </td><td>sv</td><td>E</td></tr><tr
class="odd"><td class="descr" colspan="4">Dynamically configure the location of the
CGI directory for
+<tr><td><a href="mod_vhost_alias.html#virtualscriptalias">VirtualScriptAlias
<em>interpolated-directory</em>|none</a></td><td> none </td><td>sv</td><td>E</td></tr><tr><td
class="descr" colspan="4">Dynamically configure the location of the CGI directory for
 a given virtual host</td></tr>
-<tr><td><a href="mod_vhost_alias.html#virtualscriptaliasip">VirtualScriptAliasIP
<em>interpolated-directory</em>|none</a></td><td> none </td><td>sv</td><td>E</td></tr><tr><td
class="descr" colspan="4">Dynamically configure the location of the cgi directory for
+<tr class="odd"><td><a href="mod_vhost_alias.html#virtualscriptaliasip">VirtualScriptAliasIP
<em>interpolated-directory</em>|none</a></td><td> none </td><td>sv</td><td>E</td></tr><tr
class="odd"><td class="descr" colspan="4">Dynamically configure the location of the
cgi directory for
 a given virtual host</td></tr>
-<tr class="odd"><td><a href="mpm_winnt.html#win32disableacceptex" id="W" name="W">Win32DisableAcceptEx</a></td><td></td><td>s</td><td>M</td></tr><tr
class="odd"><td class="descr" colspan="4">Use accept() rather than AcceptEx() to
accept network connections</td></tr>
-<tr><td><a href="mod_include.html#xbithack" id="X" name="X">XBitHack on|off|full</a></td><td>
off </td><td>svdh</td><td>B</td></tr><tr><td
class="descr" colspan="4">Parse SSI directives in files with the execute bit
+<tr><td><a href="mpm_winnt.html#win32disableacceptex" id="W" name="W">Win32DisableAcceptEx</a></td><td></td><td>s</td><td>M</td></tr><tr><td
class="descr" colspan="4">Use accept() rather than AcceptEx() to accept network connections</td></tr>
+<tr class="odd"><td><a href="mod_include.html#xbithack" id="X" name="X">XBitHack
on|off|full</a></td><td> off </td><td>svdh</td><td>B</td></tr><tr
class="odd"><td class="descr" colspan="4">Parse SSI directives in files with the
execute bit
 set</td></tr>
 </table></div>
 <div class="bottomlang">

Modified: httpd/httpd/trunk/docs/manual/server-wide.html.en
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/docs/manual/server-wide.html.en?rev=344369&r1=344368&r2=344369&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/server-wide.html.en (original)
+++ httpd/httpd/trunk/docs/manual/server-wide.html.en Tue Nov 15 06:50:39 2005
@@ -36,7 +36,7 @@
 <h2><a name="identification" id="identification">Server Identification</a></h2>
     
 
-    <table class="related"><tr><th>Related Modules</th><th>Related
Directives</th></tr><tr><td /><td><ul><li><code
class="directive"><a href="./mod/core.html#servername">ServerName</a></code></li><li><code
class="directive"><a href="./mod/core.html#serveradmin">ServerAdmin</a></code></li><li><code
class="directive"><a href="./mod/core.html#serversignature">ServerSignature</a></code></li><li><code
class="directive"><a href="./mod/core.html#servertokens">ServerTokens</a></code></li><li><code
class="directive"><a href="./mod/core.html#usecanonicalname">UseCanonicalName</a></code></li></ul></td></tr></table>
+    <table class="related"><tr><th>Related Modules</th><th>Related
Directives</th></tr><tr><td /><td><ul><li><code
class="directive"><a href="./mod/core.html#servername">ServerName</a></code></li><li><code
class="directive"><a href="./mod/core.html#serveradmin">ServerAdmin</a></code></li><li><code
class="directive"><a href="./mod/core.html#serversignature">ServerSignature</a></code></li><li><code
class="directive"><a href="./mod/core.html#servertokens">ServerTokens</a></code></li><li><code
class="directive"><a href="./mod/core.html#usecanonicalname">UseCanonicalName</a></code></li><li><code
class="directive"><a href="./mod/core.html#usecanonicalphysicalport">UseCanonicalPhysicalPort</a></code></li></ul></td></tr></table>
 
     <p>The <code class="directive"><a href="./mod/core.html#serveradmin">ServerAdmin</a></code>
and
     <code class="directive"><a href="./mod/core.html#servertokens">ServerTokens</a></code>
directives
@@ -45,8 +45,9 @@
     <code class="directive"><a href="./mod/core.html#servertokens">ServerTokens</a></code>
directive
     sets the value of the Server HTTP response header field.</p>
 
-    <p>The <code class="directive"><a href="./mod/core.html#servername">ServerName</a></code>
and
-    <code class="directive"><a href="./mod/core.html#usecanonicalname">UseCanonicalName</a></code>
+    <p>The <code class="directive"><a href="./mod/core.html#servername">ServerName</a></code>,
+    <code class="directive"><a href="./mod/core.html#usecanonicalname">UseCanonicalName</a></code>
and
+    <code class="directive"><a href="./mod/core.html#usecanonicalphysicalport">UseCanonicalPhysicalPort</a></code>
     directives are used by the server to determine how to construct
     self-referential URLs. For example, when a client requests a
     directory, but does not include the trailing slash in the

Modified: httpd/httpd/trunk/docs/manual/server-wide.xml
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/docs/manual/server-wide.xml?rev=344369&r1=344368&r2=344369&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/server-wide.xml (original)
+++ httpd/httpd/trunk/docs/manual/server-wide.xml Tue Nov 15 06:50:39 2005
@@ -40,6 +40,7 @@
         <directive module="core">ServerSignature</directive>
         <directive module="core">ServerTokens</directive>
         <directive module="core">UseCanonicalName</directive>
+        <directive module="core">UseCanonicalPhysicalPort</directive>
       </directivelist>
     </related>
 
@@ -50,8 +51,9 @@
     <directive module="core">ServerTokens</directive> directive
     sets the value of the Server HTTP response header field.</p>
 
-    <p>The <directive module="core">ServerName</directive> and
-    <directive module="core">UseCanonicalName</directive>
+    <p>The <directive module="core">ServerName</directive>,
+    <directive module="core">UseCanonicalName</directive> and
+    <directive module="core">UseCanonicalPhysicalPort</directive>
     directives are used by the server to determine how to construct
     self-referential URLs. For example, when a client requests a
     directory, but does not include the trailing slash in the

Modified: httpd/httpd/trunk/include/http_core.h
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/include/http_core.h?rev=344369&r1=344368&r2=344369&view=diff
==============================================================================
--- httpd/httpd/trunk/include/http_core.h (original)
+++ httpd/httpd/trunk/include/http_core.h Tue Nov 15 06:50:39 2005
@@ -482,6 +482,11 @@
 #define USE_CANONICAL_NAME_UNSET (3)
     unsigned use_canonical_name : 2;
 
+#define USE_CANONICAL_PHYS_PORT_OFF   (0)
+#define USE_CANONICAL_PHYS_PORT_ON    (1)
+#define USE_CANONICAL_PHYS_PORT_UNSET (2)
+    unsigned use_canonical_phys_port : 2;
+
     /* since is_fnmatch(conf->d) was being called so frequently in
      * directory_walk() and its relatives, this field was created and
      * is set to the result of that call.

Modified: httpd/httpd/trunk/server/core.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/server/core.c?rev=344369&r1=344368&r2=344369&view=diff
==============================================================================
--- httpd/httpd/trunk/server/core.c (original)
+++ httpd/httpd/trunk/server/core.c Tue Nov 15 06:50:39 2005
@@ -115,6 +115,7 @@
     conf->accept_path_info = 3;
 
     conf->use_canonical_name = USE_CANONICAL_NAME_UNSET;
+    conf->use_canonical_phys_port = USE_CANONICAL_PHYS_PORT_UNSET;
 
     conf->hostname_lookups = HOSTNAME_LOOKUP_UNSET;
     conf->satisfy = apr_palloc(a, sizeof(*conf->satisfy) * METHODS);
@@ -315,6 +316,10 @@
         conf->use_canonical_name = new->use_canonical_name;
     }
 
+    if (new->use_canonical_phys_port != USE_CANONICAL_PHYS_PORT_UNSET) {
+        conf->use_canonical_phys_port = new->use_canonical_phys_port;
+    }
+
 #ifdef RLIMIT_CPU
     if (new->limit_cpu) {
         conf->limit_cpu = new->limit_cpu;
@@ -888,9 +893,7 @@
 
 /* There are two options regarding what the "name" of a server is.  The
  * "canonical" name as defined by ServerName and Port, or the "client's
- * name" as supplied by a possible Host: header or full URI.  We never
- * trust the port passed in the client's headers, we always use the
- * port of the actual socket.
+ * name" as supplied by a possible Host: header or full URI.
  *
  * The DNS option to UseCanonicalName causes this routine to do a
  * reverse lookup on the local IP address of the connection and use
@@ -903,30 +906,38 @@
 {
     conn_rec *conn = r->connection;
     core_dir_config *d;
+    const char *retval;
 
     d = (core_dir_config *)ap_get_module_config(r->per_dir_config,
                                                 &core_module);
 
-    if (d->use_canonical_name == USE_CANONICAL_NAME_ON) {
-        return r->server->server_hostname;
-    }
-
-    if (d->use_canonical_name == USE_CANONICAL_NAME_DNS) {
-        if (conn->local_host == NULL) {
-            if (apr_getnameinfo(&conn->local_host,
+    switch (d->use_canonical_name) {
+        case USE_CANONICAL_NAME_ON:
+        case USE_CANONICAL_NAME_UNSET:
+            retval = r->server->server_hostname;
+            break;
+        case USE_CANONICAL_NAME_DNS:
+            if (conn->local_host == NULL) {
+                if (apr_getnameinfo(&conn->local_host,
                                 conn->local_addr, 0) != APR_SUCCESS)
-                conn->local_host = apr_pstrdup(conn->pool,
+                    conn->local_host = apr_pstrdup(conn->pool,
                                                r->server->server_hostname);
-            else {
-                ap_str_tolower(conn->local_host);
+                else {
+                    ap_str_tolower(conn->local_host);
+                }
             }
-        }
-
-        return conn->local_host;
+            retval = conn->local_host;
+            break;
+        case USE_CANONICAL_NAME_OFF:
+            retval = r->hostname ? r->hostname : r->server->server_hostname;
+            break;
+        default:
+            ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
+                         "ap_get_server_name: Invalid UCN Option somehow");
+            retval = "localhost";
+            break;
     }
-
-    /* default */
-    return r->hostname ? r->hostname : r->server->server_hostname;
+    return retval;
 }
 
 /*
@@ -952,34 +963,44 @@
     core_dir_config *d =
       (core_dir_config *)ap_get_module_config(r->per_dir_config, &core_module);
 
-    if (d->use_canonical_name == USE_CANONICAL_NAME_OFF
-        || d->use_canonical_name == USE_CANONICAL_NAME_DNS) {
-
-        /* With UseCanonicalName off Apache will form self-referential
-         * URLs using the hostname and port supplied by the client if
-         * any are supplied (otherwise it will use the canonical name).
-         */
-        port = r->parsed_uri.port_str ? r->parsed_uri.port :
-               r->connection->local_addr->port ? r->connection->local_addr->port
:
-               r->server->port ? r->server->port :
-               ap_default_port(r);
-    }
-    else { /* d->use_canonical_name == USE_CANONICAL_NAME_ON */
-
-        /* With UseCanonicalName on (and in all versions prior to 1.3)
-         * Apache will use the hostname and port specified in the
-         * ServerName directive to construct a canonical name for the
-         * server. (If no port was specified in the ServerName
-         * directive, Apache uses the port supplied by the client if
-         * any is supplied, and finally the default port for the protocol
-         * used.
-         */
-        port = r->server->port ? r->server->port :
-               r->connection->local_addr->port ? r->connection->local_addr->port
:
-               ap_default_port(r);
+    switch (d->use_canonical_name) {
+        case USE_CANONICAL_NAME_OFF:
+        case USE_CANONICAL_NAME_DNS:
+            if (d->use_canonical_phys_port == USE_CANONICAL_PHYS_PORT_ON)
+                port = r->parsed_uri.port_str ? r->parsed_uri.port :
+                       r->connection->local_addr->port ? r->connection->local_addr->port
:
+                       r->server->port ? r->server->port :
+                       ap_default_port(r);
+            else /* USE_CANONICAL_PHYS_PORT_OFF or USE_CANONICAL_PHYS_PORT_UNSET */
+                port = r->parsed_uri.port_str ? r->parsed_uri.port :
+                       r->server->port ? r->server->port :
+                       ap_default_port(r);
+            break;
+        case USE_CANONICAL_NAME_ON:
+        case USE_CANONICAL_NAME_UNSET:
+            /* With UseCanonicalName on (and in all versions prior to 1.3)
+             * Apache will use the hostname and port specified in the
+             * ServerName directive to construct a canonical name for the
+             * server. (If no port was specified in the ServerName
+             * directive, Apache uses the port supplied by the client if
+             * any is supplied, and finally the default port for the protocol
+             * used.
+             */
+            if (d->use_canonical_phys_port == USE_CANONICAL_PHYS_PORT_ON)
+                port = r->server->port ? r->server->port :
+                       r->connection->local_addr->port ? r->connection->local_addr->port
:
+                       ap_default_port(r);
+            else /* USE_CANONICAL_PHYS_PORT_OFF or USE_CANONICAL_PHYS_PORT_UNSET */
+                port = r->server->port ? r->server->port :
+                       ap_default_port(r);
+            break;
+        default:
+            ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
+                         "ap_get_server_port: Invalid UCN Option somehow");
+            port = ap_default_port(r);
+            break;
     }
 
-    /* default */
     return port;
 }
 
@@ -2484,6 +2505,29 @@
     return NULL;
 }
 
+static const char *set_use_canonical_phys_port(cmd_parms *cmd, void *d_,
+                                          const char *arg)
+{
+    core_dir_config *d = d_;
+    const char *err = ap_check_cmd_context(cmd, NOT_IN_LIMIT);
+
+    if (err != NULL) {
+        return err;
+    }
+
+    if (strcasecmp(arg, "on") == 0) {
+        d->use_canonical_phys_port = USE_CANONICAL_PHYS_PORT_ON;
+    }
+    else if (strcasecmp(arg, "off") == 0) {
+        d->use_canonical_phys_port = USE_CANONICAL_PHYS_PORT_OFF;
+    }
+    else {
+        return "parameter must be 'on' or 'off'";
+    }
+
+    return NULL;
+}
+
 
 static const char *include_config (cmd_parms *cmd, void *dummy,
                                    const char *name)
@@ -3259,6 +3303,9 @@
 AP_INIT_TAKE1("UseCanonicalName", set_use_canonical_name, NULL,
   RSRC_CONF|ACCESS_CONF,
   "How to work out the ServerName : Port when constructing URLs"),
+AP_INIT_TAKE1("UseCanonicalPhysicalPort", set_use_canonical_phys_port, NULL,
+  RSRC_CONF|ACCESS_CONF,
+  "Whether to use the physical Port when constructing URLs"),
 /* TODO: RlimitFoo should all be part of mod_cgi, not in the core */
 /* TODO: ListenBacklog in MPM */
 AP_INIT_TAKE1("Include", include_config, NULL,



Mime
View raw message