Index: squid/src/ftp.c diff -c squid/src/ftp.c:1.316.2.26 squid/src/ftp.c:1.316.2.27 *** squid/src/ftp.c:1.316.2.26 Tue Jun 21 16:18:19 2005 --- squid/src/ftp.c Tue Jun 21 16:21:31 2005 *************** *** 69,74 **** --- 69,75 ---- unsigned int http_header_sent:1; unsigned int tried_nlst:1; unsigned int use_base:1; + unsigned int dir_slash:1; unsigned int root_dir:1; unsigned int no_dotdot:1; unsigned int html_header_sent:1; *************** *** 87,92 **** --- 88,94 ---- int password_url; char *reply_hdr; int reply_hdr_state; + String clean_url; String title_url; String base_href; int conn_att; *************** *** 96,101 **** --- 98,104 ---- squid_off_t size; wordlist *pathcomps; char *filepath; + char *dirpath; squid_off_t restart_offset; squid_off_t restarted_offset; int rest_att; *************** *** 437,445 **** storeBuffer(e); storeAppendPrintf(e, "\n"); 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"); --- 440,449 ---- storeBuffer(e); 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)); } storeAppendPrintf(e, "
\n"); *************** *** 681,686 **** --- 685,691 ---- LOCAL_ARRAY(char, download, 2048 + 40); LOCAL_ARRAY(char, link, 2048 + 40); LOCAL_ARRAY(char, html, 8192); + LOCAL_ARRAY(char, prefix, 2048); size_t width = Config.Ftp.list_width; ftpListParts *parts; *icon = *href = *text = *size = *chdir = *view = *download = *link = *html = '0円'; *************** *** 688,693 **** --- 693,702 ---- snprintf(html, 8192, "%s\n", line); return html; } + if (ftpState->flags.dir_slash) + snprintf(prefix, sizeof(prefix), "%s/", rfc1738_escape_part(ftpState->dirpath)); + else + prefix[0] = '0円'; /* Handle builtin */ if (strcmp(line, "") == 0) { /* {icon} {text} {link} */ *************** *** 696,702 **** "[DIRUP]"); if (!ftpState->flags.no_dotdot && !ftpState->flags.root_dir) { /* Normal directory */ ! strcpy(href, "../"); strcpy(text, "Parent Directory"); } else if (!ftpState->flags.no_dotdot && ftpState->flags.root_dir) { /* "Top level" directory */ --- 705,714 ---- "[DIRUP]"); if (!ftpState->flags.no_dotdot && !ftpState->flags.root_dir) { /* Normal directory */ ! if (!ftpState->flags.dir_slash) ! strcpy(href, "../"); ! else ! strcpy(href, "./"); strcpy(text, "Parent Directory"); } else if (!ftpState->flags.no_dotdot && ftpState->flags.root_dir) { /* "Top level" directory */ *************** *** 710,716 **** strcpy(href, "%2e%2e/"); strcpy(text, "Parent Directory"); snprintf(link, 2048, "(%s)", ! "../", "Back"); } else { /* NO_DOTDOT && ROOT_DIR */ /* "UNIX Root" directory */ --- 722,728 ---- 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 */ *************** *** 758,765 **** /* sometimes there is an 'l' flag, but no "->" link */ if (parts->link) { char *link2 = xstrdup(html_quote(rfc1738_escape(parts->link))); ! snprintf(link, 2048, " -> %s", ! link2, html_quote(parts->link)); safe_free(link2); } --- 770,777 ---- /* sometimes there is an 'l' flag, but no "->" link */ if (parts->link) { char *link2 = xstrdup(html_quote(rfc1738_escape(parts->link))); ! snprintf(link, 2048, " -> %s", ! *link2 != '/' ? prefix : "", link2, html_quote(parts->link)); safe_free(link2); } *************** *** 799,825 **** } if (parts->type != 'd') { if (mimeGetViewOption(parts->name)) { ! snprintf(view, 2048, " \", ! href, mimeGetIconURL("internal-view")); } if (mimeGetDownloadOption(parts->name)) { ! snprintf(download, 2048, " \", ! href, mimeGetIconURL("internal-download")); } } /* {icon} {text} . . . {date}{size}{chdir}{view}{download}{link}\n */ if (parts->type != '0円') { ! snprintf(html, 8192, "%s %s%s " "%s%8s%s%s%s%s\n", ! href, icon, href, html_quote(text), dots_fill(strlen(text)), parts->date, size, chdir, view, download, link); } else { /* Plain listing. {icon} {text} ... {chdir}{view}{download} */ ! snprintf(html, 8192, "%s %s%s " "%s%s%s%s\n", ! href, icon, href, html_quote(text), dots_fill(strlen(text)), chdir, view, download, link); } ftpListPartsFree(&parts); --- 811,837 ---- } if (parts->type != 'd') { if (mimeGetViewOption(parts->name)) { ! snprintf(view, 2048, " \", ! prefix, href, mimeGetIconURL("internal-view")); } if (mimeGetDownloadOption(parts->name)) { ! snprintf(download, 2048, " \", ! prefix, href, mimeGetIconURL("internal-download")); } } /* {icon} {text} . . . {date}{size}{chdir}{view}{download}{link}\n */ if (parts->type != '0円') { ! snprintf(html, 8192, "%s %s%s " "%s%8s%s%s%s%s\n", ! prefix, href, icon, prefix, href, html_quote(text), dots_fill(strlen(text)), parts->date, size, chdir, view, download, link); } else { /* Plain listing. {icon} {text} ... {chdir}{view}{download} */ ! snprintf(html, 8192, "%s %s%s " "%s%s%s%s\n", ! prefix, href, icon, prefix, href, html_quote(text), dots_fill(strlen(text)), chdir, view, download, link); } ftpListPartsFree(&parts); *************** *** 1557,1563 **** debug(9, 4) ("ftpTraverseDirectory %s\n", ftpState->filepath ? ftpState->filepath : ""); ! safe_free(ftpState->filepath); /* Done? */ if (ftpState->pathcomps == NULL) { debug(9, 3) ("the final component was a directory\n"); --- 1569,1578 ---- debug(9, 4) ("ftpTraverseDirectory %s\n", ftpState->filepath ? ftpState->filepath : ""); ! safe_free(ftpState->dirpath); ! ftpState->dirpath = ftpState->filepath; ! ftpState->filepath = NULL; ! /* Done? */ if (ftpState->pathcomps == NULL) { debug(9, 3) ("the final component was a directory\n"); *************** *** 1662,1668 **** 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); } --- 1677,1683 ---- 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); }

AltStyle によって変換されたページ (->オリジナル) /