dgaudet 98/03/26 13:27:47
Modified: src CHANGES http_protocol.c Log: Fixed a bug in URL parsing that caused a wrong decoding of URLs with empty paths. Submitted by: Alvaro Martínez Echevarría <[EMAIL PROTECTED]> Revision Changes Path 1.304 +4 -0 apache-1.2/src/CHANGES Index: CHANGES =================================================================== RCS file: /export/home/cvs/apache-1.2/src/CHANGES,v retrieving revision 1.303 retrieving revision 1.304 diff -u -r1.303 -r1.304 --- CHANGES 1998/03/26 19:24:11 1.303 +++ CHANGES 1998/03/26 21:27:44 1.304 @@ -1,5 +1,9 @@ Changes with Apache 1.2.7 + *) Fixed a bug in URL parsing that caused a wrong decoding of + URLs with empty paths. + [Alvaro Martínez Echevarría <[EMAIL PROTECTED]>] + *) PORT: Clean up undefined signals on SCO. [Dean Gaudet] *) After a SIGHUP the listening sockets in the parent weren't 1.133 +14 -2 apache-1.2/src/http_protocol.c Index: http_protocol.c =================================================================== RCS file: /export/home/cvs/apache-1.2/src/http_protocol.c,v retrieving revision 1.132 retrieving revision 1.133 diff -u -r1.132 -r1.133 --- http_protocol.c 1998/03/10 06:14:57 1.132 +++ http_protocol.c 1998/03/26 21:27:45 1.133 @@ -528,6 +528,12 @@ } else { r->proxyreq = 0; + /* If the uri is empty (""), then we have a "http://host[:port]" + * request, so we'll use "/" instead (RFC2068). + */ + if (!*uri) { + uri = pstrdup (r->pool, "/"); + } r->uri = getword (r->pool, &uri, '?'); #ifdef __EMX__ @@ -561,7 +567,9 @@ /* Find the hostname, assuming a valid request */ i = ind(name, '/'); - name[i] = '\0'; + if (i>=0) { + name[i] = '\0'; + } /* Find the port */ host = getword_nc(r->pool, &name, ':'); @@ -579,7 +587,11 @@ /* Save it for later use */ r->hostname = pstrdup(r->pool, host); - r->hostlen = 7 + i; + if (i>=0) { + r->hostlen = 7 + i; + } else { + r->hostlen = strlen(uri); + } /* The easy cases first */ if (!strcasecmp(host, r->server->server_hostname)) {