chuck 97/04/10 22:01:54
Modified: src/modules/proxy proxy_ftp.c Log: Improve handling of directories when filenames have spaces in them. Revision Changes Path 1.16 +16 -0 apache/src/modules/proxy/proxy_ftp.c Index: proxy_ftp.c =================================================================== RCS file: /export/home/cvs/apache/src/modules/proxy/proxy_ftp.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C3 -r1.15 -r1.16 *** proxy_ftp.c 1997/04/09 06:51:07 1.15 --- proxy_ftp.c 1997/04/11 05:01:53 1.16 *************** *** 220,225 **** --- 220,228 ---- char buf2[IOBUFSIZE]; char *filename; char *tempurl; + char *searchptr = NULL; + int searchidx = 0; + int firstfile = 1; char urlptr[HUGE_STRING_LEN]; long total_bytes_sent; register int n, o, w; *************** *** 265,270 **** --- 268,286 ---- filename=strrchr(buf, ' '); *(filename++)=0; filename[strlen(filename)-1]=0; + + /* handle filenames with spaces in 'em */ + if(!strcmp(filename, ".") || !strcmp(filename, "..") || firstfile) { + firstfile = 0; + searchptr = filename; + searchidx = filename - buf; + } + else if (searchptr != NULL && searchidx != 0) { + *(--filename) = ' '; + buf[searchidx - 1] = 0; + filename = &buf[searchidx]; + } + /* Special handling for '.' and '..' */ if (!strcmp(filename, ".")) {