changeset 1707:e44231f9c6ca

Allow viewing XHTML served as such
author Jorge Arellano Cid <jcid@dillo.org>
date Mon, 27 Sep 2010 16:33:36 -0400
parents 23fa79dc9664
children 4bf0cd96462b
files src/IO/mime.c src/cache.c src/misc.c
diffstat 3 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/IO/mime.c	Mon Sep 13 19:20:16 2010 +0000
+++ b/src/IO/mime.c	Mon Sep 27 16:33:36 2010 -0400
@@ -108,6 +108,7 @@
    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);
--- a/src/cache.c	Mon Sep 13 19:20:16 2010 +0000
+++ b/src/cache.c	Mon Sep 27 16:33:36 2010 -0400
@@ -516,6 +516,10 @@
              ((!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)
--- a/src/misc.c	Mon Sep 13 19:20:16 2010 +0000
+++ b/src/misc.c	Mon Sep 27 16:33:36 2010 -0400
@@ -104,6 +104,7 @@
 
 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 @@
               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;
 }