2 diff -c squid/src/ftp.c:1.316.2.25 squid/src/ftp.c:1.316.2.28
3 *** squid/src/ftp.c:1.316.2.25 Fri Mar 25 19:50:53 2005
4 --- squid/src/ftp.c Wed Jun 22 04:42:34 2005
12 storeAppendPrintf(e, "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n");
13 storeAppendPrintf(e, "<!-- HTML listing generated by Squid %s -->\n",
15 storeAppendPrintf(e, "<!-- %s -->\n", mkrfc1123(squid_curtime));
16 storeAppendPrintf(e, "<HTML><HEAD><TITLE>\n");
17 ! storeAppendPrintf(e, "FTP Directory: %s\n",
18 ! html_quote(strBuf(ftpState->title_url)));
19 storeAppendPrintf(e, "</TITLE>\n");
20 storeAppendPrintf(e, "<STYLE type=\"text/css\"><!--BODY{background-color:#ffffff;font-family:verdana,sans-serif}--></STYLE>\n");
21 if (ftpState->flags.use_base)
26 ! const char *title = strBuf(ftpState->title_url);
28 storeAppendPrintf(e, "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n");
29 storeAppendPrintf(e, "<!-- HTML listing generated by Squid %s -->\n",
31 storeAppendPrintf(e, "<!-- %s -->\n", mkrfc1123(squid_curtime));
32 storeAppendPrintf(e, "<HTML><HEAD><TITLE>\n");
34 ! char *t = xstrdup(title);
35 ! rfc1738_unescape(t);
36 ! storeAppendPrintf(e, "FTP Directory: %s\n", html_quote(t));
39 storeAppendPrintf(e, "</TITLE>\n");
40 storeAppendPrintf(e, "<STYLE type=\"text/css\"><!--BODY{background-color:#ffffff;font-family:verdana,sans-serif}--></STYLE>\n");
41 if (ftpState->flags.use_base)
44 storeAppendPrintf(e, "FTP Directory: ");
45 /* "ftp://" == 6 characters */
46 assert(strLen(ftpState->title_url) >= 6);
47 ! title = html_quote(strBuf(ftpState->title_url));
48 for (i = 6, j = 0; title[i]; j = i) {
49 storeAppendPrintf(e, "<A HREF=\"");
50 i += strcspn(&title[i], "/");
53 - for (k = 0; k < i; k++)
54 - storeAppendPrintf(e, "%c", title[k]);
55 - storeAppendPrintf(e, "\">");
56 - for (k = j; k < i - 1; k++)
57 - storeAppendPrintf(e, "%c", title[k]);
58 - if (strBuf(ftpState->title_url)[k] != '/')
59 - storeAppendPrintf(e, "%c", title[k++]);
60 - storeAppendPrintf(e, "</A>");
62 - storeAppendPrintf(e, "%c", title[k++]);
64 /* Error guard, or "assert" */
65 storeAppendPrintf(e, "ERROR: Failed to parse URL: %s\n",
66 ! html_quote(strBuf(ftpState->title_url)));
67 ! debug(9, 0) ("Failed to parse URL: %s\n", strBuf(ftpState->title_url));
72 storeAppendPrintf(e, "FTP Directory: ");
73 /* "ftp://" == 6 characters */
74 assert(strLen(ftpState->title_url) >= 6);
75 ! k = 6 + strcspn(&title[6], "/");
76 for (i = 6, j = 0; title[i]; j = i) {
77 storeAppendPrintf(e, "<A HREF=\"");
78 i += strcspn(&title[i], "/");
80 + char *url = xstrdup(title);
82 + storeAppendPrintf(e, "%s", html_quote(url + k));
83 + storeAppendPrintf(e, "/");
84 + storeAppendPrintf(e, "\">");
85 + rfc1738_unescape(url + j);
86 + storeAppendPrintf(e, "%s", html_quote(url + j));
88 + storeAppendPrintf(e, "</A>");
90 + storeAppendPrintf(e, "/");
94 /* Error guard, or "assert" */
95 storeAppendPrintf(e, "ERROR: Failed to parse URL: %s\n",
97 ! debug(9, 0) ("Failed to parse URL: %s\n", title);
103 strCat(ftpState->title_url, xitoa(request->port));
105 strCat(ftpState->title_url, strBuf(request->urlpath));
107 - char *t = xstrdup(strBuf(ftpState->title_url));
108 - rfc1738_unescape(t);
109 - stringReset(&ftpState->title_url, t);
113 stringReset(&ftpState->base_href, "ftp://");
114 if (strcmp(ftpState->user, "anonymous")) {