One way of handling the diffs between how 1.3 and 2.0 handles
UCN Off. 

Index: src/CHANGES
===================================================================
RCS file: /home/cvs/apache-1.3/src/CHANGES,v
retrieving revision 1.1939
diff -u -r1.1939 CHANGES
--- src/CHANGES 7 May 2004 14:43:04 -0000       1.1939
+++ src/CHANGES 11 May 2004 16:06:56 -0000
@@ -1,5 +1,12 @@
 Changes with Apache 1.3.32
 
+  *) Add new option 'Off20x' to UseCanonicalName to allow Apache 1.3
+     to follow the method used by Apache 2.0.x to determine the
+     Port value to used for the canonical name. The difference
+     is that 'Off' uses the actual socket port number if the
+     client doesn't send a port value in Host; under 2.0.x,
+     we ignore the physical port number.
+
 Changes with Apache 1.3.31
 
   *) SECURITY: CAN-2003-0987 (cve.mitre.org)
Index: src/include/ap_mmn.h
===================================================================
RCS file: /home/cvs/apache-1.3/src/include/ap_mmn.h,v
retrieving revision 1.68
diff -u -r1.68 ap_mmn.h
--- src/include/ap_mmn.h        15 Apr 2004 15:51:51 -0000      1.68
+++ src/include/ap_mmn.h        11 May 2004 16:06:57 -0000
@@ -203,6 +203,8 @@
  * 19990320.16          - ap_escape_errorlog_item()
  * 19990320.17          - ap_auth_nonce() and ap_auth_nonce added
  *                        in core_dir_config.
+ * 19990320.18          - increase bitfield size of use_canonical_name
+                          from 2 to 4 in core_dir_config.
  */
 
 #define MODULE_MAGIC_COOKIE 0x41503133UL /* "AP13" */
Index: src/include/http_core.h
===================================================================
RCS file: /home/cvs/apache-1.3/src/include/http_core.h,v
retrieving revision 1.75
diff -u -r1.75 http_core.h
--- src/include/http_core.h     15 Apr 2004 15:51:51 -0000      1.75
+++ src/include/http_core.h     11 May 2004 16:06:57 -0000
@@ -225,11 +225,12 @@
 
     signed int content_md5 : 2;  /* calculate Content-MD5? */
 
-#define USE_CANONICAL_NAME_OFF   (0)
-#define USE_CANONICAL_NAME_ON    (1)
-#define USE_CANONICAL_NAME_DNS   (2)
-#define USE_CANONICAL_NAME_UNSET (3)
-    unsigned use_canonical_name : 2;
+#define USE_CANONICAL_NAME_OFF    (0)
+#define USE_CANONICAL_NAME_ON     (1)
+#define USE_CANONICAL_NAME_DNS    (2)
+#define USE_CANONICAL_NAME_OFF20X (3)
+#define USE_CANONICAL_NAME_UNSET  (4)
+    unsigned use_canonical_name : 4;
 
     /* since is_fnmatch(conf->d) was being called so frequently in
      * directory_walk() and its relatives, this field was created and
Index: src/main/http_core.c
===================================================================
RCS file: /home/cvs/apache-1.3/src/main/http_core.c,v
retrieving revision 1.335
diff -u -r1.335 http_core.c
--- src/main/http_core.c        3 May 2004 20:15:26 -0000       1.335
+++ src/main/http_core.c        11 May 2004 16:07:00 -0000
@@ -783,9 +783,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 connectiona and use
@@ -802,7 +800,8 @@
     d = (core_dir_config *)ap_get_module_config(r->per_dir_config,
                                                &core_module);
 
-    if (d->use_canonical_name == USE_CANONICAL_NAME_OFF) {
+    if (d->use_canonical_name == USE_CANONICAL_NAME_OFF ||
+        d->use_canonical_name == USE_CANONICAL_NAME_OFF20X) {
         return r->hostname ? r->hostname : r->server->server_hostname;
     }
     if (d->use_canonical_name == USE_CANONICAL_NAME_DNS) {
@@ -850,6 +849,10 @@
           cport ? cport :
             r->server->port ? r->server->port :
               ap_default_port(r);
+    } else if (d->use_canonical_name == USE_CANONICAL_NAME_OFF20X) {
+        port = r->parsed_uri.port_str ? r->parsed_uri.port : 
+          r->server->port ? r->server->port :
+            ap_default_port(r);
     } else { /* d->use_canonical_name == USE_CANONICAL_NAME_ON */
         port = r->server->port ? r->server->port : 
           cport ? cport :
@@ -2396,11 +2399,14 @@
     else if (strcasecmp(arg, "off") == 0) {
         d->use_canonical_name = USE_CANONICAL_NAME_OFF;
     }
+    else if (strcasecmp(arg, "off20x") == 0) {
+        d->use_canonical_name = USE_CANONICAL_NAME_OFF20X;
+    }
     else if (strcasecmp(arg, "dns") == 0) {
         d->use_canonical_name = USE_CANONICAL_NAME_DNS;
     }
     else {
-        return "parameter must be 'on', 'off', or 'dns'";
+        return "parameter must be 'on', 'off', 'off20x' or 'dns'";
     }
     return NULL;
 }
-- 
===========================================================================
   Jim Jagielski   [|]   [EMAIL PROTECTED]   [|]   http://www.jaguNET.com/
      "A society that will trade a little liberty for a little order
             will lose both and deserve neither" - T.Jefferson

Reply via email to