Bug 187441 URLs not HTML encoded in output

git-svn-id: svn://10.0.0.236/trunk@135771 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
timeless%mozdev.org
2003-01-02 17:07:34 +00:00
parent c346dcaa81
commit 813717c97f
2 changed files with 11 additions and 3 deletions

View File

@@ -80,14 +80,16 @@ reportHTMLAttributeValue(void *a, HTML *html, Input *input)
{
URL *url;
View *view;
char *urlstring;
view = a;
if (html->currentAttributeIsURL)
{
url = urlRelative(html->base, html->currentAttribute->value);
fprintf(view->out, "<a href=%s%s>", me,
url ? (char*) url->url : "");
urlstring = escapeHTML(url ? (char*) url->url : "");
fprintf(view->out, "<a href=\"%s%s\">", me, urlstring);
free(urlstring);
urlFree(url);
}
viewHTMLAttributeValue(view, input);
@@ -151,12 +153,15 @@ void
reportHTTPHeaderValue(void *a, Input *input, unsigned char *url)
{
View *view;
char *urlstring;
view = a;
if (url)
{
fprintf(view->out, "<a href=%s%s>", me, url);
urlstring = escapeHTML(url);
fprintf(view->out, "<a href=\"%s%s\">", me, urlstring);
free(urlstring);
}
viewHTTPHeaderValue(view, input);
if (url)

View File

@@ -899,6 +899,9 @@ escapeHTML(unsigned char *str)
case '&':
replacement = "&amp;";
break;
case '"':
replacement = "&quot;";
break;
default:
replacement = buf;
buf[0] = str[j];