Received: by taz.hyperreal.com (8.6.12/8.6.5) id RAA23667; Mon, 20 May 1996 17:09:43 -0700 Received: from bauhaus.organic.com by taz.hyperreal.com (8.6.12/8.6.5) with ESMTP id RAA23660; Mon, 20 May 1996 17:09:40 -0700 Received: (from cliff@localhost) by bauhaus.organic.com (8.7.5/8.6.12) id RAA28954; Mon, 20 May 1996 17:09:26 -0700 (PDT) Date: Mon, 20 May 1996 17:09:26 -0700 (PDT) From: Cliff Skolnick To: new-httpd@apache.org Subject: WWW Form Bug Report: "check_hostalias bug?" on Solaris 2.x (fwd) 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 No ack sent. -- Cliff Skolnick cliff@organic.com "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -- Benjamin Franklin, 1759 ---------- Forwarded message ---------- Date: Mon May 20 12:27:49 1996 From: jk@tools.de To: cliff@organic.com Subject: WWW Form Bug Report: "check_hostalias bug?" on Solaris 2.x Submitter: jk@tools.de Operating system: Solaris 2.x, version: 5.5 Version of Apache Used: 1.1b2 Extra Modules used: none URL exhibiting problem: Symptoms: -- It seems that you can define virtual hosts on a specific tcp/ip port, using something like the following in conf/httpd.conf (My idea was to use SSL with , using one server for both normal http requests to port 80 and SSL to port 443) ... Port 80 ... Listen 80 Listen 443 ... ... Problem is, that both the main server running on port 80 and the virtual server running on port 443 have the same server_name and check_hostalias in http_protocol.c will replace the r->server (pointing to the main server) with a pointer to the virtual server, when a netscape (2.0+) browser connects to port 80 (note that netscape sends a Host:, thus check_hostalias is called). - shouldn't check_hostalias consider only virtual hosts with s->is_virtual == 2? (  uses is_virtual == 1 ) - if a virtual host want's to match a specific port, shouldn't check_hostalias ignore connections to a different port - what the reason for the atoi(r->hostname) != r->server->port) check in check_hostalias? Any comments on the following diffs below: diff -rc3 apache_1.1b2-orig/src/http_protocol.c apache_1.1b2/src/http_protocol.c *** apache_1.1b2-orig/src/http_protocol.c Tue Apr 16 15:00:10 1996 --- apache_1.1b2/src/http_protocol.c Sat May 18 16:26:39 1996 *************** *** 348,362 **** 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; r->hostname = host; 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; --- 348,367 ---- void check_hostalias (request_rec *r) { char *host = getword(r->pool, &r->hostname, ':'); /* Get rid of port */ + short port = (*r->hostname) ? atoi(r->hostname) : 0; server_rec *s; ! if (*r->hostname && port != r->server->port) /* jk: ??? */ return; r->hostname = host; for (s = r->server->next; s; s = s->next) { char *names = s->names; + + if (s->is_virtual != 2 || + (s->host_port && s->host_port != port)) + continue; if (!strcasecmp(host, s->server_hostname)) { r->server = r->connection->server = s; -- Backtrace: -- --