You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Ed Korthof <ed...@organic.com> on 1997/05/19 02:50:42 UTC

[BUG]/[PATCH] v-hosts w/ the same name & on different ports aren't distinguished

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,717 ----
  
      /* search all the names from <VirtualHost> directive */
      for( sar = s->addrs; sar; sar = sar->next ) {
!       if( !strcasecmp( sar->virthost, host ) && port == sar->host_port ) {
  	r->server = r->connection->server = s;
  	if( r->hostlen && !strncmp( r->uri, "http://", 7) ) {
  	  r->uri += r->hostlen;



Re: [BUG]/[PATCH] v-hosts w/ the same name & on different ports aren't distinguished

Posted by Chuck Murcko <ch...@topsail.org>.
+1 on this.

Ed Korthof wrote:
> 
> 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,717 ----
> 
>       /* search all the names from <VirtualHost> directive */
>       for( sar = s->addrs; sar; sar = sar->next ) {
> !       if( !strcasecmp( sar->virthost, host ) && port == sar->host_port ) {
>         r->server = r->connection->server = s;
>         if( r->hostlen && !strncmp( r->uri, "http://", 7) ) {
>           r->uri += r->hostlen;

-- 
chuck
Chuck Murcko
The Topsail Group, West Chester PA USA
chuck@topsail.org