Index: squid/src/ftp.c
diff -c squid/src/ftp.c:1.316.2.32 squid/src/ftp.c:1.316.2.33
*** squid/src/ftp.c:1.316.2.32 Sat Sep 10 19:49:53 2005
--- squid/src/ftp.c Tue Oct 18 09:26:49 2005
***************
*** 438,444 ****
storeAppendPrintf(e, "\n");
if (ftpState->flags.listformat_unknown && !ftpState->flags.tried_nlst) {
storeAppendPrintf(e, "[As plain directory]\n",
! ftpState->flags.dir_slash ? rfc1738_escape_part(ftpState->filepath) : ".");
} else if (ftpState->typecode == 'D') {
const char *path = ftpState->flags.dir_slash ? ftpState->filepath : ".";
storeAppendPrintf(e, "[As extended directory]\n", html_quote(path));
--- 438,444 ----
storeAppendPrintf(e, "\n");
if (ftpState->flags.listformat_unknown && !ftpState->flags.tried_nlst) {
storeAppendPrintf(e, "[As plain directory]\n",
! ftpState->flags.dir_slash ? rfc1738_escape_part(ftpState->old_filepath) : ".");
} else if (ftpState->typecode == 'D') {
const char *path = ftpState->flags.dir_slash ? ftpState->filepath : ".";
storeAppendPrintf(e, "[As extended directory]\n", html_quote(path));
***************
*** 714,725 ****
"%2f/",
"Root Directory");
} else if (ftpState->flags.no_dotdot && !ftpState->flags.root_dir) {
/* Normal directory where last component is / or .. */
strcpy(href, "%2e%2e/");
strcpy(text, "Parent Directory");
! snprintf(link, 2048, "(%s)",
! !ftpState->flags.dir_slash ? "../" : "./",
! "Back");
} else { /* NO_DOTDOT && ROOT_DIR */
/* "UNIX Root" directory */
strcpy(href, "/");
--- 714,736 ----
"%2f/",
"Root Directory");
} else if (ftpState->flags.no_dotdot && !ftpState->flags.root_dir) {
+ char *url;
/* Normal directory where last component is / or .. */
strcpy(href, "%2e%2e/");
strcpy(text, "Parent Directory");
! if (ftpState->flags.dir_slash) {
! url = xstrdup("./");
! } else {
! const char *title = strBuf(ftpState->title_url);
! int k = 6 + strcspn(&title[6], "/");
! char *t;
! url = xstrdup(title + k);
! t = url + strlen(url) - 2;
! while (t > url && *t != '/')
! *t-- = '\0';
! }
! snprintf(link, 2048, "(%s)", url, "Back");
! safe_free(url);
} else { /* NO_DOTDOT && ROOT_DIR */
/* "UNIX Root" directory */
strcpy(href, "/");
***************
*** 1053,1058 ****
--- 1064,1071 ----
ftpState->flags.isdir = 1;
if (l == 1)
ftpState->flags.root_dir = 1;
+ } else {
+ ftpState->flags.dir_slash = 1;
}
}
***************
*** 1668,1678 ****
static void
ftpListDir(FtpStateData * ftpState)
{
! if (!ftpState->flags.isdir) {
debug(9, 3) ("Directory path did not end in /\n");
strCat(ftpState->title_url, "/");
ftpState->flags.isdir = 1;
- ftpState->flags.dir_slash = 1;
}
ftpSendPasv(ftpState);
}
--- 1681,1690 ----
static void
ftpListDir(FtpStateData * ftpState)
{
! if (ftpState->flags.dir_slash) {
debug(9, 3) ("Directory path did not end in /\n");
strCat(ftpState->title_url, "/");
ftpState->flags.isdir = 1;
}
ftpSendPasv(ftpState);
}