Index: squid/src/ftp.c
diff -c squid/src/ftp.c:1.316.2.17 squid/src/ftp.c:1.316.2.20
*** squid/src/ftp.c:1.316.2.17 Sat Feb 5 17:53:29 2005
--- squid/src/ftp.c Mon Feb 14 19:13:13 2005
***************
*** 433,439 ****
if (ftpState->flags.listformat_unknown && !ftpState->flags.tried_nlst) {
storeAppendPrintf(e, "[As plain directory]\n");
} else if (ftpState->typecode == 'D') {
! storeAppendPrintf(e, "[As extended directory]\n");
}
storeAppendPrintf(e, "
\n");
storeAppendPrintf(e, "\n");
--- 433,440 ----
if (ftpState->flags.listformat_unknown && !ftpState->flags.tried_nlst) {
storeAppendPrintf(e, "[As plain directory]\n");
} else if (ftpState->typecode == 'D') {
! const char *path = ftpState->filepath ? ftpState->filepath : ".";
! storeAppendPrintf(e, "[As extended directory]\n", html_quote(path));
}
storeAppendPrintf(e, "
\n");
storeAppendPrintf(e, "\n");
***************
*** 707,713 ****
"Back");
} else { /* NO_DOTDOT && ROOT_DIR */
/* "UNIX Root" directory */
! strcpy(href, "../");
strcpy(text, "Home Directory");
}
snprintf(html, 8192, "%s %s %s\n",
--- 708,714 ----
"Back");
} else { /* NO_DOTDOT && ROOT_DIR */
/* "UNIX Root" directory */
! strcpy(href, "/");
strcpy(text, "Home Directory");
}
snprintf(html, 8192, "%s %s %s\n",
***************
*** 1011,1030 ****
}
}
l = strLen(request->urlpath);
- ftpState->flags.use_base = 1;
/* check for null path */
if (!l) {
ftpState->flags.isdir = 1;
ftpState->flags.root_dir = 1;
} else if (!strCmp(request->urlpath, "/%2f/")) {
/* UNIX root directory */
- ftpState->flags.use_base = 0;
ftpState->flags.isdir = 1;
ftpState->flags.root_dir = 1;
} else if ((l>= 1) && (*(strBuf(request->urlpath) + l - 1) == '/')) {
/* Directory URL, ending in / */
ftpState->flags.isdir = 1;
- ftpState->flags.use_base = 0;
if (l == 1)
ftpState->flags.root_dir = 1;
}
--- 1012,1029 ----
}
}
l = strLen(request->urlpath);
/* check for null path */
if (!l) {
ftpState->flags.isdir = 1;
ftpState->flags.root_dir = 1;
+ ftpState->flags.use_base = 1; /* Work around broken browsers */
} else if (!strCmp(request->urlpath, "/%2f/")) {
/* UNIX root directory */
ftpState->flags.isdir = 1;
ftpState->flags.root_dir = 1;
} else if ((l>= 1) && (*(strBuf(request->urlpath) + l - 1) == '/')) {
/* Directory URL, ending in / */
ftpState->flags.isdir = 1;
if (l == 1)
ftpState->flags.root_dir = 1;
}
***************
*** 1518,1524 ****
if (*p)
*p++ = '0円';
rfc1738_unescape(d);
! wordlistAdd(&ftpState->pathcomps, d);
}
xfree(path);
if (ftpState->pathcomps)
--- 1517,1524 ----
if (*p)
*p++ = '0円';
rfc1738_unescape(d);
! if (*d)
! wordlistAdd(&ftpState->pathcomps, d);
}
xfree(path);
if (ftpState->pathcomps)
***************
*** 1569,1578 ****
} else {
ftpState->flags.no_dotdot = 0;
}
! if (*path)
! snprintf(cbuf, 1024, "CWD %s\r\n", path);
! else
! snprintf(cbuf, 1024, "CWD\r\n");
ftpWriteCommand(cbuf, ftpState);
ftpState->state = SENT_CWD;
}
--- 1569,1575 ----
} else {
ftpState->flags.no_dotdot = 0;
}
! snprintf(cbuf, 1024, "CWD %s\r\n", path);
ftpWriteCommand(cbuf, ftpState);
ftpState->state = SENT_CWD;
}
***************
*** 1645,1651 ****
debug(9, 3) ("Directory path did not end in /\n");
strCat(ftpState->title_url, "/");
ftpState->flags.isdir = 1;
- ftpState->flags.use_base = 1;
}
ftpSendPasv(ftpState);
}
--- 1642,1647 ----
***************
*** 2010,2016 ****
debug(9, 3) ("This is ftpRestOrList\n");
if (ftpState->typecode == 'D') {
ftpState->flags.isdir = 1;
- ftpState->flags.use_base = 1;
if (ftpState->flags.put) {
ftpSendMkdir(ftpState); /* PUT name;type=d */
} else {
--- 2006,2011 ----
***************
*** 2144,2150 ****
{
ftpState->flags.tried_nlst = 1;
if (ftpState->filepath) {
- ftpState->flags.use_base = 1;
snprintf(cbuf, 1024, "NLST %s\r\n", ftpState->filepath);
} else {
snprintf(cbuf, 1024, "NLST\r\n");
--- 2139,2144 ----