Received: by taz.hyperreal.com (8.6.12/8.6.5) id NAA26603; Wed, 12 Jun 1996 13:54:59 -0700 Received: from acidik.organic.com by taz.hyperreal.com (8.6.12/8.6.5) with ESMTP id NAA26596; Wed, 12 Jun 1996 13:54:56 -0700 Received: from localhost (akosut@localhost) by acidik.organic.com (8.7.5/8.6.12) with SMTP id NAA23825 for ; Wed, 12 Jun 1996 13:54:36 -0700 (PDT) X-Authentication-Warning: acidik.organic.com: akosut owned process doing -bs Date: Wed, 12 Jun 1996 13:54:35 -0700 (PDT) From: Alexei Kosut To: Apache Subject: bugfix for virtualhosts Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-new-httpd@apache.org Precedence: bulk Reply-To: new-httpd@hyperreal.com Recently, there've been some bug reports concering the interaction between the Listen directives and Host:-header handling and related issues. I've been able to track down this bug, which stems from the fact that the Host-header checking code was assuming that all the virtual hosts were on the same port as the main server, which isn't neccessarily true anymore (since you can do ). Here's a patch. I'd like to see it committed prior to a b4 or final release of Apache 1.1.0, so if people could look it over, that'd be great. Thanks! Index: http_protocol.c =================================================================== RCS file: /export/home/cvs/apache/src/http_protocol.c,v retrieving revision 1.22 diff -c -r1.22 http_protocol.c *** http_protocol.c 1996/06/10 02:04:04 1.22 --- http_protocol.c 1996/06/12 20:50:00 *************** *** 352,360 **** void check_hostalias (request_rec *r) { char *host = getword(r->pool, &r->hostname, ':'); /* Get rid of port */ server_rec *s; ! if (*r->hostname && (atoi(r->hostname) != r->server->port)) return; if ((host[strlen(host)-1]) == '.') { --- 352,361 ---- void check_hostalias (request_rec *r) { char *host = getword(r->pool, &r->hostname, ':'); /* Get rid of port */ + int port = (*r->hostname) ? atoi(r->hostname) : 0; server_rec *s; ! if (port && (port != r->server->port)) return; if ((host[strlen(host)-1]) == '.') { *************** *** 365,372 **** for (s = r->server->next; s; s = s->next) { char *names = s->names; ! ! if (!strcasecmp(host, s->server_hostname)) { r->server = r->connection->server = s; if (r->hostlen && !strncmp(r->uri, "http://", 7)) { r->uri += r->hostlen; --- 366,374 ---- for (s = r->server->next; s; s = s->next) { char *names = s->names; ! ! if ((!strcasecmp(host, s->server_hostname)) && ! (!port || (port == s->port))) { r->server = r->connection->server = s; if (r->hostlen && !strncmp(r->uri, "http://", 7)) { r->uri += r->hostlen; -- Alexei Kosut http://www.nueva.pvt.k12.ca.us/~akosut/