dgaudet 98/02/20 17:18:29
Modified: src CHANGES
src/main http_protocol.c
Log:
Fix "http://host1" without trailing /.
Revision Changes Path
1.645 +3 -0 apache-1.3/src/CHANGES
Index: CHANGES
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v
retrieving revision 1.644
retrieving revision 1.645
diff -u -r1.644 -r1.645
--- CHANGES 1998/02/21 00:50:39 1.644
+++ CHANGES 1998/02/21 01:18:25 1.645
@@ -1,5 +1,8 @@
Changes with Apache 1.3b6
+ *) Fix problems with absoluteURIs. [Dean Gaudet,
+ Alvaro Martinez Echevarria <[EMAIL PROTECTED]>]
+
*) Fix multiple UserDir problem introduced during 1.3b4-dev. [Dean Gaudet]
*) ap_cpystrn() had an off-by-1 error.
1.190 +10 -4 apache-1.3/src/main/http_protocol.c
Index: http_protocol.c
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/main/http_protocol.c,v
retrieving revision 1.189
retrieving revision 1.190
diff -u -r1.189 -r1.190
--- http_protocol.c 1998/02/18 11:59:20 1.189
+++ http_protocol.c 1998/02/21 01:18:28 1.190
@@ -628,6 +628,7 @@
char *host, *proto, *slash, *colon;
int plen;
unsigned port;
+ const char *res_uri;
/* This routine parses full URLs, if they match the server */
proto = http_method(r);
@@ -664,15 +665,20 @@
return uri;
/* Save it for later use */
- r->hostname = pstrdup(r->pool, host);
+ 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 (uri + r->hostlen);
+ return res_uri;
}
else if (!strcmp(host, inet_ntoa(r->connection->local_addr.sin_addr))) {
- return (uri + r->hostlen);
+ return res_uri;
}
else {
/* Now things get a bit trickier - check the IP address(es) of
@@ -685,7 +691,7 @@
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 (uri + r->hostlen);
+ return res_uri;
}
}
}