More tweaks to the HTML related sniffing rules:

* MHTML: give a higher priority than HTML to improve detection results,
as MHTL is likely to contain HTML in the first chunk.
* HTML: scan the first 512 bytes to increase likeliness of finding a tag
* XHTML: don't try to identify on the dectype, this is not reliable and
missing from some documents. Recognize "<html xmlns" and the utf-16
equivalent, as well as part of the DTD tag.
This commit is contained in:
Adrien Destugues
2014-04-23 15:13:12 +02:00
parent e70c4c6404
commit 804056af27
3 changed files with 5 additions and 3 deletions
+3 -1
View File
@@ -4,7 +4,9 @@ resource(0, "BEOS:TYPE") #'MIMS' "application/x-vnd.Be-meta-mime";
resource(1, "META:TYPE") "application/xhtml+xml";
resource(2, "META:SNIFF_RULE") #'CSTR' array {
"0.60 [0](\"<?xml\"|\"\\376\\377\\000<\\000?\\000x\\000m\\000l\") [0:128](\"<!DOCTYPE html\"|\"\\000<\\000!\\000D\\000O\\000C\\000T\\000Y\\000P\\000E\\000 \\000h\\000t\\000m\\000l\")"
"0.60 [0:512](\"<html xmlns\" | "
"\"<\\000h\\000t\\000m\\000l\\000 \\000x\\000m\\000l\\000n\\000s\" | "
"\"-//W3C//DTD XHTML\")"
};
resource(3, "META:S:DESC") #'MSDC' "XHTML file";
+1 -1
View File
@@ -4,7 +4,7 @@ resource(0, "BEOS:TYPE") #'MIMS' "application/x-vnd.Be-meta-mime";
resource(1, "META:TYPE") "multipart/related";
resource(2, "META:SNIFF_RULE") #'CSTR' array {
"0.40 [0:256]( -i \"Content-Type: multipart-related;\")"
"0.50 [0:256]( -i \"Content-Type: multipart-related;\")"
};
resource(3, "META:S:DESC") #'MSDC' "MHTML file";
+1 -1
View File
@@ -4,7 +4,7 @@ resource(0, "BEOS:TYPE") #'MIMS' "application/x-vnd.Be-meta-mime";
resource(1, "META:TYPE") "text/html";
resource(2, "META:SNIFF_RULE") #'CSTR' array {
"0.40 [0:256]( -i \"<HTML\" | \"<HEAD\" | \"<TITLE\" | \"<BODY\" | "
"0.40 [0:512]( -i \"<HTML\" | \"<HEAD\" | \"<TITLE\" | \"<BODY\" | "
"\"<TABLE\" | \"<META\" | \"<CENTER\" | \"<!DOCTYPE HTML\" | \"<SCRIPT\" | "
"\"<STYLE\" | \"<A HREF\" )"
};