httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dean Gaudet <dgau...@arctic.org>
Subject Re: need some data from proxies
Date Sun, 01 Mar 1998 21:49:44 GMT


On Sun, 1 Mar 1998, Martin Kraemer wrote:

> On Sun, Mar 01, 1998 at 04:50:35AM -0800, Dean Gaudet wrote:
> > So it's probably faster to just hand-code a tight little scanner (like
> > the one I wrote for my parse_absoluteuri() recently).
>There's one in util_uri, BTW., just before the _regex parser. 

Yup, and I was gonna make it faster ;)

> > I almost wish we could just drop r->uri, and r->args ... they're redundant
> > now. 
> ...iff the group agrees that WITH_UTIL_URI is stable enuff and the
> ifndef WITH_UTIL_URI can be deleted.

I'm already doing this with my work to bring my absoluteURI patch forward
to use util_uri.  Here's my work in progress... I'm not done testing and
I'm not done cleaning. (CHANGES is out of date.)

Look in particular at the new proxy_trans changes.  I'm pretty happy with
how it looks now.

Martin, I think I'm going to get rid of most of the has_foo things in
parsed_uri ... it's sufficient to test if foo is non-NULL as far as I can
tell.  Are there other reasons for it?

Dean


Index: CHANGES
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v
retrieving revision 1.672
diff -u -r1.672 CHANGES
--- CHANGES	1998/02/28 08:12:46	1.672
+++ CHANGES	1998/03/01 21:43:38
@@ -1,5 +1,29 @@
 Changes with Apache 1.3b6
 
