1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-10-11 05:29:28 -04:00

http-equiv: Do not parse more than one http-equiv="Content-Type".

Other browsers use only the first occurence of http-equiv="Content-Type".
ELinks parsed all and used the last one for the charset.
Noticed at http://gazetaolsztynska.wm.pl/ .
This commit is contained in:
Witold Filipczyk 2007-06-15 21:10:19 +02:00 committed by Witold Filipczyk
parent 123e3c9ad7
commit b28eeb8a38

View File

@ -1047,6 +1047,7 @@ scan_http_equiv(unsigned char *s, unsigned char *eof, struct string *head,
{
unsigned char *name, *attr, *he, *c;
int namelen;
int was_content_type = 0;
if (title && !init_string(title)) return;
@ -1107,18 +1108,27 @@ xsp:
he = get_attr_val(attr, "http-equiv", options->cp);
if (!he) goto se;
add_to_string(head, he);
mem_free(he);
/* FIXME (bug 784): options->cp is the terminal charset;
* should use the document charset instead. */
c = get_attr_val(attr, "content", options->cp);
if (c) {
if (!strcasecmp(he, "Content-Type") && was_content_type) {
mem_free(he);
mem_free(c);
goto se;
}
was_content_type = 1;
add_to_string(head, he);
add_to_string(head, ": ");
add_to_string(head, c);
mem_free(c);
mem_free(he);
mem_free(c);
goto next;
}
add_to_string(head, he);
mem_free(he);
next:
add_crlf_to_string(head);
goto se;
}