httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Randy Terbush <ra...@zyzzyva.com>
Subject Re: more problems with Host:'s
Date Sun, 29 Sep 1996 15:03:50 GMT
> It doesn't seem screwy to me (mind you, I'm looking at 1.1.1 code):

I just glanced at the 1.1.1 code, and there is little (if any) difference.

With my config file layout, the Zyzzyva server is consistently last
in the filesystem, and seems to have been the only server effected.

By initializing the loop below to r->server->next, the condition to
exit this loop is met for the last server in the list before even
entered. This is definitely as Brian describe with config file order
being the key. Since the server list is not circular, I don't see
how this could work.

The code: (1.2)


  for (s = r->server->next; s; s = s->next) {
    char *names = s->names;
    
    if ((!strcasecmp(host, s->server_hostname)) && (port == s->port)) {
      r->server = r->connection->server = s;
      if (r->hostlen && !strncmp(r->uri, "http://", 7)) {
	r->uri += r->hostlen;
	parse_uri(r, r->uri);
      }
    }

    if (!names) continue;

    while (*names) {
      char *name = getword_conf (r->pool, &names);

      if ((is_matchexp(name) && !strcasecmp_match(host, name)) ||
	  (!strcasecmp(host, name))) {
	r->server = r->connection->server = s;
	if (r->hostlen && !strncmp(r->uri, "http://", 7)) {
	  r->uri += r->hostlen;
	  r->proxyreq = 0;
	}
      }
    }
  }

> www.hyperreal.com	IN A 204.152.144.36
> www.grooveneedle.com	IN A 204.152.144.36
> 
> <virtualhost>s are stacked, so the last in the file is the first
> match found.  Unless the request has something to differentiate it --
> which "GET / HTTP/1.0" doesn't -- you get the first match found in
> find_virtual_server.
> 
> Regarding the r->server->next in check_serverpath(), I don't see how
> changing it to r->server affects anything other than performance.  If
> the if conditional succeeds it will set r->server = r->server.
> 
> check_hostalias does other crud, so it's possible that starting at
> r->server would have a different effect... but if you dig back through
> read_request (caller of check_hostalias) and into read_request_line
> you'll see it does similar crud.
> 
> Anyhow, since check_serverpath() searches from last <virtualhost> to first,
> if you put "ServerPath /" into hyperreal's <virtualhost> section it will
> become the default.
> 
> Dean
> 
> In article <hot.mailing-lists.new-httpd-Pine.SGI.3.93.960927185805.1394I-100000@fully.organic.com>,
> Brian Behlendorf  <new-httpd@hyperreal.com> wrote:
> >
> >Something is really screwy here.
> >
> >Go to http://hyperreal.com/ through Netscape: great, looks gorgeous
> >
> >telnet to hyperreal.com port 80, and issue a 
> >
> >  GET / HTTP/1.0
> >
> >with no other headers, and I get the home page for one of the Host:-header
> >based home pages, www.grooveneedle.com, which happens to be the last
> >Host:-header-based vhost section in my httpd.conf.  If I use a Host: header
> >everything works as it should.  Anyone have any ideas?
> >
> >	Brian
> >
> >
> >--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--
> >brian@organic.com  www.apache.org  hyperreal.com  http://www.organic.com/JOBS
> >
> 




Mime
View raw message