+  *) Rewrite of absoluteURI handling, and in particular how absoluteURIs
+     match vhosts.  Unless a request is a proxy request, a "http://host"
+     url is treated as if a similar "Host:" header had been supplied.
+     This change was made to support future HTTP/1.x protocols which
+     may require clients to send absoluteURIs for all requests.
+
+     In order to achieve this change subtle changes were made to the API.
+     In a request_rec, r->hostlen has been removed.  r->absolute_uri now
+     exists, and if the URI was an absoluteURI then its value *prior to
+     any modification* is copied here.  r->proxyreq is not set until the
+     translate_names phase. 
+
+     Plus changes to the virtualhost test suite for absoluteURI testing.
+     [Dean Gaudet]
+
+  *) Cleanup of code in http_vhost.c, and remove vhost matching code from
+     mod_rewrite.  The vhost matching is now performed by a globally
+     available function matches_request_vhost().  [Dean Gaudet]
+
+  *) Reduce memory usage, and speed up ServerAlias support.  As a
+     side-effect users can list multiple ServerAlias directives
+     and they're all considered.
+     [Chia-liang Kao <clkao@cirx.org>] PR#1531
+
   *) Add the `%a' construct to LogFormat and CustomLog to log the client IP
      address. [Todd Eigenschink <eigenstr@mixi.net>, PR#1885]
 
Index: include/http_vhost.h
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/include/http_vhost.h,v
retrieving revision 1.5
diff -u -r1.5 http_vhost.h
--- http_vhost.h	1998/01/21 19:17:40	1.5
+++ http_vhost.h	1998/03/01 21:43:39
@@ -74,4 +74,10 @@
  */
 void update_vhost_from_headers(request_rec *r);
 
+/* return 1 if the host:port matches any of the aliases of r->server
+ * return 0 otherwise
+ */
+API_EXPORT(int) matches_request_vhost(request_rec *r, const char *host,
+    unsigned port);
+
 #endif	/* !APACHE_HTTP_VHOST_H */
Index: include/httpd.h
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/include/httpd.h,v
retrieving revision 1.188
diff -u -r1.188 httpd.h
--- httpd.h	1998/02/27 15:15:15	1.188
+++ httpd.h	1998/03/01 21:43:39
@@ -537,9 +537,7 @@
 typedef struct request_rec request_rec;
 typedef struct listen_rec listen_rec;
 
-#ifdef WITH_UTIL_URI
 #include "util_uri.h"
-#endif
 
 struct request_rec {
 
@@ -564,12 +562,11 @@
 
     char *the_request;		/* First line of request, so we can log it */
     int assbackwards;		/* HTTP/0.9, "simple" request */
-    int proxyreq;		/* A proxy request */
+    int proxyreq;		/* A proxy request (calculated during translate_name) */
     int header_only;		/* HEAD request, as opposed to GET */
     char *protocol;		/* Protocol, as given to us, or HTTP/0.9 */
     int proto_num;		/* Number version of protocol; 1.1 = 1001 */
     char *hostname;		/* Host, as set by full URI or Host: */
-    int hostlen;		/* Length of http://host:port in full URI */
 
     time_t request_time;	/* When the request started */
 
@@ -654,15 +651,13 @@
      * or content-negotiation mapping).
      */
 
-    char *uri;			/* complete URI for a proxy req, or
-				   URL path for a non-proxy req */
+    char *unparsed_uri;		/* the uri without any parsing performed */
+    char *uri;			/* the path portion of the URI */
     char *filename;
     char *path_info;
     char *args;			/* QUERY_ARGS, if any */
     struct stat finfo;		/* ST_MODE set to zero if no such file */
-#ifdef WITH_UTIL_URI
-  uri_components parsed_uri;	/* components of uri, dismantled */
-#endif
+    uri_components parsed_uri;	/* components of uri, dismantled */
 
     /* Various other config info which may change with .htaccess files
      * These are config vectors, with one void* pointer for each module
@@ -782,7 +777,8 @@
     char *path;			/* Pathname for ServerPath */
     int pathlen;		/* Length of path */
 
-    char *names;		/* Wildcarded names for ServerAlias servers */
+    array_header *names;	/* Normal names for ServerAlias servers */
+    array_header *wild_names;	/* Wildcarded names for ServerAlias servers */
 
     uid_t server_uid;		/* effective user id when calling exec wrapper */
     gid_t server_gid;		/* effective group id when calling exec wrapper */
Index: main/http_config.c
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/main/http_config.c,v
retrieving revision 1.99
diff -u -r1.99 http_config.c
--- http_config.c	1998/02/25 09:36:12	1.99
+++ http_config.c	1998/03/01 21:43:40
@@ -1175,7 +1175,8 @@
     s->next = NULL;
 
     s->is_virtual = 1;
-    s->names = NULL;
+    s->names = make_array(p, 4, sizeof(char **));
+    s->wild_names = make_array(p, 4, sizeof(char **));
 
     s->module_config = create_empty_config(p);
     s->lookup_defaults = create_per_dir_config(p);
@@ -1284,6 +1285,7 @@
     /* NOT virtual host; don't match any real network interface */
     s->addrs->host_addr.s_addr = htonl(INADDR_ANY);
     s->addrs->host_port = 0;	/* matches any port */
+    s->names = s->wild_names = NULL;
 
     s->module_config = create_server_config(p, s);
     s->lookup_defaults = create_default_per_dir_config(p);
Index: main/http_core.c
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/main/http_core.c,v
retrieving revision 1.164
diff -u -r1.164 http_core.c
--- http_core.c	1998/02/23 00:05:38	1.164
+++ http_core.c	1998/03/01 21:43:42
@@ -1222,6 +1222,21 @@
     return errmsg;
 }
 
+const char *set_server_alias(cmd_parms *cmd, void *dummy, const char *arg)
+{
+    if (!cmd->server->names)
+	return "ServerAlias only used in <VirtualHost>";
+    while (*arg) {
+	char **item, *name = getword_conf(cmd->pool, &arg);
+	if (is_matchexp(name))
+	    item = (char **) push_array(cmd->server->wild_names);
+	else
+	    item = (char **) push_array(cmd->server->names);
+	*item = name;
+    }
+    return NULL;
+}
+
 const char *add_module_command (cmd_parms *cmd, void *dummy, char *arg)
 {
     const char *err = check_cmd_context(cmd, GLOBAL_ONLY);
@@ -1872,9 +1887,8 @@
 { "ResourceConfig", set_server_string_slot,
   (void *)XtOffsetOf (server_rec, srm_confname), RSRC_CONF, TAKE1,
   "The filename of the resource config file" },
-{ "ServerAlias", set_server_string_slot,
-   (void *)XtOffsetOf (server_rec, names), RSRC_CONF, RAW_ARGS,
-   "A name or names alternately used to access the server" },
+{ "ServerAlias", set_server_alias, NULL, RSRC_CONF, RAW_ARGS,
+  "A name or names alternately used to access the server" },
 { "ServerPath", set_serverpath, NULL, RSRC_CONF, TAKE1,
   "The pathname the server can be reached at" },
 { "Timeout", set_timeout, NULL, RSRC_CONF, TAKE1, "Timeout duration (sec)"},
Index: main/http_main.c
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/main/http_main.c,v
retrieving revision 1.297
diff -u -r1.297 http_main.c
--- http_main.c	1998/02/28 10:31:58	1.297
+++ http_main.c	1998/03/01 21:43:45
@@ -2887,9 +2887,6 @@
 #ifdef NEED_HASHBANG_EMUL
     printf(" -D NEED_HASHBANG_EMUL\n");
 #endif
-#ifdef WITH_UTIL_URI
-    printf(" -D WITH_UTIL_URI\n");
-#endif
     printf("\n");
 }
 
Index: main/http_protocol.c
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/main/http_protocol.c,v
retrieving revision 1.192
diff -u -r1.192 http_protocol.c
--- http_protocol.c	1998/02/27 15:15:20	1.192
+++ http_protocol.c	1998/03/01 21:43:46
@@ -570,263 +570,37 @@
     return total;
 }
 
-
-/* parse_uri: check uri, determine whether proxy request, TRACE, or local request
+/* parse_uri: break apart the uri
  * Side Effects:
- * - sets r->proxyreq if "scheme://host:port" found
- * - sets r->args to rest after '?' (or NULL if no '?') unless TRACE or proxy req.
- * - sets r->uri to request uri (without r->args part unless TRACE or proxy req.)
- *#ifdef WITH_UTIL_URI
+ * - sets r->args to rest after '?' (or NULL if no '?')
+ * - sets r->uri to request uri (without r->args part)
  * - sets r->hostname (if not set already) from request (scheme://host:port)
- * - sets r->hostlen to length of "scheme://...host:port" prefix
- *#endif
  */
 void parse_uri(request_rec *r, const char *uri)
 {
-#ifdef WITH_UTIL_URI
-    int hostlen = 0;
     int status = HTTP_OK;
 
-    /* If an identical uri was parsed before, return without action */
-    if (r->parsed_uri.is_initialized && r->uri && strcmp(uri, r->uri) == 0)
-	return;
+    r->unparsed_uri = pstrdup(r->pool, uri);
 
     /* Simple syntax Errors in URLs are trapped by parse_uri_components(). */
     status = parse_uri_components_regex(r->pool, uri, &r->parsed_uri);
 
     if (is_HTTP_SUCCESS(status)) {
-
-	r->hostlen = r->parsed_uri.hostlen;
-
-	/* if hostlen is 0, it's not a proxy request */
-	r->proxyreq = (r->hostlen > 0);
-
-	if (!r->proxyreq) {
-	    r->hostname = NULL;
-
-	    if (r->method && !strcmp(r->method, "TRACE")) {
-		/* don't split into path & args for TRACE requests */
-		r->args = NULL;
-		r->uri = pstrdup(r->pool, uri);
-	    }
-	    else {
-		r->uri = r->parsed_uri.has_path ? r->parsed_uri.path : "/";
-		r->args = r->parsed_uri.query;
-	    }
-	}
-	else {
-	    if (r->hostlen == strlen(uri))
-		/* the request is just http://hostname - no trailing slash. 
-		 * Provide one:
-		 */
-		r->uri = pstrcat(r->pool, uri, "/", NULL);
-	    else
-		r->uri = pstrdup(r->pool, uri);
+	/* if it has a scheme we may need to do absoluteURI vhost stuff */
+	if (r->parsed_uri.has_scheme
+	    && !strcasecmp(r->parsed_uri.scheme, http_method(r))) {
 	    r->hostname = r->parsed_uri.hostname;
-	    /* no args splitting for proxy requests */
-	    r->args = NULL;
 	}
+	r->args = r->parsed_uri.query;
+	r->uri = r->parsed_uri.has_path ? r->parsed_uri.path
+					: pstrdup(r->pool, "/");
     }
     else {
 	r->args = NULL;
-	r->hostlen = 0;
 	r->hostname = NULL;
 	r->status = status;             /* set error status */
 	r->uri = pstrdup(r->pool, uri);
     }
-#else  /*WITH_UTIL_URI*/
-    const char *s;
-
-#if defined(__EMX__) || defined(WIN32)
-    /* Variable for OS/2 fix below. */
-    size_t loop, uri_len;
-#endif
-
-    /* A proxy request contains a ':' early on, but not as first character */
-
-    for (s = uri; s != '\0'; s++)
-        if (!isalnum(*s) && *s != '+' && *s != '-' && *s != '.')
-            break;
-
-    if (*s == ':' && s != uri) {
-        r->proxyreq = 1;
-        r->uri = pstrdup(r->pool, uri);
-        r->args = NULL;
-    }
-    else if (r->method && !strcmp(r->method, "TRACE")) {
-        r->proxyreq = 0;
-        r->uri = pstrdup(r->pool, uri);
-        r->args = NULL;
-    }
-    else {
-        r->proxyreq = 0;
-        r->uri = getword(r->pool, &uri, '?');
-
-#if defined(__EMX__) || defined(WIN32)
-        /* Handle path translations for OS/2 and plug security hole.
-         *
-         * This will prevent "http://www.wherever.com/..\..\/" from
-         * returning a directory for the root drive.
-         */
-        uri_len = strlen(r->uri);
-        for (loop = 0; loop < uri_len; ++loop) {
-            if (r->uri[loop] == '\\')
-                r->uri[loop] = '/';
-        };
-#endif
-#ifdef __EMX__
-        /* Fix OS/2 HPFS filename case problem. */
-        r->uri = strlwr(r->uri);
-#endif
-
-        if (*uri)
-            r->args = pstrdup(r->pool, uri);
-        else
-            r->args = NULL;
-    }
-#endif /*WITH_UTIL_URI*/
-}
-
-/* check_fulluri: check full uri against main server names/addresses
- * Side Effects:
- *#ifndef WITH_UTIL_URI
- * - sets r->hostname (if not set already) from request (scheme://host:port)
- * - sets r->hostlen to length of "scheme://host:port" part
- *#endif
- */
-const char *check_fulluri(request_rec *r, const char *uri)
-{
-    char *host, *proto, *slash, *colon;
-    int plen;
-    unsigned port;
-    const char *res_uri;
-
-#ifdef WITH_UTIL_URI
-    if (!r->parsed_uri.has_hostname
-     || !r->parsed_uri.has_scheme
-     || strcasecmp(r->parsed_uri.scheme, "http") != 0)
-	return uri;
-
-    /* Note: There's no use comparing against ntohs(r->connection->local_addr.sin_port)
-     * here, because in a proxy request, the two have nothing in common.
-     */
-    /* Make sure ports match */
-    port = (r->parsed_uri.has_port) ? r->parsed_uri.port : default_port_for_request(r);
-    if (port != r->server->port)
-	    return uri;
-
-    host = r->parsed_uri.hostname;
-
-    /* Easy simplification: If main server host name and port match,
-     * then this request is rewritten from a net_path to an abs_path
-     * and reduced from a proxyreq to a local request.
-     */
-    if (strcasecmp(host, r->server->server_hostname) == 0
-	|| strcmp(host, inet_ntoa(r->connection->local_addr.sin_addr)) == 0)
-    {
-	r->proxyreq = 0;
-	r->uri += r->hostlen;
-	r->hostlen = 0;
-    }
-    else {
-	/* Now things get a bit trickier - check the IP address(es) of
-	 * the host they gave, see if it matches ours.
-	 */
-	struct hostent *hp;
-	int n;
-	if (r->parsed_uri.dns_looked_up)
-	    /* looked up earlier; re-use: */
-	    hp = r->parsed_uri.hostent;
-	else {
-	    hp = pgethostbyname(r->pool, host);
-	    r->parsed_uri.dns_looked_up = 1;
-	    r->parsed_uri.dns_resolved = (hp != NULL);
-	    r->parsed_uri.hostent = hp;
-	}
-
-	if (r->parsed_uri.dns_resolved) {
-	    for (n = 0; hp->h_addr_list[n] != NULL; n++) {
-		if (r->connection->local_addr.sin_addr.s_addr ==
-		    (((struct in_addr *) (hp->h_addr_list[n]))->s_addr)) {
-		    r->proxyreq = 0;
-		    r->uri += r->hostlen;
-		    r->hostlen = 0;
-		    break;
-		}
-	    }
-	}
-    }
-    return r->uri;
-#else /*WITH_UTIL_URI*/
-    /* This routine parses full URLs, if they match the server */
-    proto = http_method(r);
-    plen = strlen(proto);
-    
-    if (strncasecmp(uri, proto, plen) || strncasecmp(uri + plen, "://", 3))
-        return uri;
-    host = pstrdup(r->pool, uri + plen + 3);
-
-    /* Find the hostname, assuming a valid request */
-    slash = strchr(host, '/');
-    if (slash) {
-        *slash = 0;
-    }
-    else {
-        slash = host + strlen(host);
-    }
-
-    /* Find the port */
-    colon = strchr(host, ':');
-    if (colon) {
-        *colon = '\0';
-        port = atoi(colon+1);
-        if (port == 0) {
-            return uri;
-        }
-    }
-    else {
-        port = default_port(r);
-    }
-
-    /* Make sure ports match */
-    if (port != r->server->port)
-        return uri;
-
-    /* Save it for later use */
-    r->hostname = host;
-    r->hostlen = plen + 3 + slash - host;
-    res_uri = uri + r->hostlen;
-    /* deal with "http://host" */
-    if (*res_uri == '\0') {
-	res_uri = "/";
-    }
-
-    /* The easy cases first */
-    if (!strcasecmp(host, r->server->server_hostname)) {
-        return res_uri;
-    }
-    else if (!strcmp(host, inet_ntoa(r->connection->local_addr.sin_addr))) {
-        return res_uri;
-    }
-    else {
-        /* Now things get a bit trickier - check the IP address(es) of
-         * the host they gave, see if it matches ours.
-         */
-        struct hostent *hp;
-        int n;
-
-        if ((hp = gethostbyname(host))) {
-            for (n = 0; hp->h_addr_list[n] != NULL; n++) {
-                if (r->connection->local_addr.sin_addr.s_addr ==
-                    (((struct in_addr *) (hp->h_addr_list[n]))->s_addr)) {
-                    return res_uri;
-                }
-            }
-        }
-    }
-
-    return uri;
-#endif /*WITH_UTIL_URI*/
 }
 
 int read_request_line(request_rec *r)
@@ -875,13 +649,7 @@
     r->the_request = pstrdup(r->pool, l);
     r->method = getword_white(r->pool, &ll);
     uri = getword_white(r->pool, &ll);
-#ifdef WITH_UTIL_URI
-    parse_uri(r, uri);
-    r->uri = pstrdup(r->pool, check_fulluri(r, r->uri)); /* r->uri isn't const, so copy */
-#else
-    uri = check_fulluri(r, uri);
     parse_uri(r, uri);
-#endif
 
     r->assbackwards = (ll[0] == '\0');
     r->protocol = pstrdup(r->pool, ll[0] ? ll : "HTTP/0.9");
Index: main/http_request.c
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/main/http_request.c,v
retrieving revision 1.108
diff -u -r1.108 http_request.c
--- http_request.c	1998/02/27 15:15:21	1.108
+++ http_request.c	1998/03/01 21:43:47
@@ -749,9 +749,7 @@
 
         rnew->uri = make_full_path(rnew->pool, udir, new_file);
         rnew->filename = make_full_path(rnew->pool, fdir, new_file);
-#ifdef WITH_UTIL_URI
 	parse_uri(rnew, rnew->uri);    /* fill in parsed_uri values */
-#endif
         if (stat(rnew->filename, &rnew->finfo) < 0) {
             rnew->finfo.st_mode = 0;
         }
@@ -797,10 +795,8 @@
         }
     }
     else {
-#ifdef WITH_UTIL_URI
 	/* XXX: @@@: What should be done with the parsed_uri values? */
 	parse_uri(rnew, new_file);	/* fill in parsed_uri values */
-#endif
         /*
          * XXX: this should be set properly like it is in the same-dir case
          * but it's actually sometimes to impossible to do it... because the
@@ -1017,28 +1013,14 @@
         return;
     }
 
-    if (!r->proxyreq) {
-        /*
-         * We don't want TRACE to run through the normal handler set, we
-         * handle it specially.
-         */
-        if (r->method_number == M_TRACE) {
-            if ((access_status = send_http_trace(r)))
-                die(access_status, r);
-            else
-                finalize_request_protocol(r);
-            return;
-        }
-
-        access_status = unescape_url(r->uri);
-        if (access_status) {
-            die(access_status, r);
-            return;
-        }
-
-        getparents(r->uri);     /* OK --- shrinking transformations... */
+    access_status = unescape_url(r->uri);
+    if (access_status) {
+	die(access_status, r);
+	return;
     }
 
+    getparents(r->uri);     /* OK --- shrinking transformations... */
+
     if ((access_status = location_walk(r))) {
         die(access_status, r);
         return;
@@ -1049,6 +1031,20 @@
         return;
     }
 
+    if (!r->proxyreq) {
+	/*
+	 * We don't want TRACE to run through the normal handler set, we
+	 * handle it specially.
+	 */
+	if (r->method_number == M_TRACE) {
+	    if ((access_status = send_http_trace(r)))
+		die(access_status, r);
+	    else
+		finalize_request_protocol(r);
+	    return;
+	}
+    }
+
     if (r->proto_num > HTTP_VERSION(1,0) && table_get(r->subprocess_env, "downgrade-1.0")) {
         r->proto_num = HTTP_VERSION(1,0);
     }
@@ -1229,7 +1225,6 @@
     new->protocol        = r->protocol;
     new->proto_num       = r->proto_num;
     new->hostname        = r->hostname;
-    new->hostlen         = r->hostlen;
     new->request_time    = r->request_time;
     new->main            = r->main;
 
Index: main/http_vhost.c
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/main/http_vhost.c,v
retrieving revision 1.7
diff -u -r1.7 http_vhost.c
--- http_vhost.c	1998/02/27 15:15:21	1.7
+++ http_vhost.c	1998/03/01 21:43:47
@@ -368,17 +368,19 @@
 }
 
 
-static ap_inline ipaddr_chain *find_ipaddr(struct in_addr server_ip,
+static ap_inline ipaddr_chain *find_ipaddr(struct in_addr *server_ip,
     unsigned port)
 {
     unsigned bucket;
     ipaddr_chain *trav;
+    unsigned s_addr;
 
     /* scan the hash table for an exact match first */
-    bucket = hash_inaddr(server_ip.s_addr);
+    s_addr = server_ip->s_addr;
+    bucket = hash_inaddr(s_addr);
     for (trav = iphash_table[bucket]; trav; trav = trav->next) {
 	server_addr_rec *sar = trav->sar;
-	if ((sar->host_addr.s_addr == server_ip.s_addr)
+	if ((sar->host_addr.s_addr == s_addr)
 	    && (sar->host_port == 0 || sar->host_port == port
 		|| port == 0)) {
 	    return trav;
@@ -475,7 +477,7 @@
 	    }
 	    else {
 		/* see if it matches something we've already got */
-		ic = find_ipaddr(sar->host_addr, sar->host_port);
+		ic = find_ipaddr(&sar->host_addr, sar->host_port);
 
 		/* the first time we encounter a NameVirtualHost address
 		 * ic->server will be NULL, on subsequent encounters
@@ -608,6 +610,89 @@
     r->hostname = host;
 }
 
+
+/* return 1 if host matches ServerName or ServerAliases */
+static int matches_aliases(server_rec *s, const char *host)
+{
+    int i;
+    array_header *names;
+
+    /* match ServerName */
+    if (!strcasecmp(host, s->server_hostname)) {
+	return 1;
+    }
+
+    /* search all the aliases from ServerAlias directive */
+    names = s->names;
+    if (names) {
+	char **name = (char **) names->elts;
+	for (i = 0; i < names->nelts; ++i) {
+	    if(!name[i]) continue;
+	    if (!strcasecmp(host, name[i]))
+		return 1;
+	}
+    }
+    names = s->wild_names;
+    if (names) {
+	char **name = (char **) names->elts;
+	for (i = 0; i < names->nelts; ++i) {
+	    if(!name[i]) continue;
+	    if (!strcasecmp_match(host, name[i]))
+		return 1;
+	}
+    }
+    return 0;
+}
+
+
+/* Suppose a request came in on the same socket as this r, and included
+ * a header "Host: host:port", would it map to r->server?  It's more
+ * than just that though.  When we do the normal matches for each request
+ * we don't even bother considering Host: etc on non-namevirtualhosts,
+ * we just call it a match.  But here we require the host:port to match
+ * the ServerName and/or ServerAliases.
+ */
+API_EXPORT(int) matches_request_vhost(request_rec *r, const char *host,
+    unsigned port)
+{
+    server_rec *s;
+    server_addr_rec *sar;
+
+    s = r->server;
+
+    /* search all the <VirtualHost> values */
+    /* XXX: If this is a NameVirtualHost then we may not be doing the Right Thing
+     * consider: 
+     *
+     *     NameVirtualHost 10.1.1.1
+     *     <VirtualHost 10.1.1.1>
+     *     ServerName v1
+     *     </VirtualHost>
+     *     <VirtualHost 10.1.1.1>
+     *     ServerName v2
+     *     </VirtualHost>
+     *
+     * Suppose r->server is v2, and we're asked to match "10.1.1.1".  We'll say
+     * "yup it's v2", when really it isn't... if a request came in for 10.1.1.1
+     * it would really go to v1.
+     */
+    for (sar = s->addrs; sar; sar = sar->next) {
+	if ((sar->host_port == 0 || port == sar->host_port)
+	    && !strcasecmp(host, sar->virthost)) {
+	    return 1;
+	}
+    }
+
+    /* the Port has to match now, because the rest don't have ports associated
+     * with them. */
+    if (port != s->port) {
+	return 0;
+    }
+
+    return matches_aliases(s, host);
+}
+
+
 static void check_hostalias(request_rec *r)
 {
     /*
@@ -641,7 +726,6 @@
      */
 
     for (src = r->connection->vhost_lookup_data; src; src = src->next) {
-        const char *names;
         server_addr_rec *sar;
 
 	/* We only consider addresses on the name_chain which have a matching
@@ -667,34 +751,15 @@
 	}
 	last_s = s;
 
-	/* match ServerName */
-        if (!strcasecmp(host, s->server_hostname)) {
+	if (matches_aliases(s, host)) {
 	    goto found;
-        }
-
-        /* search all the aliases from ServerAlias directive */
-        names = s->names;
-        if (names) {
-            while (*names) {
-                char *name = getword_conf(r->pool, &names);
-
-                if ((is_matchexp(name) && !strcasecmp_match(host, name)) ||
-                    (!strcasecmp(host, name))) {
-		    goto found;
-                }
-            }
-        }
+	}
     }
     return;
 
 found:
     /* s is the first matching server, we're done */
     r->server = r->connection->server = s;
-    if (r->hostlen && !strncasecmp(r->uri, "http://", 7)) {
-	r->uri += r->hostlen;
-	r->proxyreq = 0;
-	parse_uri(r, r->uri);
-    }
 }
 
 
@@ -709,7 +774,7 @@
      * This is in conjunction with the ServerPath code in http_core, so we
      * get the right host attached to a non- Host-sending request.
      *
-     * See the comment in check_hostaliases about how each vhost can be
+     * See the comment in check_hostalias about how each vhost can be
      * listed multiple times.
      */
 
@@ -760,24 +825,16 @@
  */
 void update_vhost_given_ip(conn_rec *conn)
 {
-    server_addr_rec *sar;
     ipaddr_chain *trav;
-    unsigned bucket;
-    struct in_addr server_ip = conn->local_addr.sin_addr;
     unsigned port = ntohs(conn->local_addr.sin_port);
 
     /* scan the hash table for an exact match first */
-    bucket = hash_inaddr(server_ip.s_addr);
-    for (trav = iphash_table[bucket]; trav; trav = trav->next) {
-	sar = trav->sar;
-	if ((sar->host_addr.s_addr == server_ip.s_addr)
-	    && (sar->host_port == 0 || sar->host_port == port)) {
-
-	    /* save the name_chain for later in case this is a name-vhost */
-	    conn->vhost_lookup_data = trav->names;
-	    conn->server = trav->server;
-	    return;
-	}
+    trav = find_ipaddr(&conn->local_addr.sin_addr, port);
+    if (trav) {
+	/* save the name_chain for later in case this is a name-vhost */
+	conn->vhost_lookup_data = trav->names;
+	conn->server = trav->server;
+	return;
     }
 
     /* There's certainly no name-vhosts with this address, they would have
Index: main/util_uri.c
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/main/util_uri.c,v
retrieving revision 1.3
diff -u -r1.3 util_uri.c
--- util_uri.c	1998/02/28 10:31:59	1.3
+++ util_uri.c	1998/03/01 21:43:47
@@ -87,14 +87,12 @@
     return 0;
 }
 
-#ifdef WITH_UTIL_URI
 API_EXPORT(unsigned short) default_port_for_request(const request_rec *r)
 {
     return (r->parsed_uri.has_scheme)
 	? default_port_for_scheme(r->parsed_uri.scheme)
 	: 0;
 }
-#endif /*WITH_UTIL_URI*/
 
 static unsigned short default_port_for_uri_components(const uri_components *uri_p)
 {
Index: modules/proxy/mod_proxy.c
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/modules/proxy/mod_proxy.c,v
retrieving revision 1.41
diff -u -r1.41 mod_proxy.c
--- mod_proxy.c	1998/02/27 15:15:24	1.41
+++ mod_proxy.c	1998/03/01 21:43:48
@@ -53,6 +53,7 @@
 
 #include "mod_proxy.h"
 #include "http_log.h"
+#include "http_vhost.h"
 
 /* Some WWW schemes and their default ports; this is basically /etc/services */
 /* This will become global when the protocol abstraction comes */
@@ -126,15 +127,28 @@
     proxy_server_conf *conf =
     (proxy_server_conf *) get_module_config(sconf, &proxy_module);
 
-    if (r->proxyreq) {
-	if (!conf->req)
-	    return DECLINED;
-
+    if (conf->req) {
+	if (!r->parsed_uri.has_scheme) {
+	    return DECLINED; /* definately not a proxy request */
+	}
+	/* but it might be something vhosted */
+	if (r->parsed_uri.has_hostname
+	    && !strcasecmp(r->parsed_uri.scheme, http_method(r))
+	    && matches_request_vhost(r, r->parsed_uri.hostname,
+		r->parsed_uri.has_port ? r->parsed_uri.port : default_port(r))) {
+	    return DECLINED; /* it's a vhost request */
+	}
+	r->proxyreq = 1;
+	r->uri = r->unparsed_uri;
 	r->filename = pstrcat(r->pool, "proxy:", r->uri, NULL);
 	r->handler = "proxy-server";
 	return OK;
     }
     else {
+	/* XXX: since r->uri has been manipulated already we're not really
+	 * compliant with RFC1945 at this point.  But this probably isn't
+	 * an issue because this is a hybrid proxy/origin server.
+	 */
 	int i, len;
 	struct proxy_alias *ent = (struct proxy_alias *) conf->aliases->elts;
 
@@ -161,16 +175,13 @@
  */
 static int proxy_fixup(request_rec *r)
 {
-    char *url, *p;
-    int i;
+    char *url;
 
     if (!r->proxyreq || strncmp(r->filename, "proxy:", 6) != 0)
 	return DECLINED;
 
     url = &r->filename[6];
 
-#ifdef WITH_UTIL_URI
-
     if (!r->parsed_uri.has_scheme) {
 	return DECLINED;
     }
@@ -182,25 +193,6 @@
 	return proxy_ftp_canon(r, url + 4);
     else
 	return OK;		/* otherwise; we've done the best we can */
-
-#else /*WITH_UTIL_URI*/
-
-/* lowercase the scheme */
-    p = strchr(url, ':');
-    if (p == NULL || p == url)
-	return HTTP_BAD_REQUEST;
-    for (i = 0; i != p - url; i++)
-	url[i] = tolower(url[i]);
-
-/* canonicalise each specific scheme */
-    if (strncmp(url, "http:", 5) == 0)
-	return proxy_http_canon(r, url + 5, "http", DEFAULT_HTTP_PORT);
-    else if (strncmp(url, "ftp:", 4) == 0)
-	return proxy_ftp_canon(r, url + 4);
-    else
-	return OK;		/* otherwise; we've done the best we can */
-
-#endif /*WITH_UTIL_URI*/
 }
 
 static void proxy_init(server_rec *r, pool *p)
@@ -218,9 +210,7 @@
 /* The "ProxyDomain" directive determines what domain will be appended */
 static int proxy_needsdomain(request_rec *r, const char *url, const char *domain)
 {
-#ifdef WITH_UTIL_URI
     char *nuri, *ref;
-    char strport[10];
 
     /* We only want to worry about GETs */
     if (!r->proxyreq || r->method_number != M_GET 
@@ -251,70 +241,6 @@
 		ref ? " from " : "", ref ? ref : "");
 
     return HTTP_MOVED_PERMANENTLY;
-
-#else /*WITH_UTIL_URI*/
-
-    char *scheme = pstrdup(r->pool, url);
-    char *url_copy, *user = NULL, *password = NULL, *path, *err, *host;
-    int port = -1;
-
-    /* We only want to worry about GETs */
-    if (r->method_number != M_GET)
-	return DECLINED;
-
-    /* Set url to the first char after "scheme://" */
-    if ((url_copy = strchr(scheme, ':')) == NULL
-	|| url_copy[1] != '/' || url_copy[2] != '/')
-	return DECLINED;
-
-    *url_copy++ = '\0';		/* delimit scheme, make url_copy point to "//", which is what proxy_canon_netloc expects */
-
-    /* Save the path - it will be re-appended for the redirection later */
-    path = strchr(&url_copy[2], '/');
-    if (path != NULL)
-	++path;			/* leading '/' will be overwritten by proxy_canon_netloc */
-    else
-	path = "";
-
-    /* Split request into user, password, host, port */
-    err = proxy_canon_netloc(r->pool, &url_copy, &user, &password, &host, &port);
-
-    if (err != NULL) {
-	aplog_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, r->server, err);
-	return DECLINED;
-    }
-
-    /* If host does contain a dot already, or it is "localhost", decline */
-    if (strchr(host, '.') != NULL || strcasecmp(host, "localhost") == 0)
-	return DECLINED;	/* host name has a dot already */
-    else {
-	char *nuri;
-	char *ref = table_get(r->headers_in, "Referer");
-	char strport[10];
-
-	/* now, rebuild URL */
-	if (port == -1)
-	    strcpy(strport, "");
-	else
-	    ap_snprintf(strport, sizeof(strport), ":%d", port);
-
-	/* Reassemble the request, but insert the domain after the host name */
-	nuri = pstrcat(r->pool, scheme, "://", (user != NULL) ? user : "",
-		            (password != NULL) ? ":" : "",
-		            (password != NULL) ? password : "",
-		            (user != NULL) ? "@" : "",
-		       host, domain, strport, "/", path,
-		       NULL);
-
-	table_setn(r->headers_out, "Location", nuri);
-	aplog_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, r->server,
-		    "Domain missing: %s sent to %s%s%s", r->uri, nuri,
-		    ref ? " from " : "", ref ? ref : "");
-
-	return HTTP_MOVED_PERMANENTLY;
-    }
-
-#endif /*WITH_UTIL_URI*/
 }
 
 /* -------------------------------------------------------------- */
@@ -582,9 +508,7 @@
     if (!found) {
 	New = push_array(conf->dirconn);
 	New->name = arg;
-#ifdef WITH_UTIL_URI
-	New->hostentry = NULL;;
-#endif /*WITH_UTIL_URI*/
+	New->hostentry = NULL;
 
 	if (proxy_is_ipaddr(New, parms->pool)) {
 #if DEBUGGING
Index: modules/proxy/mod_proxy.h
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/modules/proxy/mod_proxy.h,v
retrieving revision 1.30
diff -u -r1.30 mod_proxy.h
--- mod_proxy.h	1998/02/27 15:15:25	1.30
+++ mod_proxy.h	1998/03/01 21:43:48
@@ -162,11 +162,7 @@
 struct dirconn_entry {
     char *name;
     struct in_addr addr, mask;
-#ifdef WITH_UTIL_URI
     struct hostent *hostentry;
-#else /*WITH_UTIL_URI*/
-    struct hostent hostlist;
-#endif /*WITH_UTIL_URI*/
     int (*matcher) (struct dirconn_entry * This, request_rec *r);
 };
 
Index: modules/proxy/proxy_util.c
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/modules/proxy/proxy_util.c,v
retrieving revision 1.46
diff -u -r1.46 proxy_util.c
--- proxy_util.c	1998/02/28 10:32:01	1.46
+++ proxy_util.c	1998/03/01 21:43:49
@@ -58,9 +58,7 @@
 #include "md5.h"
 #include "multithread.h"
 #include "http_log.h"
-#ifdef WITH_UTIL_URI
 #include "util_uri.h"
-#endif /*WITH_UTIL_URI*/
 
 static int proxy_match_ipaddr(struct dirconn_entry *This, request_rec *r);
 static int proxy_match_domainname(struct dirconn_entry *This, request_rec *r);
@@ -1124,11 +1122,7 @@
     if (addr[i] != '\0' || proxy_host2addr(addr, &host) != NULL)
 	return 0;
 
-#ifdef WITH_UTIL_URI
     This->hostentry = pduphostent (p, &host);
-#else /*WITH_UTIL_URI*/
-    This->hostlist = host;    /*XXX: FIXME: This points to overwritten static storage!!! */
-#endif /*WITH_UTIL_URI*/
 
     /* Strip trailing dots */
     for (i = strlen(addr) - 1; i > 0 && addr[i] == '.'; --i)
Index: modules/standard/mod_log_config.c
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_log_config.c,v
retrieving revision 1.45
diff -u -r1.45 mod_log_config.c
--- mod_log_config.c	1998/02/28 08:12:49	1.45
+++ mod_log_config.c	1998/03/01 21:43:49
@@ -302,7 +302,6 @@
 
 static char *log_request_line(request_rec *r, char *a)
 {
-#ifdef WITH_UTIL_URI
 	    /* NOTE: If the original request contained a password, we
 	     * re-write the request line here to contain XXXXXX instead:
 	     * (note the truncation before the protocol string for HTTP/0.9 requests)
@@ -312,9 +311,6 @@
 					 unparse_uri_components(r->pool, &r->parsed_uri, NULL, 0),
 					 r->assbackwards ? NULL : " ", r->protocol, NULL)
 					: r->the_request;
-#else /*WITH_UTIL_URI*/
-    return r->the_request;
-#endif /*WITH_UTIL_URI*/
 }
 
 static char *log_request_file(request_rec *r, char *a)
Index: modules/standard/mod_rewrite.c
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_rewrite.c,v
retrieving revision 1.77
diff -u -r1.77 mod_rewrite.c
--- mod_rewrite.c	1998/02/27 14:47:46	1.77
+++ mod_rewrite.c	1998/03/01 21:43:51
@@ -109,6 +109,7 @@
 #include "http_request.h"
 #include "http_core.h"
 #include "http_log.h"
+#include "http_vhost.h"
 
     /* now our own stuff ... */
 #include "mod_rewrite.h"
@@ -2211,7 +2212,7 @@
         }
 
         /* now check whether we could reduce it to a local path... */
-        if (is_this_our_host(r, host) && port == r->server->port) {
+	if (matches_request_vhost(r, host, port)) {
             /* this is our host, so only the URL remains */
             r->filename = pstrdup(r->pool, url);
             rewritelog(r, 3, "reduce %s -> %s", olduri, r->filename);
@@ -3730,139 +3731,6 @@
     else
         return 0;
 }
-
-
-/*
-**
-**  special DNS lookup functions
-**
-*/
-
-static int is_this_our_host(request_rec *r, char *testhost)
-{
-    char **cppHNLour;
-    char **cppHNLtest;
-    char *ourhostname;
-    char *ourhostip;
-    const char *names;
-    char *name;
-    int i, j;
-    server_addr_rec *sar;
-
-    /* we can check:
-       r->
-            char *hostname            Host, as set by full URI or Host:
-            int hostlen               Length of http://host:port in full URI
-       r->server->
-            int is_virtual            0=main, 1=ip-virtual, 2=non-ip-virtual
-            char *server_hostname     used on compare to r->hostname
-            inet_ntoa(r->connection->local_addr.sin_addr)
-                                      used on compare to r->hostname
-            unsigned short port       for redirects
-            char *path                name of ServerPath
-            int pathlen               len of ServerPath
-            char *names               Wildcarded names for ServerAlias servers
-       r->server->addrs->
-            struct in_addr host_addr  The bound address, for this server
-            short host_port           The bound port, for this server
-            char *virthost            The name given in <VirtualHost>
-    */
-
-    ourhostname = r->server->server_hostname;
-    ourhostip   = inet_ntoa(r->connection->local_addr.sin_addr);
-
-    /* just a simple common case */
-    if (strcmp(testhost, ourhostname) == 0 ||
-        strcmp(testhost, ourhostip)   == 0   )
-       return YES;
-
-    /* now the complicated cases */
-    if (!r->server->is_virtual) {
-        /* main servers */
-
-        /* check for the alternative IP addresses */
-        if ((cppHNLour = resolv_ipaddr_list(r, ourhostname)) == NULL)
-            return NO;
-        if ((cppHNLtest = resolv_ipaddr_list(r, testhost)) == NULL)
-            return NO;
-        for (i = 0; cppHNLtest[i] != NULL; i++) {
-            for (j = 0; cppHNLour[j] != NULL; j++) {
-                if (strcmp(cppHNLtest[i], cppHNLour[j]) == 0) {
-                    return YES;
-                }
-            }
-        }
-    }
-    else if (r->server->is_virtual) {
-        /* virtual servers */
-
-        /* check for the names supplied in the VirtualHost directive */
-        for(sar = r->server->addrs; sar != NULL; sar = sar->next) {
-            if(strcasecmp(sar->virthost, testhost) == 0)
-                return YES;
-        }
-
-        /* check for the virtual-server aliases */
-        if (r->server->names != NULL && r->server->names[0] != '\0') {
-            names = r->server->names;
-            while (*names != '\0') {
-                name = getword_conf(r->pool, &names);
-                if ((is_matchexp(name) &&
-                    !strcasecmp_match(testhost, name)) ||
-                    (strcasecmp(testhost, name) == 0)    ) {
-                    return YES;
-                }
-            }
-        }
-    }
-    return NO;
-}
-
-static int isaddr(char *host)
-{
-    char *cp;
-
-    /* Null pointers and empty strings
-       are not addresses. */
-    if (host == NULL)
-        return NO;
-    if (*host == '\0')
-        return NO;
-    /* Make sure it has only digits and dots. */
-    for (cp = host; *cp; cp++) {
-        if (!isdigit(*cp) && *cp != '.')
-            return NO;
-    }
-    /* If it has a trailing dot,
-       don't treat it as an address. */
-    if (*(cp-1) == '.')
-       return NO;
-    return YES;
-}
-
-static char **resolv_ipaddr_list(request_rec *r, char *name)
-{
-    char **cppHNL;
-    struct hostent *hep;
-    int i;
-
-    if (isaddr(name))
-        hep = gethostbyaddr(name, sizeof(struct in_addr), AF_INET);
-    else
-        hep = gethostbyname(name);
-    if (hep == NULL)
-        return NULL;
-    for (i = 0; hep->h_addr_list[i]; i++)
-        ;
-    cppHNL = (char **)palloc(r->pool, sizeof(char *)*(i+1));
-    for (i = 0; hep->h_addr_list[i]; i++)
-        cppHNL[i] = pstrdup(r->pool,
-                            inet_ntoa(*((struct in_addr *)
-                            (hep->h_addr_list[i]))));
-    cppHNL[i] = NULL;
-    return cppHNL;
-}
-
 
 /*
 **
Index: modules/standard/mod_rewrite.h
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_rewrite.h,v
retrieving revision 1.39
diff -u -r1.39 mod_rewrite.h
--- mod_rewrite.h	1998/02/24 16:40:52	1.39
+++ mod_rewrite.h	1998/03/01 21:43:51
@@ -430,11 +430,6 @@
 static int    prefix_stat(const char *path, struct stat *sb);
 static void   add_env_variable(request_rec *r, char *s);
 
-    /* DNS functions */
-static int    is_this_our_host(request_rec *r, char *testhost);
-static int    isaddr(char *host);
-static char **resolv_ipaddr_list(request_rec *r, char *name);
-
     /* Proxy Module check */
 static int is_proxy_available(server_rec *s);
 
Index: test/vhtest/bin/test1
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/test/vhtest/bin/test1,v
retrieving revision 1.1
diff -u -r1.1 test1
--- test1	1997/11/10 02:11:42	1.1
+++ test1	1998/03/01 21:43:53
@@ -1,15 +1,29 @@
-bin/vhget 127.0.0.1 8080 '' vhost1
-bin/vhget 127.0.0.1 8080 vhost1:8080 vhost1
-bin/vhget 127.0.0.1 8080 vhost2:8080 vhost1
+bin/vhget 127.0.0.1 8080 '' '' vhost1
+bin/vhget 127.0.0.1 8080 vhost1:8080 '' vhost1
+bin/vhget 127.0.0.1 8080 vhost2:8080 '' vhost1
+bin/vhget 127.0.0.1 8080 vhost1:8080 'vhost1:8080' vhost1
+bin/vhget 127.0.0.1 8080 vhost1:8080 'vhost2:8080' vhost1
+bin/vhget 127.0.0.1 8080 vhost2:8080 'vhost2:8080' vhost1
+bin/vhget 127.0.0.1 8080 vhost2:8080 'vhost1:8080' vhost1
 
-bin/vhget 127.0.0.2 8080 '' vhost2
-bin/vhget 127.0.0.2 8080 vhost2:8080 vhost2
-bin/vhget 127.0.0.2 8080 vhost1:8080 vhost2
+bin/vhget 127.0.0.2 8080 '' '' vhost2
+bin/vhget 127.0.0.2 8080 vhost2:8080 '' vhost2
+bin/vhget 127.0.0.2 8080 vhost1:8080 '' vhost2
+bin/vhget 127.0.0.2 8080 vhost1:8080 'vhost1:8080' vhost2
+bin/vhget 127.0.0.2 8080 vhost1:8080 'vhost2:8080' vhost2
+bin/vhget 127.0.0.2 8080 vhost2:8080 'vhost2:8080' vhost2
+bin/vhget 127.0.0.2 8080 vhost2:8080 'vhost1:8080' vhost2
 
-bin/vhget 127.0.0.3 8080 '' vhost3
-bin/vhget 127.0.0.3 8080 vhost3:8080 vhost3
-bin/vhget 127.0.0.3 8080 vhost4:8080 vhost4
+bin/vhget 127.0.0.3 8080 '' '' vhost3
+bin/vhget 127.0.0.3 8080 vhost3:8080 '' vhost3
+bin/vhget 127.0.0.3 8080 vhost3:8080 'vhost3:8080' vhost3
+bin/vhget 127.0.0.3 8080 vhost3:8080 'vhost4:8080' vhost4
+bin/vhget 127.0.0.3 8080 vhost4:8080 '' vhost4
+bin/vhget 127.0.0.3 8080 vhost4:8080 'vhost3:8080' vhost3
+bin/vhget 127.0.0.3 8080 vhost4:8080 'vhost4:8080' vhost4
 
-bin/vhget 127.0.0.4 8080 '' main
-bin/vhget 127.0.0.4 8080 'vhost1' main
-bin/vhget 127.0.0.4 8080 'vhost2' main
+bin/vhget 127.0.0.4 8080 '' '' main
+bin/vhget 127.0.0.4 8080 'vhost1' '' main
+bin/vhget 127.0.0.4 8080 'vhost1' 'vhost1:8080' main
+bin/vhget 127.0.0.4 8080 'vhost2' '' main
+bin/vhget 127.0.0.4 8080 'vhost2' 'vhost2:8080' main
Index: test/vhtest/bin/test1d
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/test/vhtest/bin/test1d,v
retrieving revision 1.1
diff -u -r1.1 test1d
--- test1d	1997/11/10 02:11:42	1.1
+++ test1d	1998/03/01 21:43:53
@@ -1,15 +1,29 @@
-bin/vhget 127.0.0.1 8080 '' vhost1
-bin/vhget 127.0.0.1 8080 vhost1:8080 vhost1
-bin/vhget 127.0.0.1 8080 vhost2:8080 vhost1
+bin/vhget 127.0.0.1 8080 '' '' vhost1
+bin/vhget 127.0.0.1 8080 vhost1:8080 '' vhost1
+bin/vhget 127.0.0.1 8080 vhost2:8080 '' vhost1
+bin/vhget 127.0.0.1 8080 vhost1:8080 'vhost1:8080' vhost1
+bin/vhget 127.0.0.1 8080 vhost1:8080 'vhost2:8080' vhost1
+bin/vhget 127.0.0.1 8080 vhost2:8080 'vhost2:8080' vhost1
+bin/vhget 127.0.0.1 8080 vhost2:8080 'vhost1:8080' vhost1
 
-bin/vhget 127.0.0.2 8080 '' vhost2
-bin/vhget 127.0.0.2 8080 vhost2:8080 vhost2
-bin/vhget 127.0.0.2 8080 vhost1:8080 vhost2
+bin/vhget 127.0.0.2 8080 '' '' vhost2
+bin/vhget 127.0.0.2 8080 vhost2:8080 '' vhost2
+bin/vhget 127.0.0.2 8080 vhost1:8080 '' vhost2
+bin/vhget 127.0.0.2 8080 vhost1:8080 'vhost1:8080' vhost2
+bin/vhget 127.0.0.2 8080 vhost1:8080 'vhost2:8080' vhost2
+bin/vhget 127.0.0.2 8080 vhost2:8080 'vhost2:8080' vhost2
+bin/vhget 127.0.0.2 8080 vhost2:8080 'vhost1:8080' vhost2
 
-bin/vhget 127.0.0.3 8080 '' vhost3
-bin/vhget 127.0.0.3 8080 vhost3:8080 vhost3
-bin/vhget 127.0.0.3 8080 vhost4:8080 vhost4
+bin/vhget 127.0.0.3 8080 '' '' vhost3
+bin/vhget 127.0.0.3 8080 vhost3:8080 '' vhost3
+bin/vhget 127.0.0.3 8080 vhost3:8080 'vhost3:8080' vhost3
+bin/vhget 127.0.0.3 8080 vhost3:8080 'vhost4:8080' vhost4
+bin/vhget 127.0.0.3 8080 vhost4:8080 '' vhost4
+bin/vhget 127.0.0.3 8080 vhost4:8080 'vhost3:8080' vhost3
+bin/vhget 127.0.0.3 8080 vhost4:8080 'vhost4:8080' vhost4
 
-bin/vhget 127.0.0.4 8080 '' default1
-bin/vhget 127.0.0.4 8080 'vhost1' default1
-bin/vhget 127.0.0.4 8080 'vhost2' default1
+bin/vhget 127.0.0.4 8080 '' '' default1
+bin/vhget 127.0.0.4 8080 'vhost1' '' default1
+bin/vhget 127.0.0.4 8080 'vhost1' 'vhost1:8080' default1
+bin/vhget 127.0.0.4 8080 'vhost2' '' default1
+bin/vhget 127.0.0.4 8080 'vhost2' 'vhost2:8080' default1
Index: test/vhtest/bin/test2
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/test/vhtest/bin/test2,v
retrieving revision 1.1
diff -u -r1.1 test2
--- test2	1997/11/10 02:11:43	1.1
+++ test2	1998/03/01 21:43:54
@@ -1,28 +1,45 @@
-bin/vhget 127.0.0.1 8080 '' vhost1
-bin/vhget 127.0.0.1 8080 vhost1:8080 vhost1
-bin/vhget 127.0.0.1 8080 vhost2:8080 vhost1
+bin/vhget 127.0.0.1 8080 '' '' vhost1
+bin/vhget 127.0.0.1 8080 vhost1:8080 '' vhost1
+bin/vhget 127.0.0.1 8080 vhost2:8080 'vhost1:8080' vhost1
+bin/vhget 127.0.0.1 8080 vhost2:8080 '' vhost1
+bin/vhget 127.0.0.1 8080 vhost1:8080 'vhost2:8080' vhost1
 
-bin/vhget 127.0.0.1 8081 '' vhost2
-bin/vhget 127.0.0.1 8081 vhost2:8081 vhost2
-bin/vhget 127.0.0.1 8081 vhost1:8081 vhost2
+bin/vhget 127.0.0.1 8081 '' '' vhost2
+bin/vhget 127.0.0.1 8081 vhost2:8081 '' vhost2
+bin/vhget 127.0.0.1 8081 vhost1:8081 'vhost2:8081' vhost2
+bin/vhget 127.0.0.1 8081 vhost1:8081 '' vhost2
+bin/vhget 127.0.0.1 8081 vhost2:8081 'vhost1:8081' vhost2
 
-bin/vhget 127.0.0.2 8080 '' vhost3
-bin/vhget 127.0.0.2 8080 vhost3:8080 vhost3
-bin/vhget 127.0.0.2 8080 vhost1:8080 vhost3
-bin/vhget 127.0.0.2 8081 '' vhost3
-bin/vhget 127.0.0.2 8081 vhost3:8081 vhost3
-bin/vhget 127.0.0.2 8081 vhost1:8081 vhost3
+bin/vhget 127.0.0.2 8080 '' '' vhost3
+bin/vhget 127.0.0.2 8080 vhost3:8080 '' vhost3
+bin/vhget 127.0.0.2 8080 vhost1:8080 'vhost3:8080' vhost3
+bin/vhget 127.0.0.2 8080 vhost1:8080 '' vhost3
+bin/vhget 127.0.0.2 8080 vhost3:8080 'vhost1:8080' vhost3
+bin/vhget 127.0.0.2 8081 '' '' vhost3
+bin/vhget 127.0.0.2 8081 vhost3:8081 '' vhost3
+bin/vhget 127.0.0.2 8081 vhost3:8081 'vhost1:8081' vhost3
+bin/vhget 127.0.0.2 8081 vhost1:8081 '' vhost3
+bin/vhget 127.0.0.2 8081 vhost1:8081 'vhost3:8081' vhost3
 
-bin/vhget 127.0.0.3 8080 '' vhost4
-bin/vhget 127.0.0.3 8080 'vhost4:8080' vhost4
-bin/vhget 127.0.0.3 8080 'vhost5:8080' vhost5
+bin/vhget 127.0.0.3 8080 '' '' vhost4
+bin/vhget 127.0.0.3 8080 'vhost4:8080' '' vhost4
+bin/vhget 127.0.0.3 8080 'vhost5:8080' 'vhost4:8080' vhost4
+bin/vhget 127.0.0.3 8080 'vhost5:8080' 'bogus:8080' vhost4
+bin/vhget 127.0.0.3 8080 'vhost5:8080' '' vhost5
+bin/vhget 127.0.0.3 8080 'vhost4:8080' 'vhost5:8080' vhost5
 
-bin/vhget 127.0.0.3 8081 '' vhost5
-bin/vhget 127.0.0.3 8081 'vhost4:8081' vhost5
-bin/vhget 127.0.0.3 8081 'vhost5:8081' vhost5
-bin/vhget 127.0.0.3 8081 'alt5:8081' vhost5
+bin/vhget 127.0.0.3 8081 '' '' vhost5
+bin/vhget 127.0.0.3 8081 'vhost4:8081' '' vhost5
+bin/vhget 127.0.0.3 8081 'vhost4:8081' 'vhost4:8081' vhost5
+bin/vhget 127.0.0.3 8081 'vhost4:8081' 'bogus:8081' vhost5
+bin/vhget 127.0.0.3 8081 'vhost4:8081' 'alt5:8081' vhost5
+bin/vhget 127.0.0.3 8081 'vhost5:8081' '' vhost5
+bin/vhget 127.0.0.3 8081 'alt5:8081' '' vhost5
 
-bin/vhget 127.0.0.4 8080 '' main
-bin/vhget 127.0.0.4 8080 'vhost1:8080' main
-bin/vhget 127.0.0.4 8081 '' main
-bin/vhget 127.0.0.4 8081 'vhost1:8081' main
+bin/vhget 127.0.0.4 8080 '' '' main
+bin/vhget 127.0.0.4 8080 'asdf' 'bogus' main
+bin/vhget 127.0.0.4 8080 'vhost1:8080' '' main
+bin/vhget 127.0.0.4 8080 'vhost1:8080' 'vhost2:8081' main
+bin/vhget 127.0.0.4 8081 '' '' main
+bin/vhget 127.0.0.4 8081 'asdf' 'bogus:8080' main
+bin/vhget 127.0.0.4 8081 'vhost1:8081' '' main
Index: test/vhtest/bin/test2d
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/test/vhtest/bin/test2d,v
retrieving revision 1.1
diff -u -r1.1 test2d
--- test2d	1997/11/10 02:11:43	1.1
+++ test2d	1998/03/01 21:43:54
@@ -1,28 +1,45 @@
-bin/vhget 127.0.0.1 8080 '' vhost1
-bin/vhget 127.0.0.1 8080 vhost1:8080 vhost1
-bin/vhget 127.0.0.1 8080 vhost2:8080 vhost1
+bin/vhget 127.0.0.1 8080 '' '' vhost1
+bin/vhget 127.0.0.1 8080 vhost1:8080 '' vhost1
+bin/vhget 127.0.0.1 8080 vhost2:8080 'vhost1:8080' vhost1
+bin/vhget 127.0.0.1 8080 vhost2:8080 '' vhost1
+bin/vhget 127.0.0.1 8080 vhost1:8080 'vhost2:8080' vhost1
 
-bin/vhget 127.0.0.1 8081 '' vhost2
-bin/vhget 127.0.0.1 8081 vhost2:8081 vhost2
-bin/vhget 127.0.0.1 8081 vhost1:8081 vhost2
+bin/vhget 127.0.0.1 8081 '' '' vhost2
+bin/vhget 127.0.0.1 8081 vhost2:8081 '' vhost2
+bin/vhget 127.0.0.1 8081 vhost1:8081 'vhost2:8081' vhost2
+bin/vhget 127.0.0.1 8081 vhost1:8081 '' vhost2
+bin/vhget 127.0.0.1 8081 vhost2:8081 'vhost1:8081' vhost2
 
-bin/vhget 127.0.0.2 8080 '' vhost3
-bin/vhget 127.0.0.2 8080 vhost3:8080 vhost3
-bin/vhget 127.0.0.2 8080 vhost1:8080 vhost3
-bin/vhget 127.0.0.2 8081 '' vhost3
-bin/vhget 127.0.0.2 8081 vhost3:8081 vhost3
-bin/vhget 127.0.0.2 8081 vhost1:8081 vhost3
+bin/vhget 127.0.0.2 8080 '' '' vhost3
+bin/vhget 127.0.0.2 8080 vhost3:8080 '' vhost3
+bin/vhget 127.0.0.2 8080 vhost1:8080 'vhost3:8080' vhost3
+bin/vhget 127.0.0.2 8080 vhost1:8080 '' vhost3
+bin/vhget 127.0.0.2 8080 vhost3:8080 'vhost1:8080' vhost3
+bin/vhget 127.0.0.2 8081 '' '' vhost3
+bin/vhget 127.0.0.2 8081 vhost3:8081 '' vhost3
+bin/vhget 127.0.0.2 8081 vhost3:8081 'vhost1:8081' vhost3
+bin/vhget 127.0.0.2 8081 vhost1:8081 '' vhost3
+bin/vhget 127.0.0.2 8081 vhost1:8081 'vhost3:8081' vhost3
 
-bin/vhget 127.0.0.3 8080 '' vhost4
-bin/vhget 127.0.0.3 8080 'vhost4:8080' vhost4
-bin/vhget 127.0.0.3 8080 'vhost5:8080' vhost5
+bin/vhget 127.0.0.3 8080 '' '' vhost4
+bin/vhget 127.0.0.3 8080 'vhost4:8080' '' vhost4
+bin/vhget 127.0.0.3 8080 'vhost5:8080' 'vhost4:8080' vhost4
+bin/vhget 127.0.0.3 8080 'vhost5:8080' 'bogus:8080' vhost4
+bin/vhget 127.0.0.3 8080 'vhost5:8080' '' vhost5
+bin/vhget 127.0.0.3 8080 'vhost4:8080' 'vhost5:8080' vhost5
 
-bin/vhget 127.0.0.3 8081 '' vhost5
-bin/vhget 127.0.0.3 8081 'vhost4:8081' vhost5
-bin/vhget 127.0.0.3 8081 'vhost5:8081' vhost5
-bin/vhget 127.0.0.3 8081 'alt5:8081' vhost5
+bin/vhget 127.0.0.3 8081 '' '' vhost5
+bin/vhget 127.0.0.3 8081 'vhost4:8081' '' vhost5
+bin/vhget 127.0.0.3 8081 'vhost4:8081' 'vhost4:8081' vhost5
+bin/vhget 127.0.0.3 8081 'vhost4:8081' 'bogus:8081' vhost5
+bin/vhget 127.0.0.3 8081 'vhost4:8081' 'alt5:8081' vhost5
+bin/vhget 127.0.0.3 8081 'vhost5:8081' '' vhost5
+bin/vhget 127.0.0.3 8081 'alt5:8081' '' vhost5
 
-bin/vhget 127.0.0.4 8080 '' default1
-bin/vhget 127.0.0.4 8080 'vhost1:8080' default1
-bin/vhget 127.0.0.4 8081 '' default2
-bin/vhget 127.0.0.4 8081 'vhost1:8081' default2
+bin/vhget 127.0.0.4 8080 '' '' default1
+bin/vhget 127.0.0.4 8080 'asdf' 'bogus' default1
+bin/vhget 127.0.0.4 8080 'vhost1:8080' '' default1
+bin/vhget 127.0.0.4 8080 'vhost1:8080' 'vhost2:8081' default1
+bin/vhget 127.0.0.4 8081 '' '' default2
+bin/vhget 127.0.0.4 8081 'asdf' 'bogus:8080' default2
+bin/vhget 127.0.0.4 8081 'vhost1:8081' '' default2
Index: test/vhtest/bin/test3
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/test/vhtest/bin/test3,v
retrieving revision 1.1
diff -u -r1.1 test3
--- test3	1997/11/10 02:11:43	1.1
+++ test3	1998/03/01 21:43:54
@@ -1,13 +1,18 @@
-bin/vhget 127.0.0.1 8080 '' vhost1
-bin/vhget 127.0.0.1 8080 vhost1:8080 vhost1
-bin/vhget 127.0.0.1 8080 vhost2:8080 vhost2
-bin/vhget 127.0.0.1 8080 vhost3:8080 vhost3
-bin/vhget 127.0.0.1 8080 vhost4:8080 vhost1
-bin/vhget 127.0.0.1 8080 vhost5:8080 vhost5
+bin/vhget 127.0.0.1 8080 '' '' vhost1
+bin/vhget 127.0.0.1 8080 vhost1:8080 '' vhost1
+bin/vhget 127.0.0.1 8080 vhost2:8080 'vhost1:8080' vhost1
+bin/vhget 127.0.0.1 8080 vhost2:8080 'vhost1:8080' vhost1
+bin/vhget 127.0.0.1 8080 vhost2:8080 '' vhost2
+bin/vhget 127.0.0.1 8080 vhost1:8080 'vhost2:8080' vhost2
+bin/vhget 127.0.0.1 8080 vhost3:8080 '' vhost3
+bin/vhget 127.0.0.1 8080 vhost4:8080 '' vhost1
+bin/vhget 127.0.0.1 8080 vhost5:8080 'vhost4:8080' vhost1
+bin/vhget 127.0.0.1 8080 vhost5:8080 '' vhost5
 
-bin/vhget 127.0.0.1 8081 '' vhost2
-bin/vhget 127.0.0.1 8081 vhost1:8081 vhost2
-bin/vhget 127.0.0.1 8081 vhost2:8081 vhost2
-bin/vhget 127.0.0.1 8081 vhost3:8081 vhost3
-bin/vhget 127.0.0.1 8081 vhost4:8081 vhost4
-bin/vhget 127.0.0.1 8081 vhost5:8081 vhost5
+bin/vhget 127.0.0.1 8081 '' '' vhost2
+bin/vhget 127.0.0.1 8081 vhost1:8081 '' vhost2
+bin/vhget 127.0.0.1 8081 vhost3:8081 'vhost1:8081' vhost2
+bin/vhget 127.0.0.1 8081 vhost2:8081 '' vhost2
+bin/vhget 127.0.0.1 8081 vhost3:8081 '' vhost3
+bin/vhget 127.0.0.1 8081 vhost4:8081 '' vhost4
+bin/vhget 127.0.0.1 8081 vhost5:8081 '' vhost5
Index: test/vhtest/bin/test4
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/test/vhtest/bin/test4,v
retrieving revision 1.1
diff -u -r1.1 test4
--- test4	1997/11/10 02:11:44	1.1
+++ test4	1998/03/01 21:43:54
@@ -1,9 +1,13 @@
-bin/vhget 127.0.0.1 8080 '' vhost1
-bin/vhget 127.0.0.1 8080 vhost1:8080 vhost1
-bin/vhget 127.0.0.1 8080 vhost2:8080 vhost2
-bin/vhget 127.0.0.1 8080 vhost3:8080 vhost1
+bin/vhget 127.0.0.1 8080 '' '' vhost1
+bin/vhget 127.0.0.1 8080 vhost1:8080 '' vhost1
+bin/vhget 127.0.0.1 8080 vhost2:8080 'vhost1:8080' vhost1
+bin/vhget 127.0.0.1 8080 vhost2:8080 'vhost3:8080' vhost1
+bin/vhget 127.0.0.1 8080 vhost2:8080 '' vhost2
+bin/vhget 127.0.0.1 8080 vhost3:8080 '' vhost1
 
-bin/vhget 127.0.0.1 8081 '' vhost1
-bin/vhget 127.0.0.1 8081 vhost1:8081 vhost1
-bin/vhget 127.0.0.1 8081 vhost2:8081 vhost2
-bin/vhget 127.0.0.1 8081 vhost3:8081 vhost1
+bin/vhget 127.0.0.1 8081 '' '' vhost1
+bin/vhget 127.0.0.1 8081 vhost1:8081 '' vhost1
+bin/vhget 127.0.0.1 8081 vhost2:8081 'vhost1:8081' vhost1
+bin/vhget 127.0.0.1 8081 vhost2:8081 'vhost3:8081' vhost1
+bin/vhget 127.0.0.1 8081 vhost2:8081 '' vhost2
+bin/vhget 127.0.0.1 8081 vhost3:8081 '' vhost1
Index: test/vhtest/bin/test5
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/test/vhtest/bin/test5,v
retrieving revision 1.1
diff -u -r1.1 test5
--- test5	1997/11/10 02:11:44	1.1
+++ test5	1998/03/01 21:43:54
@@ -1,23 +1,31 @@
-bin/vhget 127.0.0.1 8080 '' vhost1
-bin/vhget 127.0.0.1 8080 vhost1:8080 vhost1
-bin/vhget 127.0.0.1 8080 vhost2:8080 vhost2
-bin/vhget 127.0.0.1 8080 vhost3:8080 vhost1
+bin/vhget 127.0.0.1 8080 '' '' vhost1
+bin/vhget 127.0.0.1 8080 vhost1:8080 '' vhost1
+bin/vhget 127.0.0.1 8080 vhost2:8080 'bogus' vhost1
+bin/vhget 127.0.0.1 8080 vhost2:8080 'vhost1:8080' vhost1
+bin/vhget 127.0.0.1 8080 vhost2:8080 '' vhost2
+bin/vhget 127.0.0.1 8080 vhost1:8080 'vhost2:8080' vhost2
+bin/vhget 127.0.0.1 8080 vhost3:8080 '' vhost1
 
-bin/vhget 127.0.0.2 8080 '' vhost3
-bin/vhget 127.0.0.2 8080 'vhost3:8080' vhost3
-bin/vhget 127.0.0.2 8080 'vhost1:8080' vhost3
+bin/vhget 127.0.0.2 8080 '' '' vhost3
+bin/vhget 127.0.0.2 8080 'vhost3:8080' '' vhost3
+bin/vhget 127.0.0.2 8080 'vhost1:8080' 'bogus' vhost3
+bin/vhget 127.0.0.2 8080 'vhost1:8080' '' vhost3
 
-bin/vhget 127.0.0.3 8080 '' default1
-bin/vhget 127.0.0.3 8080 'vhost1:8080' default1
+bin/vhget 127.0.0.3 8080 '' '' default1
+bin/vhget 127.0.0.3 8080 'vhost1:8080' '' default1
+bin/vhget 127.0.0.3 8080 'asdf' 'bogus' default1
 
-bin/vhget 127.0.0.1 8081 '' vhost4
-bin/vhget 127.0.0.1 8081 vhost1:8081 vhost4
-bin/vhget 127.0.0.1 8081 vhost2:8081 vhost4
-bin/vhget 127.0.0.1 8081 vhost3:8081 vhost4
+bin/vhget 127.0.0.1 8081 '' '' vhost4
+bin/vhget 127.0.0.1 8081 vhost1:8081 '' vhost4
+bin/vhget 127.0.0.1 8081 vhost2:8081 'vhost1:8080' vhost4
+bin/vhget 127.0.0.1 8081 vhost2:8081 '' vhost4
+bin/vhget 127.0.0.1 8081 vhost3:8081 '' vhost4
 
-bin/vhget 127.0.0.2 8081 '' vhost5
-bin/vhget 127.0.0.2 8081 'vhost3:8081' vhost5
-bin/vhget 127.0.0.2 8081 'vhost1:8081' vhost5
+bin/vhget 127.0.0.2 8081 '' '' vhost5
+bin/vhget 127.0.0.2 8081 'vhost3:8081' '' vhost5
+bin/vhget 127.0.0.2 8081 'vhost1:8081' 'vhost3:8081' vhost5
+bin/vhget 127.0.0.2 8081 'vhost1:8081' '' vhost5
 
-bin/vhget 127.0.0.3 8081 '' default2
-bin/vhget 127.0.0.3 8081 'vhost1:8081' default2
+bin/vhget 127.0.0.3 8081 '' '' default2
+bin/vhget 127.0.0.3 8081 'bogus' 'asdf' default2
+bin/vhget 127.0.0.3 8081 'vhost1:8081' '' default2
Index: test/vhtest/bin/vhget
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/test/vhtest/bin/vhget,v
retrieving revision 1.1
diff -u -r1.1 vhget
--- vhget	1997/11/10 02:11:45	1.1
+++ vhget	1998/03/01 21:43:54
@@ -4,18 +4,20 @@
 use strict;
 use Socket;
 
-# vhget ipaddr port hostheader expect
+# vhget ipaddr port hostheader absurihost expect
 
-$#ARGV == 3 || die "usage: $0 ipaddr port hostheader expect\n";
+$#ARGV == 4 || die "usage: $0 ipaddr port hostheader absurihost expect\n";
 
 my ($remote,$port, $iaddr, $paddr, $proto, $line);
 
-$remote = shift;
-$port = shift;
-my $hostheader = shift;
-my $expect = shift;
+my ($hostheader, $expect, $absurihost);
 
-printf "%-20s %-20s %-15s: ", "$remote:$port", "'$hostheader'", "'$expect'";
+($remote, $port, $hostheader, $absurihost, $expect) = @ARGV;
+if ($absurihost ne '') {
+    $absurihost = "http://$absurihost";
+}
+
+printf "%-20s %-20s %-20s %-15s: ", "$remote:$port", "'$hostheader'", "'$absurihost'", "'$expect'";
 
 if ($port =~ /\D/) {
     $port = getservbyname($port, 'tcp');
@@ -29,16 +31,18 @@
 
 my $oldfh = select(SOCK); $| = 1; select($oldfh);
 
+$proto = ($absurihost ne '') ? "HTTP/1.1" : "HTTP/1.0";
+
 if ($hostheader ne '') {
     print SOCK <<EOR;
-GET /vhost.txt HTTP/1.0\r
+GET $absurihost/vhost.txt $proto\r
 Host: $hostheader\r
 Connection: close\r
 \r
 EOR
 } else {
     print SOCK <<EOR;
-GET /vhost.txt HTTP/1.0\r
+GET $absurihost/vhost.txt $proto\r
 Connection: close\r
 \r
 EOR
@@ -56,8 +60,9 @@
 
 chomp($line);
 
-my $death = "$remote:$port with " .
-	( $hostheader eq '' ? "no Host:" : "Host: $hostheader" )
+my $death = "$remote:$port with "
+	. ( $hostheader eq '' ? "no Host:" : "Host: $hostheader" )
+	. ( $absurihost eq '' ? " no absuri" : " and absuri $absurihost" )
 	. " expected $expect, but got $line\n";
 if ($line eq $expect) {
     print "passed\n";
Index: test/vhtest/conf/common.conf
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/test/vhtest/conf/common.conf,v
retrieving revision 1.3
diff -u -r1.3 common.conf
--- common.conf	1998/02/08 22:51:24	1.3
+++ common.conf	1998/03/01 21:43:54
@@ -3,7 +3,7 @@
 HostnameLookups off
 User nobody
 Group #-1
-ServerRoot /home/dgaudet/ap/vhtest
+ServerRoot /home/dgaudet/ap/apachen6/src/test/vhtest
 ErrorLog logs/error_log
 LogLevel debug
 # vhost "Host header" "request" response-code
@@ -13,7 +13,7 @@
 ResourceConfig /dev/null
 AccessConfig /dev/null
 ServerName main
-DocumentRoot /home/dgaudet/ap/vhtest/docroot/main
+DocumentRoot /home/dgaudet/ap/apachen6/src/test/vhtest/docroot/main
 
 <Directory />
 AllowOverride none
Index: test/vhtest/conf/test1.conf
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/test/vhtest/conf/test1.conf,v
retrieving revision 1.3
diff -u -r1.3 test1.conf
--- test1.conf	1998/02/08 22:51:24	1.3
+++ test1.conf	1998/03/01 21:43:54
@@ -1,6 +1,6 @@
 ## test some basic ip-vhosts and a single name-vhost address
 
-Include /home/dgaudet/ap/vhtest/conf/common.conf
+Include /home/dgaudet/ap/apachen6/src/test/vhtest/conf/common.conf
 
 #Listen 127.0.0.1:8080
 #Listen 127.0.0.2:8080
@@ -9,20 +9,20 @@
 
 <VirtualHost 127.0.0.1:8080>
 ServerName vhost1
-DocumentRoot /home/dgaudet/ap/vhtest/docroot/vhost1
+DocumentRoot /home/dgaudet/ap/apachen6/src/test/vhtest/docroot/vhost1
 </VirtualHost>
 
 <VirtualHost 127.0.0.2:8080>
 ServerName vhost2
-DocumentRoot /home/dgaudet/ap/vhtest/docroot/vhost2
+DocumentRoot /home/dgaudet/ap/apachen6/src/test/vhtest/docroot/vhost2
 </VirtualHost>
 
 <VirtualHost 127.0.0.3:8080>
 ServerName vhost3
-DocumentRoot /home/dgaudet/ap/vhtest/docroot/vhost3
+DocumentRoot /home/dgaudet/ap/apachen6/src/test/vhtest/docroot/vhost3
 </VirtualHost>
 
 <VirtualHost 127.0.0.3:8080>
 ServerName vhost4
-DocumentRoot /home/dgaudet/ap/vhtest/docroot/vhost4
+DocumentRoot /home/dgaudet/ap/apachen6/src/test/vhtest/docroot/vhost4
 </VirtualHost>
Index: test/vhtest/conf/test1d.conf
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/test/vhtest/conf/test1d.conf,v
retrieving revision 1.3
diff -u -r1.3 test1d.conf
--- test1d.conf	1998/02/08 22:51:25	1.3
+++ test1d.conf	1998/03/01 21:43:54
@@ -1,6 +1,6 @@
 ## same as test1, but we throw in a _default_
 
-Include /home/dgaudet/ap/vhtest/conf/common.conf
+Include /home/dgaudet/ap/apachen6/src/test/vhtest/conf/common.conf
 
 #Listen 127.0.0.1:8080
 #Listen 127.0.0.2:8080
@@ -9,25 +9,25 @@
 
 <VirtualHost 127.0.0.1:8080>
 ServerName vhost1
-DocumentRoot /home/dgaudet/ap/vhtest/docroot/vhost1
+DocumentRoot /home/dgaudet/ap/apachen6/src/test/vhtest/docroot/vhost1
 </VirtualHost>
 
 <VirtualHost 127.0.0.2:8080>
 ServerName vhost2
-DocumentRoot /home/dgaudet/ap/vhtest/docroot/vhost2
+DocumentRoot /home/dgaudet/ap/apachen6/src/test/vhtest/docroot/vhost2
 </VirtualHost>
 
 <VirtualHost 127.0.0.3:8080>
 ServerName vhost3
-DocumentRoot /home/dgaudet/ap/vhtest/docroot/vhost3
+DocumentRoot /home/dgaudet/ap/apachen6/src/test/vhtest/docroot/vhost3
 </VirtualHost>
 
 <VirtualHost 127.0.0.3:8080>
 ServerName vhost4
-DocumentRoot /home/dgaudet/ap/vhtest/docroot/vhost4
+DocumentRoot /home/dgaudet/ap/apachen6/src/test/vhtest/docroot/vhost4
 </VirtualHost>
 
 <VirtualHost _default_:8080>
 ServerName default1
-DocumentRoot /home/dgaudet/ap/vhtest/docroot/default1
+DocumentRoot /home/dgaudet/ap/apachen6/src/test/vhtest/docroot/default1
 </VirtualHost>
Index: test/vhtest/conf/test2.conf
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/test/vhtest/conf/test2.conf,v
retrieving revision 1.3
diff -u -r1.3 test2.conf
--- test2.conf	1998/02/08 22:51:25	1.3
+++ test2.conf	1998/03/01 21:43:54
@@ -1,7 +1,7 @@
 ## test more complex ip-vhosts with multiple ports, and name-vhosts on a
 ## single port of one ip
 
-Include /home/dgaudet/ap/vhtest/conf/common.conf
+Include /home/dgaudet/ap/apachen6/src/test/vhtest/conf/common.conf
 
 Listen *:8080
 Listen *:8081
@@ -10,26 +10,26 @@
 
 <VirtualHost 127.0.0.1:8080>
 ServerName vhost1
-DocumentRoot /home/dgaudet/ap/vhtest/docroot/vhost1
+DocumentRoot /home/dgaudet/ap/apachen6/src/test/vhtest/docroot/vhost1
 </VirtualHost>
 
 <VirtualHost 127.0.0.1:8081>
 ServerName vhost2
-DocumentRoot /home/dgaudet/ap/vhtest/docroot/vhost2
+DocumentRoot /home/dgaudet/ap/apachen6/src/test/vhtest/docroot/vhost2
 </VirtualHost>
 
 <VirtualHost 127.0.0.2:*>
 ServerName vhost3
-DocumentRoot /home/dgaudet/ap/vhtest/docroot/vhost3
+DocumentRoot /home/dgaudet/ap/apachen6/src/test/vhtest/docroot/vhost3
 </VirtualHost>
 
 <VirtualHost 127.0.0.3:8080>
 ServerName vhost4
-DocumentRoot /home/dgaudet/ap/vhtest/docroot/vhost4
+DocumentRoot /home/dgaudet/ap/apachen6/src/test/vhtest/docroot/vhost4
 </VirtualHost>
 
 <VirtualHost 127.0.0.3:8080 127.0.0.3:8081>
 ServerName vhost5
 ServerAlias alt5
-DocumentRoot /home/dgaudet/ap/vhtest/docroot/vhost5
+DocumentRoot /home/dgaudet/ap/apachen6/src/test/vhtest/docroot/vhost5
 </VirtualHost>
Index: test/vhtest/conf/test2d.conf
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/test/vhtest/conf/test2d.conf,v
retrieving revision 1.3
diff -u -r1.3 test2d.conf
--- test2d.conf	1998/02/08 22:51:25	1.3
+++ test2d.conf	1998/03/01 21:43:54
@@ -1,6 +1,6 @@
 ## same as test2, but throw in a _default_ two port test
 
-Include /home/dgaudet/ap/vhtest/conf/common.conf
+Include /home/dgaudet/ap/apachen6/src/test/vhtest/conf/common.conf
 
 Listen *:8080
 Listen *:8081
@@ -9,37 +9,37 @@
 
 <VirtualHost 127.0.0.1:8080>
 ServerName vhost1
-DocumentRoot /home/dgaudet/ap/vhtest/docroot/vhost1
+DocumentRoot /home/dgaudet/ap/apachen6/src/test/vhtest/docroot/vhost1
 </VirtualHost>
 
 <VirtualHost 127.0.0.1:8081>
 ServerName vhost2
-DocumentRoot /home/dgaudet/ap/vhtest/docroot/vhost2
+DocumentRoot /home/dgaudet/ap/apachen6/src/test/vhtest/docroot/vhost2
 </VirtualHost>
 
 <VirtualHost 127.0.0.2:*>
 ServerName vhost3
-DocumentRoot /home/dgaudet/ap/vhtest/docroot/vhost3
+DocumentRoot /home/dgaudet/ap/apachen6/src/test/vhtest/docroot/vhost3
 </VirtualHost>
 
 <VirtualHost 127.0.0.3:8080>
 ServerName vhost4
-DocumentRoot /home/dgaudet/ap/vhtest/docroot/vhost4
+DocumentRoot /home/dgaudet/ap/apachen6/src/test/vhtest/docroot/vhost4
 </VirtualHost>
 
 <VirtualHost 127.0.0.3:8080 127.0.0.3:8081>
 ServerName vhost5
 ServerAlias alt5
-DocumentRoot /home/dgaudet/ap/vhtest/docroot/vhost5
+DocumentRoot /home/dgaudet/ap/apachen6/src/test/vhtest/docroot/vhost5
 </VirtualHost>
 
 <VirtualHost _default_:8080>
 ServerName default1
-DocumentRoot /home/dgaudet/ap/vhtest/docroot/default1
+DocumentRoot /home/dgaudet/ap/apachen6/src/test/vhtest/docroot/default1
 </VirtualHost>
 
 <VirtualHost _default_:*>
 ServerName default2
-DocumentRoot /home/dgaudet/ap/vhtest/docroot/default2
+DocumentRoot /home/dgaudet/ap/apachen6/src/test/vhtest/docroot/default2
 </VirtualHost>
 
Index: test/vhtest/conf/test3.conf
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/test/vhtest/conf/test3.conf,v
retrieving revision 1.3
diff -u -r1.3 test3.conf
--- test3.conf	1998/02/08 22:51:26	1.3
+++ test3.conf	1998/03/01 21:43:54
@@ -1,6 +1,6 @@
 ## multiple name-vhosts on multiple ports
 
-Include /home/dgaudet/ap/vhtest/conf/common.conf
+Include /home/dgaudet/ap/apachen6/src/test/vhtest/conf/common.conf
 
 Listen *:8080
 Listen *:8081
@@ -10,25 +10,25 @@
 
 <VirtualHost 127.0.0.1:8080>
 ServerName vhost1
-DocumentRoot /home/dgaudet/ap/vhtest/docroot/vhost1
+DocumentRoot /home/dgaudet/ap/apachen6/src/test/vhtest/docroot/vhost1
 </VirtualHost>
 
 <VirtualHost 127.0.0.1:8080 127.0.0.1:8081>
 ServerName vhost2
-DocumentRoot /home/dgaudet/ap/vhtest/docroot/vhost2
+DocumentRoot /home/dgaudet/ap/apachen6/src/test/vhtest/docroot/vhost2
 </VirtualHost>
 
 <VirtualHost 127.0.0.1:8080 127.0.0.1:8081>
 ServerName vhost3
-DocumentRoot /home/dgaudet/ap/vhtest/docroot/vhost3
+DocumentRoot /home/dgaudet/ap/apachen6/src/test/vhtest/docroot/vhost3
 </VirtualHost>
 
 <VirtualHost 127.0.0.1:8081>
 ServerName vhost4
-DocumentRoot /home/dgaudet/ap/vhtest/docroot/vhost4
+DocumentRoot /home/dgaudet/ap/apachen6/src/test/vhtest/docroot/vhost4
 </VirtualHost>
 
 <VirtualHost 127.0.0.1:8080 127.0.0.1:8081>
 ServerName vhost5
-DocumentRoot /home/dgaudet/ap/vhtest/docroot/vhost5
+DocumentRoot /home/dgaudet/ap/apachen6/src/test/vhtest/docroot/vhost5
 </VirtualHost>
Index: test/vhtest/conf/test4.conf
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/test/vhtest/conf/test4.conf,v
retrieving revision 1.3
diff -u -r1.3 test4.conf
--- test4.conf	1998/02/08 22:51:26	1.3
+++ test4.conf	1998/03/01 21:43:54
@@ -1,6 +1,6 @@
 ## wildcard namevhost address
 
-Include /home/dgaudet/ap/vhtest/conf/common.conf
+Include /home/dgaudet/ap/apachen6/src/test/vhtest/conf/common.conf
 
 Listen *:8080
 Listen *:8081
@@ -9,10 +9,10 @@
 
 <VirtualHost 127.0.0.1:*>
 ServerName vhost1
-DocumentRoot /home/dgaudet/ap/vhtest/docroot/vhost1
+DocumentRoot /home/dgaudet/ap/apachen6/src/test/vhtest/docroot/vhost1
 </VirtualHost>
 
 <VirtualHost 127.0.0.1:*>
 ServerName vhost2
-DocumentRoot /home/dgaudet/ap/vhtest/docroot/vhost2
+DocumentRoot /home/dgaudet/ap/apachen6/src/test/vhtest/docroot/vhost2
 </VirtualHost>
Index: test/vhtest/conf/test5.conf
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/test/vhtest/conf/test5.conf,v
retrieving revision 1.3
diff -u -r1.3 test5.conf
--- test5.conf	1998/02/08 22:51:27	1.3
+++ test5.conf	1998/03/01 21:43:54
@@ -1,7 +1,7 @@
 ## no ports listed, they should all default to 8080, but we're also listening
 ## on 8081
 
-Include /home/dgaudet/ap/vhtest/conf/common.conf
+Include /home/dgaudet/ap/apachen6/src/test/vhtest/conf/common.conf
 
 Listen 8080
 Listen 8081
@@ -10,35 +10,35 @@
 
 <VirtualHost 127.0.0.1>
 ServerName vhost1
-DocumentRoot /home/dgaudet/ap/vhtest/docroot/vhost1
+DocumentRoot /home/dgaudet/ap/apachen6/src/test/vhtest/docroot/vhost1
 </VirtualHost>
 
 <VirtualHost 127.0.0.1>
 ServerName vhost2
-DocumentRoot /home/dgaudet/ap/vhtest/docroot/vhost2
+DocumentRoot /home/dgaudet/ap/apachen6/src/test/vhtest/docroot/vhost2
 </VirtualHost>
 
 <VirtualHost 127.0.0.2>
 ServerName vhost3
-DocumentRoot /home/dgaudet/ap/vhtest/docroot/vhost3
+DocumentRoot /home/dgaudet/ap/apachen6/src/test/vhtest/docroot/vhost3
 </VirtualHost>
 
 <VirtualHost _default_>
 ServerName default1
-DocumentRoot /home/dgaudet/ap/vhtest/docroot/default1
+DocumentRoot /home/dgaudet/ap/apachen6/src/test/vhtest/docroot/default1
 </VirtualHost>
 
 <VirtualHost 127.0.0.1:8081>
 ServerName vhost4
-DocumentRoot /home/dgaudet/ap/vhtest/docroot/vhost4
+DocumentRoot /home/dgaudet/ap/apachen6/src/test/vhtest/docroot/vhost4
 </VirtualHost>
 
 <VirtualHost 127.0.0.2:8081>
 ServerName vhost5
-DocumentRoot /home/dgaudet/ap/vhtest/docroot/vhost5
+DocumentRoot /home/dgaudet/ap/apachen6/src/test/vhtest/docroot/vhost5
 </VirtualHost>
 
 <VirtualHost _default_:8081>
 ServerName default2
-DocumentRoot /home/dgaudet/ap/vhtest/docroot/default2
+DocumentRoot /home/dgaudet/ap/apachen6/src/test/vhtest/docroot/default2
 </VirtualHost>
Index: test/vhtest/conf/test6.conf
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/test/vhtest/conf/test6.conf,v
retrieving revision 1.3
diff -u -r1.3 test6.conf
--- test6.conf	1998/02/08 22:51:27	1.3
+++ test6.conf	1998/03/01 21:43:54
@@ -1,11 +1,11 @@
-Include /home/dgaudet/ap/vhtest/conf/common.conf
+Include /home/dgaudet/ap/apachen6/src/test/vhtest/conf/common.conf
 
 ## expect a warning about mixing * and non-* ports on vhost 127.0.0.1:8080
 NameVirtualHost 127.0.0.1:*
 
 <VirtualHost 127.0.0.1:8080>
 ServerName vhost1
-DocumentRoot /home/dgaudet/ap/vhtest/docroot/vhost1
+DocumentRoot /home/dgaudet/ap/apachen6/src/test/vhtest/docroot/vhost1
 </VirtualHost>
 
 ## expect a warning about mixing * and non-* ports on vhost 127.0.0.2:0
@@ -13,29 +13,29 @@
 
 <VirtualHost 127.0.0.2:*>
 ServerName vhost2
-DocumentRoot /home/dgaudet/ap/vhtest/docroot/vhost2
+DocumentRoot /home/dgaudet/ap/apachen6/src/test/vhtest/docroot/vhost2
 </VirtualHost>
 
 ## expect a warning about overlapping _default_ on port 8080
 <VirtualHost _default_>
 ServerName default1
-DocumentRoot /home/dgaudet/ap/vhtest/docroot/default1
+DocumentRoot /home/dgaudet/ap/apachen6/src/test/vhtest/docroot/default1
 </VirtualHost>
 
 <VirtualHost _default_:8080>
 ServerName default2
-DocumentRoot /home/dgaudet/ap/vhtest/docroot/default2
+DocumentRoot /home/dgaudet/ap/apachen6/src/test/vhtest/docroot/default2
 </VirtualHost>
 
 ## expect a warning about overlapping virtualhosts on 127.0.0.3:8080
 <VirtualHost 127.0.0.3>
 ServerName vhost3
-DocumentRoot /home/dgaudet/ap/vhtest/docroot/vhost3
+DocumentRoot /home/dgaudet/ap/apachen6/src/test/vhtest/docroot/vhost3
 </VirtualHost>
 
 <VirtualHost 127.0.0.3>
 ServerName vhost4
-DocumentRoot /home/dgaudet/ap/vhtest/docroot/vhost4
+DocumentRoot /home/dgaudet/ap/apachen6/src/test/vhtest/docroot/vhost4
 </VirtualHost>
 
 ## expect all warnings to be printed twice, and probably in the opposite


Mime
View raw message