httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@engelschall.com (Ralf S. Engelschall)
Subject Re: [PATCH] VirtualHost confusion
Date Tue, 04 Mar 1997 07:45:16 GMT

In article <Pine.LNX.3.95dg2.970201140250.28944E-100000@twinlark.arctic.org> you wrote:
> On Sat, 1 Feb 1997, Marc Slemko wrote:

> >   * user and server get confused over what should be a virtual host
> >     and what is the main server, resulting in access to something
> >     other than the name defined in the virtualhost directive (but
> >     with the same IP address) failing.  
> >         Status: should be looked at, may not be a nice way to fix 
> >             since it is likely not technically a bug.

> When I put in the multiple ip support I didn't do multiple name support,
> but I put most of the code in that it needed.  I don't remember why I
> didn't do the last step... here is a patch which does that last step.  It
> treats all the names in a <VirtualHost> statement as if they were
> ServerAliased. 

> It requires a tweak to mod_rewrite.  I haven't tested this part of the
> patch.  Ralf? 

> Index: mod_rewrite.c
> ===================================================================
> RCS file: /export/home/cvs/apache/src/mod_rewrite.c,v
> retrieving revision 1.16
> diff -c -3 -r1.16 mod_rewrite.c
> *** mod_rewrite.c 1997/01/29 23:51:37 1.16
> --- mod_rewrite.c 1997/02/01 22:10:45
> ***************
> *** 2925,2930 ****
> --- 2925,2938 ----
>       }
>       else if (r->server->is_virtual) {
>           /* virtual servers */
> +     server_addr_rec *sar;
> + 
> +     /* check for the names supplied in the VirtualHost directive */
> +     for( sar = r->server->addrs; sar; sar = sar->next ) {
> +         if( !strcasecmp( sar->virthost, testhost ) ) {
> +         return YES;
> +         }
> +     }
>   
>           /* check for the virtual-server aliases */
>           if (r->server->names != NULL && r->server->names[0] !=
'\0') {

Sorry, -1 because 

1. the patch snippet has wrong line numbers. Seems like
   you've diffed against an old version of mod_rewrite.

2. this is really not enough:
   - VirtualHost could contain IP-adresses instead
     of names, so this case has to be taken into account, too.
   - VirtualHost could contain Host syntax with
     additional Port-number. So mod_rewrite has to take into account the
     difference between http://myhost/ and http://myhost:1234/, too.

I will investigate against this problematic cases with virtual hosts and I
will post a patch today which brings the CVS version of mod_rewrite up-todate
with my 3.0.0-SNAP (mostly comments changed for 1.2) and which also should
solve the virtual host problematic for mod_rewrite a little bit more precise.

Greetings,
                                       Ralf S. Engelschall
                                       rse@engelschall.com
                                       www.engelschall.com

Mime
View raw message