]> git.pld-linux.org Git - packages/squid.git/blame - squid-2.5.STABLE10-ftp_title-2.patch
- removed outdated squid patches, they're all in sources
[packages/squid.git] / squid-2.5.STABLE10-ftp_title-2.patch
CommitLineData
d29ec517 1Index: squid/src/ftp.c
2diff -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
5***************
6*** 365,379 ****
7 wordlist *w;
8 char *dirup;
9 int i, j, k;
10! char *title;
11 storeBuffer(e);
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",
14 version_string);
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)
22--- 365,383 ----
23 wordlist *w;
24 char *dirup;
25 int i, j, k;
26! const char *title = strBuf(ftpState->title_url);
27 storeBuffer(e);
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",
30 version_string);
31 storeAppendPrintf(e, "<!-- %s -->\n", mkrfc1123(squid_curtime));
32 storeAppendPrintf(e, "<HTML><HEAD><TITLE>\n");
33! {
34! char *t = xstrdup(title);
35! rfc1738_unescape(t);
36! storeAppendPrintf(e, "FTP Directory: %s\n", html_quote(t));
37! xfree(t);
38! }
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)
42***************
43*** 392,418 ****
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], "/");
51 if (title[i] == '/')
52 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>");
61- if (k < i)
62- storeAppendPrintf(e, "%c", title[k++]);
63 if (i == j) {
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));
68 break;
69 }
70 }
71--- 396,424 ----
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], "/");
79+ if (i > j) {
80+ char *url = xstrdup(title);
81+ url[i] = '\0';
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));
87+ safe_free(url);
88+ storeAppendPrintf(e, "</A>");
89+ }
90+ storeAppendPrintf(e, "/");
91 if (title[i] == '/')
92 i++;
93 if (i == j) {
94 /* Error guard, or "assert" */
95 storeAppendPrintf(e, "ERROR: Failed to parse URL: %s\n",
96! html_quote(title));
97! debug(9, 0) ("Failed to parse URL: %s\n", title);
98 break;
99 }
100 }
101***************
102*** 1059,1070 ****
103 strCat(ftpState->title_url, xitoa(request->port));
104 }
105 strCat(ftpState->title_url, strBuf(request->urlpath));
106- {
107- char *t = xstrdup(strBuf(ftpState->title_url));
108- rfc1738_unescape(t);
109- stringReset(&ftpState->title_url, t);
110- xfree(t);
111- }
112
113 stringReset(&ftpState->base_href, "ftp://");
114 if (strcmp(ftpState->user, "anonymous")) {
115--- 1065,1070 ----
This page took 0.033431 seconds and 4 git commands to generate.