httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ed Korthof ...@organic.com>
Subject Re: [BUG]/[PATCH] v-hosts w/ the same name & on different ports aren't distinguished
Date Tue, 27 May 1997 04:36:37 GMT
Indeed, 0 should be a wildcard.

This code is in place to find other v-hosts w/ the same IP, but a
different ServerName. 

It's absurdly confusing, however -- both in this place and in the place
where 'sar' is defined.  It's quite possible more bugs would turn up, but
I've altered the patch as per the minimum Roy describes.  I'll see about
commenting up the code tomorrow... unless someone else wants to take a
shot at it. 

     -- Ed Korthof        |  Web Server Engineer --
     -- ed@organic.com    |  Organic Online, Inc --
     -- (415) 278-5676    |  Fax: (415) 284-6891 --

On Mon, 26 May 1997, Roy T. Fielding wrote:

> I am not real familiar with this part of the code, but I'm pretty sure
> the patch is wrong.  sar->host_port is not the server port (it can be 0),
> so at a minimum the test should be against s->port or consider
> sar->host_port == 0 being the wildcard.
> 
> OTOH, I am having a real hard time understanding just what this routine
> is doing and why.  I recall having the same discussion last fall, and the
> code hasn't improved.  If someone who thinks they know what it is supposed
> to be doing could add a few comments, I'd bet it would reveal a couple bugs.
> 
> .....Roy [-1 on the patch]
> 
> >Sometime during the recent changes to the virtual host code, a bug slipped
> >in -- basically, for a server with multiple v-hosts on different ports but
> >with the same servername (and address), Apache 1.2b10 will server
> >documents for only one of them (the one defined earliest in the
> >configuration). 
> >
> >Incorrect assignments occur in the function check_hostalias, as shown in
> >the patch below.  This appears to have occured between 1.2b7 and 1.2b8.
> >
> >Anyway, the patch below (against 1.2b11-dev) solves the problem; so far as
> >I can see, it won't create any new problems.
> >
> >     -- Ed Korthof        |  Web Server Engineer --
> >     -- ed@organic.com    |  Organic Online, Inc --
> >     -- (415) 278-5676    |  Fax: (415) 284-6891 --
> >
*** http_protocol.c.orig	Sun May 18 16:40:03 1997
--- http_protocol.c	Sun May 18 17:07:11 1997
***************
*** 711,717 ****
  
      /* search all the names from <VirtualHost> directive */
      for( sar = s->addrs; sar; sar = sar->next ) {
!       if( !strcasecmp( sar->virthost, host ) ) {
  	r->server = r->connection->server = s;
  	if( r->hostlen && !strncmp( r->uri, "http://", 7) ) {
  	  r->uri += r->hostlen;
--- 711,718 ----
  
      /* search all the names from <VirtualHost> directive */
      for( sar = s->addrs; sar; sar = sar->next ) {
!       if( !strcasecmp( sar->virthost, host )
!           && ( (sar->host_port == 0) || (port == sar->host_port) ) ) {
  	r->server = r->connection->server = s;
  	if( r->hostlen && !strncmp( r->uri, "http://", 7) ) {
  	  r->uri += r->hostlen;
 


Mime
View raw message