1
0
mirror of https://github.com/moparisthebest/wget synced 2024-07-03 16:38:41 -04:00

HTML-escape dir name in title, h1.

This commit is contained in:
Micah Cowan 2008-11-12 21:00:05 -08:00
parent cf93ce7f4b
commit ca12585a0e
2 changed files with 12 additions and 2 deletions

View File

@ -1,3 +1,7 @@
2008-11-12 Micah Cowan <micah@cowan.name>
* ftp-ls.c (ftp_index): HTML-escape dir name in title, h1.
2008-11-12 Alexander Belopolsky <alexander.belopolsky@gmail.com>
* url.c, url.h (url_escape_unsafe_and_reserved): Added.

View File

@ -850,6 +850,7 @@ ftp_index (const char *file, struct url *u, struct fileinfo *f)
{
FILE *fp;
char *upwd;
char *htcldir; /* HTML-clean dir name */
char *htclfile; /* HTML-clean file name */
char *urlclfile; /* URL-clean file name */
@ -879,12 +880,17 @@ ftp_index (const char *file, struct url *u, struct fileinfo *f)
}
else
upwd = xstrdup ("");
htcldir = html_quote_string (u->dir);
fprintf (fp, "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n");
fprintf (fp, "<html>\n<head>\n<title>");
fprintf (fp, _("Index of /%s on %s:%d"), u->dir, u->host, u->port);
fprintf (fp, _("Index of /%s on %s:%d"), htcldir, u->host, u->port);
fprintf (fp, "</title>\n</head>\n<body>\n<h1>");
fprintf (fp, _("Index of /%s on %s:%d"), u->dir, u->host, u->port);
fprintf (fp, _("Index of /%s on %s:%d"), htcldir, u->host, u->port);
fprintf (fp, "</h1>\n<hr>\n<pre>\n");
xfree (htcldir);
while (f)
{
fprintf (fp, " ");