httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Laurie <...@gonzo.ben.algroup.co.uk>
Subject check_hostalias
Date Tue, 16 Jul 1996 17:35:36 GMT
I'm deeply suspicious of this code (apart from the large number of spurious
brackets):

void check_hostalias (request_rec *r) {
  char *host = getword(r->pool, &r->hostname, ':');	/* Get rid of port */
  int port = (*r->hostname) ? atoi(r->hostname) : 0;

//// I'm nearly sure the 0 should be the default port instead.

  server_rec *s;

  if (port && (port != r->server->port))
    return;

  if ((host[strlen(host)-1]) == '.') {
    host[strlen(host)-1] = '\0';
  }

  r->hostname = host;

  for (s = r->server->next; s; s = s->next) {

//// and surely it should be "s=server_conf"? 

    char *names = s->names;
    
    if ((!strcasecmp(host, s->server_hostname)) &&
	(!port || (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;
	}
      }
    }
  }
}

Thoughts??

Cheers,

Ben.

-- 
Ben Laurie                  Phone: +44 (181) 994 6435
Freelance Consultant and    Fax:   +44 (181) 994 6472
Technical Director          Email: ben@algroup.co.uk
A.L. Digital Ltd,           URL: http://www.algroup.co.uk
London, England.

Mime
View raw message