httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Sutton <p...@ukweb.com>
Subject Re: bug report (fwd)
Date Thu, 12 Sep 1996 12:17:29 GMT
On Tue, 10 Sep 1996, sameer wrote:
> Generally people did (where ip is the main ip#):
>
> Listen 80
> Listen 443
>
> <V ip2:80>
> </V>
>
> <V ip3:80>
> </V>
>
> <VirtualHost ip:443>
> </V>
>
> <V ip2:443>
> </V>
>
> <V ip3:443>
> </V>
>
> 	replacing <V ip:443> with <V *:443> fixed things.

Yep, the problem seems to be that the code which identifies non-IP virtual
hosts is being a little too broad, and thinks that <VH ip:443> is a non-IP
virtual host. That is, if the ip address in the vhost matches the IP of
the host machine, Apache thinks it is a non-IP VH, _even if_ the VH is on
a different port.

A possible fix is to only consider a VH to be a non-IP one if both the ip
address matches the host's IP _AND_ the port of the VH matches the port of
the main server. I'll enclose a patch to do this. I'm not yet sure whether
this is the right fix though. The patch prevents VHosts with different
ports from the main server being marked as non-IP vhosts.

Paul

*** http_main.c.dist	Thu Sep 12 13:15:50 1996
--- http_main.c	Thu Sep 12 13:16:36 1996
***************
*** 1236,1241 ****
--- 1236,1242 ----
      int n;
      server_addr_rec *sar;
      int has_inaddr_any;
+     int mainport = s->port;

      /* Main host first */

***************
*** 1260,1266 ****
  	for (n = 0; main->h_addr_list[n] != NULL; n++) {
  	    for(sar = s->addrs; sar; sar = sar->next) {
  		if (sar->host_addr.s_addr ==
! 		    (((struct in_addr *)(main->h_addr_list[n]))->s_addr))
  		    s->is_virtual = 2;
  		if( sar->host_addr.s_addr == htonl(INADDR_ANY) ) {
  		    has_inaddr_any = 1;
--- 1261,1268 ----
  	for (n = 0; main->h_addr_list[n] != NULL; n++) {
  	    for(sar = s->addrs; sar; sar = sar->next) {
  		if (sar->host_addr.s_addr ==
! 		    (((struct in_addr *)(main->h_addr_list[n]))->s_addr) &&
! 		    s->port == mainport)
  		    s->is_virtual = 2;
  		if( sar->host_addr.s_addr == htonl(INADDR_ANY) ) {
  		    has_inaddr_any = 1;


Mime
View raw message