1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

Bug 983: Give precedence to HTTP Content-Type header over HTML meta tag

The Content-Type from the HTTP response header has
precedence over the Content-Type from a meta http-equiv tag.
http://www.w3.org/International/tutorials/tutorial-char-enc/en/all.html

This fixes bug 983.
This commit is contained in:
Miciah Dashiel Butler Masters 2008-06-30 17:32:07 +00:00
parent b37ba618ee
commit 6cf099a087
3 changed files with 10 additions and 8 deletions

View File

@ -265,6 +265,9 @@ Jon Shapcott <eden@xibalba.demon.co.uk>
John <martian202002@yahoo.com> John <martian202002@yahoo.com>
Tab browsing initial patch Tab browsing initial patch
Johannes Stezenbach <js@sig21.net>
Precedence of HTTP vs. HTTP meta tag when setting Content-Type
Johannes Zellner <johannes@zellner.org> Johannes Zellner <johannes@zellner.org>
Minor misc hacking Minor misc hacking

2
NEWS
View File

@ -25,6 +25,8 @@ Miscellaneous:
* bug 963: New option document.css.ignore_display_none. * bug 963: New option document.css.ignore_display_none.
* bug 977: Fixed crash when opening in new tab a non link with onclick * bug 977: Fixed crash when opening in new tab a non link with onclick
attribute. attribute.
* bug 983: Give preference to the Content-Type specified in the HTTP
header over that specified via the HTML meta tag.
* bug 1008: File upload fields in HTML forms now stream the files to * bug 1008: File upload fields in HTML forms now stream the files to
the server, instead of reading them to memory in advance. This lets the server, instead of reading them to memory in advance. This lets
you upload larger files. The downsides are that ELinks may use a you upload larger files. The downsides are that ELinks may use a

View File

@ -588,17 +588,14 @@ get_convert_table(unsigned char *head, int to_cp,
while (cp_index == -1) { while (cp_index == -1) {
unsigned char *ct_charset; unsigned char *ct_charset;
unsigned char *meta; /* scan_http_equiv() appends the meta http-equiv directives to
* the protocol header before this function is called, but the
* HTTP Content-Type header has precedence, so the HTTP header
* will be used if it exists and the meta header is only used
* as a fallback. See bug 983. */
unsigned char *a = parse_header(part, "Content-Type", &part); unsigned char *a = parse_header(part, "Content-Type", &part);
if (!a) break; if (!a) break;
/* Content type info from document meta header.
* scan_http_equiv() appends the meta stuff to the protocol header before
* this function is called. Last Content-Type header field is used. */
while ((meta = parse_header(part, "Content-Type", &part))) {
mem_free_set(&a, meta);
}
parse_header_param(a, "charset", &ct_charset); parse_header_param(a, "charset", &ct_charset);
if (ct_charset) { if (ct_charset) {