mirror of
https://github.com/moparisthebest/wget
synced 2024-07-03 16:38:41 -04:00
Applied Alexander Belopolsky's patch for htmlified FTP listings.
This commit is contained in:
parent
1777835073
commit
cf93ce7f4b
@ -1,3 +1,10 @@
|
|||||||
|
2008-11-12 Alexander Belopolsky <alexander.belopolsky@gmail.com>
|
||||||
|
|
||||||
|
* url.c, url.h (url_escape_unsafe_and_reserved): Added.
|
||||||
|
|
||||||
|
* ftp-ls.c (ftp_index): URL-escape, rather than HTML-escape, the
|
||||||
|
filename appearing in the link.
|
||||||
|
|
||||||
2008-11-12 Steven Schubiger <stsc@members.fsf.org>
|
2008-11-12 Steven Schubiger <stsc@members.fsf.org>
|
||||||
|
|
||||||
* main.c (print_version): Hand the relevant
|
* main.c (print_version): Hand the relevant
|
||||||
|
@ -851,6 +851,7 @@ ftp_index (const char *file, struct url *u, struct fileinfo *f)
|
|||||||
FILE *fp;
|
FILE *fp;
|
||||||
char *upwd;
|
char *upwd;
|
||||||
char *htclfile; /* HTML-clean file name */
|
char *htclfile; /* HTML-clean file name */
|
||||||
|
char *urlclfile; /* URL-clean file name */
|
||||||
|
|
||||||
if (!output_stream)
|
if (!output_stream)
|
||||||
{
|
{
|
||||||
@ -923,13 +924,14 @@ ftp_index (const char *file, struct url *u, struct fileinfo *f)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
htclfile = html_quote_string (f->name);
|
htclfile = html_quote_string (f->name);
|
||||||
|
urlclfile = url_escape_unsafe_and_reserved (f->name);
|
||||||
fprintf (fp, "<a href=\"ftp://%s%s:%d", upwd, u->host, u->port);
|
fprintf (fp, "<a href=\"ftp://%s%s:%d", upwd, u->host, u->port);
|
||||||
if (*u->dir != '/')
|
if (*u->dir != '/')
|
||||||
putc ('/', fp);
|
putc ('/', fp);
|
||||||
fprintf (fp, "%s", u->dir);
|
fprintf (fp, "%s", u->dir);
|
||||||
if (*u->dir)
|
if (*u->dir)
|
||||||
putc ('/', fp);
|
putc ('/', fp);
|
||||||
fprintf (fp, "%s", htclfile);
|
fprintf (fp, "%s", urlclfile);
|
||||||
if (f->type == FT_DIRECTORY)
|
if (f->type == FT_DIRECTORY)
|
||||||
putc ('/', fp);
|
putc ('/', fp);
|
||||||
fprintf (fp, "\">%s", htclfile);
|
fprintf (fp, "\">%s", htclfile);
|
||||||
@ -942,6 +944,7 @@ ftp_index (const char *file, struct url *u, struct fileinfo *f)
|
|||||||
fprintf (fp, "-> %s", f->linkto ? f->linkto : "(nil)");
|
fprintf (fp, "-> %s", f->linkto ? f->linkto : "(nil)");
|
||||||
putc ('\n', fp);
|
putc ('\n', fp);
|
||||||
xfree (htclfile);
|
xfree (htclfile);
|
||||||
|
xfree (urlclfile);
|
||||||
f = f->next;
|
f = f->next;
|
||||||
}
|
}
|
||||||
fprintf (fp, "</pre>\n</body>\n</html>\n");
|
fprintf (fp, "</pre>\n</body>\n</html>\n");
|
||||||
|
@ -252,6 +252,15 @@ url_escape (const char *s)
|
|||||||
return url_escape_1 (s, urlchr_unsafe, false);
|
return url_escape_1 (s, urlchr_unsafe, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* URL-escape the unsafe and reserved characters (see urlchr_table) in
|
||||||
|
a given string, returning a freshly allocated string. */
|
||||||
|
|
||||||
|
char *
|
||||||
|
url_escape_unsafe_and_reserved (const char *s)
|
||||||
|
{
|
||||||
|
return url_escape_1 (s, urlchr_unsafe|urlchr_reserved, false);
|
||||||
|
}
|
||||||
|
|
||||||
/* URL-escape the unsafe characters (see urlchr_table) in a given
|
/* URL-escape the unsafe characters (see urlchr_table) in a given
|
||||||
string. If no characters are unsafe, S is returned. */
|
string. If no characters are unsafe, S is returned. */
|
||||||
|
|
||||||
|
@ -83,6 +83,7 @@ struct url
|
|||||||
/* Function declarations */
|
/* Function declarations */
|
||||||
|
|
||||||
char *url_escape (const char *);
|
char *url_escape (const char *);
|
||||||
|
char *url_escape_unsafe_and_reserved (const char *);
|
||||||
|
|
||||||
struct url *url_parse (const char *, int *);
|
struct url *url_parse (const char *, int *);
|
||||||
char *url_error (const char *, int);
|
char *url_error (const char *, int);
|
||||||
|
Loading…
Reference in New Issue
Block a user