cvs commit: apache-1.3/src/main http_vhost.c
fielding00/01/16 12:59:59 Modified:src/main http_vhost.c Log: Squash warnings by using ap_isalnum and ap_isdigit. Revision ChangesPath 1.18 +2 -2 apache-1.3/src/main/http_vhost.c Index: http_vhost.c === RCS file: /home/cvs/apache-1.3/src/main/http_vhost.c,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- http_vhost.c 1999/12/20 18:16:50 1.17 +++ http_vhost.c 2000/01/16 20:59:59 1.18 @@ -670,7 +670,7 @@ src = r-hostname; dst = host; while (*src) { - if (!isalnum(*src) *src != '.' *src != '-') { + if (!ap_isalnum(*src) *src != '.' *src != '-') { if (*src == ':') break; else @@ -682,7 +682,7 @@ /* check the port part */ if (*src++ == ':') { while (*src) { - if (!isdigit(*src++)) { + if (!ap_isdigit(*src++)) { goto bad; } }
cvs commit: apache-1.3/src/main http_vhost.c
dgaudet 98/03/06 11:49:13 Modified:src/main http_vhost.c Log: tweak warnings for vhost stuff Revision ChangesPath 1.10 +3 -2 apache-1.3/src/main/http_vhost.c Index: http_vhost.c === RCS file: /export/home/cvs/apache-1.3/src/main/http_vhost.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- http_vhost.c 1998/03/02 17:53:47 1.9 +++ http_vhost.c 1998/03/06 19:49:12 1.10 @@ -494,14 +494,15 @@ VirtualHost %s:%u -- mixing * ports and non-* ports with a NameVirtualHost address is not supported, - you will get undefined behaviour, + proceeding with undefined results, sar-virthost, sar-host_port); } } else if (ic) { aplog_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, main_s, VirtualHost %s:%u overlaps with - VirtualHost %s:%u, the first has precedence, + VirtualHost %s:%u, the first has precedence, + perhaps you need a NameVirtualHost directive, sar-virthost, sar-host_port, ic-sar-virthost, ic-sar-host_port); ic-sar = sar;
cvs commit: apache-1.3/src/main http_vhost.c
dgaudet 98/03/02 09:53:48 Modified:src/main http_vhost.c Log: some systems #define s_addr s_addr_list[0].S_un or something like that, so s_addr is offlimits Revision ChangesPath 1.9 +4 -4 apache-1.3/src/main/http_vhost.c Index: http_vhost.c === RCS file: /export/home/cvs/apache-1.3/src/main/http_vhost.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- http_vhost.c 1998/03/02 06:51:11 1.8 +++ http_vhost.c 1998/03/02 17:53:47 1.9 @@ -373,14 +373,14 @@ { unsigned bucket; ipaddr_chain *trav; -unsigned s_addr; +unsigned addr; /* scan the hash table for an exact match first */ -s_addr = server_ip-s_addr; -bucket = hash_inaddr(s_addr); +addr = server_ip-s_addr; +bucket = hash_inaddr(addr); for (trav = iphash_table[bucket]; trav; trav = trav-next) { server_addr_rec *sar = trav-sar; - if ((sar-host_addr.s_addr == s_addr) + if ((sar-host_addr.s_addr == addr) (sar-host_port == 0 || sar-host_port == port || port == 0)) { return trav;
cvs commit: apache-1.3/src/main http_vhost.c
dgaudet 98/01/31 20:54:48 Modified:src CHANGES src/main http_vhost.c Log: Fix a bug I introduced with http_vhost.c... r-hostname is supposed to always have :port removed from it. Revision ChangesPath 1.609 +3 -0 apache-1.3/src/CHANGES Index: CHANGES === RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v retrieving revision 1.608 retrieving revision 1.609 diff -u -r1.608 -r1.609 --- CHANGES 1998/01/31 00:24:29 1.608 +++ CHANGES 1998/02/01 04:54:45 1.609 @@ -1,5 +1,8 @@ Changes with Apache 1.3b4 + *) Fix a bug where r-hostname didn't have the :port stripped + from it. [Dean Gaudet] + *) Tweaked the headers_out table size, and the subprocess_env table size guess in rename_original_environment(). Added MAKE_TABLE_PROFILE which can help discover make_table() 1.5 +23 -11apache-1.3/src/main/http_vhost.c Index: http_vhost.c === RCS file: /export/home/cvs/apache-1.3/src/main/http_vhost.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- http_vhost.c 1998/01/28 11:33:22 1.4 +++ http_vhost.c 1998/02/01 04:54:47 1.5 @@ -587,6 +587,24 @@ * run-time vhost matching functions */ +/* Remove :port and optionally a single trailing . from the hostname, this + * canonicalizes it somewhat. + */ +static void fix_hostname(request_rec *r) +{ +const char *hostname = r-hostname; +char *host = getword(r-pool, hostname, ':'); /* get rid of port */ +size_t l; + +/* trim a trailing . */ +l = strlen(host); +if (l 0 host[l-1] == '.') { +host[l-1] = '\0'; +} + +r-hostname = host; +} + static void check_hostalias(request_rec *r) { /* @@ -602,21 +620,12 @@ * - except for the addresses from the VirtualHost line, none of the other * names we'll match have ports associated with them */ -const char *hostname = r-hostname; -char *host = getword(r-pool, hostname, ':'); /* Get rid of port */ +const char *host = r-hostname; unsigned port = ntohs(r-connection-local_addr.sin_port); server_rec *s; server_rec *last_s; -size_t l; name_chain *src; -/* trim a trailing . */ -l = strlen(host); -if (l 0 host[l-1] == '.') { -host[l-1] = '\0'; -} - -r-hostname = host; last_s = NULL; /* Recall that the name_chain is a list of server_addr_recs, some of @@ -730,14 +739,17 @@ { /* check if we tucked away a name_chain */ if (r-connection-vhost_lookup_data) { -if (r-hostname || (r-hostname = table_get(r-headers_in, Host))) +if (r-hostname || (r-hostname = table_get(r-headers_in, Host))) { + fix_hostname(r); check_hostalias(r); + } else check_serverpath(r); } else if (!r-hostname) { /* must set this for HTTP/1.1 support */ r-hostname = table_get(r-headers_in, Host); + fix_hostname(r); } }