summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJorge Arellano Cid <jcid@dillo.org>2010-09-27 16:33:36 -0400
committerJorge Arellano Cid <jcid@dillo.org>2010-09-27 16:33:36 -0400
commitd4f2f418e1f33e10ce35be3b0b200d94fa29e4d0 (patch)
tree2dbd898a27da3f58d491e798826c9d374fb0b0ab
parent8c8276f419212295e18615933f0db83322936700 (diff)
Allow viewing XHTML served as such
-rw-r--r--src/IO/mime.c1
-rw-r--r--src/cache.c4
-rw-r--r--src/misc.c6
3 files changed, 11 insertions, 0 deletions
diff --git a/src/IO/mime.c b/src/IO/mime.c
index 9bffd619..19dc601a 100644
--- a/src/IO/mime.c
+++ b/src/IO/mime.c
@@ -108,6 +108,7 @@ void a_Mime_init()
Mime_add_minor_type("image/x-png", a_Dicache_png_image); /* deprecated */
#endif
Mime_add_minor_type("text/html", a_Html_text);
+ Mime_add_minor_type("application/xhtml+xml", a_Html_text);
/* Add a major type to handle all the text stuff */
Mime_add_major_type("text", a_Plain_text);
diff --git a/src/cache.c b/src/cache.c
index 078f4bbd..ec7af67d 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -516,6 +516,10 @@ const char *a_Cache_set_content_type(const DilloUrl *url, const char *ctype,
((!major || !*major) && (!minor || !*minor))) {
/* META only gives charset; use detected MIME type too */
entry->TypeNorm = dStrconcat(entry->TypeDet, ctype, NULL);
+ } else if (*from == 'm' &&
+ !dStrncasecmp(ctype, "text/xhtml", 10)) {
+ /* WORKAROUND: doxygen uses "text/xhtml" in META */
+ entry->TypeNorm = dStrdup(entry->TypeDet);
}
if (charset) {
if (entry->CharsetDecoder)
diff --git a/src/misc.c b/src/misc.c
index 14d6edc1..213b0ada 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -104,6 +104,7 @@ typedef struct ContentType_ {
static const ContentType_t MimeTypes[] = {
{ "application/octet-stream", 24 },
+ { "application/xhtml+xml", 21 },
{ "text/html", 9 },
{ "text/plain", 10 },
{ "image/gif", 9 },
@@ -341,7 +342,12 @@ int a_Misc_content_type_check(const char *EntryType, const char *DetectedType)
dStrncasecmp(DetectedType, "application/", 12)) {
/* Not an application sent as text */
st = 0;
+ } else if (dStrncasecmp(EntryType, "application/xhtml+xml", 21) &&
+ dStrncasecmp(DetectedType, "text/html", 9)) {
+ /* XML version of HTML */
+ st = 0;
}
+ _MSG("Type check: %s\n", st == 0 ? "MATCH" : "MISMATCH");
return st;
}