coar 98/11/05 12:11:30
Modified: src CHANGES
src/main http_request.c util.c
Log:
Fix some problems with the handling of UNC paths.
Submitted by: Ken Parzygnat <[EMAIL PROTECTED]>
Revision Changes Path
1.1136 +3 -0 apache-1.3/src/CHANGES
Index: CHANGES
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v
retrieving revision 1.1135
retrieving revision 1.1136
diff -u -r1.1135 -r1.1136
--- CHANGES 1998/11/05 20:07:48 1.1135
+++ CHANGES 1998/11/05 20:11:23 1.1136
@@ -1,5 +1,8 @@
Changes with Apache 1.3.4
+ *) Fix problems with handling of UNC names (e.g., \\host\path)
+ on Win32. [Ken Parzygnat <[EMAIL PROTECTED]>]
+
*) Rework os_canonical_*() on Win32 so it's simpler, more
robust, and works. [Ken Parzygnat <[EMAIL PROTECTED]>]
PR#2555, 2915, 3064, 3232
1.137 +26 -4 apache-1.3/src/main/http_request.c
Index: http_request.c
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/main/http_request.c,v
retrieving revision 1.136
retrieving revision 1.137
diff -u -r1.136 -r1.137
--- http_request.c 1998/11/05 20:07:52 1.136
+++ http_request.c 1998/11/05 20:11:27 1.137
@@ -180,6 +180,7 @@
int rv;
#ifdef WIN32
char buf[5];
+ BOOL bStripSlash=TRUE;
#endif
if (r->finfo.st_mode) {
@@ -198,12 +199,33 @@
path=buf;
end=buf+4;
}
-#endif
- /* Advance over trailing slashes ... NOT part of filename */
+ /* If UNC name == //machine/share/, do not
+ * advance over the trailing slash. Any other
+ * UNC name is OK to strip the slash.
+ */
+ cp = end;
+ if (strlen(path) > 2 && path[0] == '/' && path[1] == '/' &&
+ path[2] != '/' && cp[-1] == '/') {
+ char *p;
+ int iCount=0;
+ p = path;
+ while (p = strchr(p,'/')) {
+ p++;
+ iCount++;
+ }
+
+ if (iCount == 4)
+ bStripSlash = FALSE;
+ }
- for (cp = end; cp > path && cp[-1] == '/'; --cp)
- continue;
+ if (bStripSlash)
+#endif
+ /* Advance over trailing slashes ... NOT part of filename
+ * if file is not a UNC name (Win32 only).
+ */
+ for (cp = end; cp > path && cp[-1] == '/'; --cp)
+ continue;
while (cp > path) {
1.138 +7 -0 apache-1.3/src/main/util.c
Index: util.c
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/main/util.c,v
retrieving revision 1.137
retrieving revision 1.138
diff -u -r1.137 -r1.138
--- util.c 1998/10/24 15:10:48 1.137
+++ util.c 1998/11/05 20:11:27 1.138
@@ -424,6 +424,13 @@
char *d, *s;
s = d = name;
+
+#ifdef WIN32
+ /* Check for UNC names. Leave leading two slashes. */
+ if (s[0] == '/' && s[1] == '/')
+ *d++ = *s++;
+#endif
+
while (*s) {
if ((*d++ = *s) == '/') {
do {