Return-Path: Delivered-To: apmail-httpd-dev-archive@www.apache.org Received: (qmail 85644 invoked from network); 11 May 2004 16:30:39 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 11 May 2004 16:30:39 -0000 Received: (qmail 28479 invoked by uid 500); 11 May 2004 16:30:03 -0000 Delivered-To: apmail-httpd-dev-archive@httpd.apache.org Received: (qmail 28383 invoked by uid 500); 11 May 2004 16:30:03 -0000 Mailing-List: contact dev-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list dev@httpd.apache.org Received: (qmail 28338 invoked by uid 98); 11 May 2004 16:30:02 -0000 Received: from jim@jaguNET.com by hermes.apache.org by uid 82 with qmail-scanner-1.20 (clamuko: 0.70. Clear:RC:0(209.133.199.10):. Processed in 0.378039 secs); 11 May 2004 16:30:02 -0000 X-Qmail-Scanner-Mail-From: jim@jaguNET.com via hermes.apache.org X-Qmail-Scanner: 1.20 (Clear:RC:0(209.133.199.10):. Processed in 0.378039 secs) Received: from unknown (HELO jimsys.jaguNET.com) (209.133.199.10) by hermes.apache.org with SMTP; 11 May 2004 16:30:01 -0000 Received: by jimsys.jaguNET.com (Postfix, from userid 501) id 0D9ED27BB53; Tue, 11 May 2004 12:28:36 -0400 (EDT) Date: Tue, 11 May 2004 12:28:36 -0400 From: Jim Jagielski To: dev@httpd.apache.org Subject: [PATCH 1.3] New UseCanonicalName option Message-ID: <20040511162836.GA2218@jimsys.jaguNET.com> Reply-To: jim@jaguNET.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4i X-Spam-Rating: hermes.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N 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 [|] jim@jaguNET.com [|] http://www.jaguNET.com/ "A society that will trade a little liberty for a little order will lose both and deserve neither" - T.Jefferson