diff options
author | corvid <corvid@lavabit.com> | 2009-07-28 06:54:06 +0000 |
---|---|---|
committer | corvid <corvid@lavabit.com> | 2009-07-28 06:54:06 +0000 |
commit | b74854e2f3fba67e75758d5ae6b1ec94a0b1747b (patch) | |
tree | 051e46c1557dbcb096eb786d3a7a6af0cecbf498 | |
parent | a633c018448e88eac9bcd6a399806f3d13d6f8b0 (diff) |
css charset
css 2.1 is strict about wanting precisely '@charset "charsetname";'
-rw-r--r-- | src/html.cc | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/html.cc b/src/html.cc index d08884ba..79be4253 100644 --- a/src/html.cc +++ b/src/html.cc @@ -2896,8 +2896,26 @@ void a_Html_load_stylesheet(DilloHtml *html, DilloUrl *url) _MSG("Html_load_stylesheet: "); if (a_Capi_get_buf(url, &data, &len)) { _MSG("cached URL=%s len=%d", URL_STR(url), len); - if (a_Capi_get_flags_with_redirection(url) & CAPI_Completed) + if (a_Capi_get_flags_with_redirection(url) & CAPI_Completed) { + if (strncmp("@charset \"", data, 10) == 0) { + char *endq = strchr(data+10, '"'); + + if (endq && (endq - data <= 51)) { + /* IANA limits charset names to 40 characters */ + const char *ignored; + char *content_type; + + *endq = '\0'; + content_type = dStrconcat("text/css; charset=", data+10, NULL); + *endq = '"'; + a_Capi_unref_buf(url); + ignored = a_Capi_set_content_type(url, content_type, "meta"); + dFree(content_type); + a_Capi_get_buf(url, &data, &len); + } + } html->styleEngine->parse(html, url, data, len, CSS_ORIGIN_AUTHOR); + } a_Capi_unref_buf(url); } else { /* Fill a Web structure for the cache query */ |