summaryrefslogtreecommitdiff
path: root/source/html/html-doc.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/html/html-doc.c')
-rw-r--r--source/html/html-doc.c38
1 files changed, 21 insertions, 17 deletions
diff --git a/source/html/html-doc.c b/source/html/html-doc.c
index ba765350..1cf3dca5 100644
--- a/source/html/html-doc.c
+++ b/source/html/html-doc.c
@@ -197,26 +197,30 @@ htdoc_open_document(fz_context *ctx, const char *filename)
return (fz_document*)doc;
}
-static int
-htdoc_recognize(fz_context *doc, const char *magic)
-{
- char *ext = strrchr(magic, '.');
+static const char *htdoc_extensions[] =
+{
+ "fb2",
+ "htm",
+ "html",
+ "xhtml",
+ "xml",
+ NULL
+};
- if (ext)
- {
- if (!fz_strcasecmp(ext, ".xml") || !fz_strcasecmp(ext, ".xhtml") ||
- !fz_strcasecmp(ext, ".html") || !fz_strcasecmp(ext, ".htm") ||
- !fz_strcasecmp(ext, ".fb2"))
- return 100;
- }
- if (!strcmp(magic, "application/html+xml") || !strcmp(magic, "application/xml") || !strcmp(magic, "text/xml"))
- return 100;
- return 0;
-}
+static const char *htdoc_mimetypes[] =
+{
+ "application/html+xml",
+ "application/x-fictionbook",
+ "application/xml",
+ "text/xml",
+ NULL
+};
fz_document_handler html_document_handler =
{
- htdoc_recognize,
+ NULL,
htdoc_open_document,
- htdoc_open_document_with_stream
+ htdoc_open_document_with_stream,
+ htdoc_extensions,
+ htdoc_mimetypes
};