- 论坛徽章:
- 0
|
怎样让squid代理的FTP显示图标?
以下是SQUID中执行FTP代理界面的两个函数,它将所有FTP站点显示成HTML格式,但是它自己自带的图标却无法显示,为什么?
我将Apache启动后故障依旧。
static void
ftpListingStart(FtpStateData * ftpState)
{
StoreEntry *e = ftpState->;entry;
wordlist *w;
char *dirup;
int i, j, k;
char *title;
storeBuffer(e);
storeAppendPrintf(e, "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">;\n" ;
storeAppendPrintf(e, "<!-- HTML listing generated by Squid %s -->;\n",
version_string);
storeAppendPrintf(e, "<!-- %s -->;\n", mkrfc1123(squid_curtime));
storeAppendPrintf(e, "<HTML>;<HEAD>;<TITLE>;\n" ;
storeAppendPrintf(e, "FTP Directory: %s\n",
html_quote(strBuf(ftpState->;title_url)));
storeAppendPrintf(e, "</TITLE>;\n" ;
storeAppendPrintf(e, "<STYLE type=\"text/css\">;<!--BODY{background-color:#ffffff;font-family:verdana,sans-serif}-->;</STYLE>;\n" ;
if (ftpState->;flags.use_base)
storeAppendPrintf(e, "<BASE HREF=\"%s\">;\n",
html_quote(strBuf(ftpState->;base_href)));
storeAppendPrintf(e, "</HEAD>;<BODY>;\n" ;
if (ftpState->;cwd_message) {
storeAppendPrintf(e, "< RE>;\n" ;
for (w = ftpState->;cwd_message; w; w = w->;next)
storeAppendPrintf(e, "%s\n", html_quote(w->;key));
storeAppendPrintf(e, "</PRE>;\n" ;
storeAppendPrintf(e, "<HR noshade size=\"1px\">;\n" ;
wordlistDestroy(&ftpState->;cwd_message);
}
storeAppendPrintf(e, "<H2>;\n" ;
storeAppendPrintf(e, "FTP Directory: " ;
/* "ftp://" == 6 characters */
assert(strLen(ftpState->;title_url) >;= 6);
title = html_quote(strBuf(ftpState->;title_url));
for (i = 6, j = 0; title; j = i) {
storeAppendPrintf(e, "<A HREF=\"");
i += strcspn(&title, "/");
if (title == '/')
i++;
for (k = 0; k < i; k++)
storeAppendPrintf(e, "%c", title[k]);
storeAppendPrintf(e, "\">;");
for (k = j; k < i - 1; k++)
storeAppendPrintf(e, "%c", title[k]);
if (strBuf(ftpState->;title_url)[k] != '/')
storeAppendPrintf(e, "%c", title[k++]);
storeAppendPrintf(e, "</A>;");
if (k < i)
storeAppendPrintf(e, "%c", title[k++]);
if (i == j) {
/* Error guard, or "assert" */
storeAppendPrintf(e, "ERROR: Failed to parse URL: %s\n",
html_quote(strBuf(ftpState->;title_url)));
debug(9, 0) ("Failed to parse URL: %s\n", strBuf(ftpState->;title_url));
break;
}
}
storeAppendPrintf(e, "</H2>;\n");
storeAppendPrintf(e, "< RE>;\n");
dirup = ftpHtmlifyListEntry("<internal-dirup>;", ftpState);
storeAppend(e, dirup, strlen(dirup));
storeBufferFlush(e);
ftpState->;flags.html_header_sent = 1;
}
static void
ftpListingFinish(FtpStateData * ftpState)
{
StoreEntry *e = ftpState->;entry;
storeBuffer(e);
storeAppendPrintf(e, "</PRE>;\n");
if (ftpState->;flags.listformat_unknown && !ftpState->;flags.tried_nlst) {
storeAppendPrintf(e, "<A HREF=\"./;type=d\">;[As plain directory]</A>;\n");
} else if (ftpState->;typecode == 'D') {
storeAppendPrintf(e, "<A HREF=\"./\">;[As extended directory]</A>;\n");
}
storeAppendPrintf(e, "<HR noshade size=\"1px\">;\n");
storeAppendPrintf(e, "<ADDRESS>;\n");
storeAppendPrintf(e, "Generated %s by %s (%s)\n",
mkrfc1123(squid_curtime),
getMyHostname(),
full_appname_string);
storeAppendPrintf(e, "</ADDRESS>;</BODY>;</HTML>;\n");
storeBufferFlush(e);
} |
|