file: reduce false hits for HTML files

This commit is contained in:
cinap_lenrek 2011-10-18 06:28:24 +02:00
parent b318debfc2
commit fe3de08658

View file

@ -920,45 +920,20 @@ iff(void)
return 0; return 0;
} }
char* html_string[] = char* html_string[] = {
{ "blockquote",
"?xml", "!DOCTYPE", "![CDATA[", "basefont", "frameset", "noframes", "textarea",
"!--", "caption",
"![CDATA[", "button", "center", "iframe", "object", "option", "script",
"!DOCTYPE", "select", "strong",
"html", "blink", "embed", "frame", "input", "label", "param", "small",
"head", "style", "table", "tbody", "tfoot", "thead", "title",
"title", "?xml", "body", "code", "font", "form", "head", "html",
"link", "link", "menu", "meta", "span",
"meta", "!--", "big", "dir", "div", "img", "pre", "sub", "sup",
"body", "br", "dd", "dl", "dt", "em", "h1", "h2", "h3", "h4", "h5",
"script", "h6", "hr", "li", "ol", "td", "th", "tr", "tt", "ul",
"strong", "a", "b", "i", "p", "q", "u",
"input",
"table",
"form",
"font",
"div",
"h1",
"h2",
"h3",
"h4",
"h5",
"h6",
"ol",
"ul",
"li",
"dl",
"br",
"hr",
"em",
"th",
"tr",
"td",
"p",
"b",
"i",
"a",
0, 0,
}; };
@ -985,11 +960,13 @@ ishtml(void)
if(p + n > buf+nbuf) if(p + n > buf+nbuf)
continue; continue;
if(cistrncmp(html_string[i], (char*)p, n) == 0) { if(cistrncmp(html_string[i], (char*)p, n) == 0) {
if(++count > 2) {
print(mime ? "text/html\n" : "HTML file\n");
return 1;
}
p += n; p += n;
if(p < buf+nbuf && strchr("\t\r\n />", *p)){
if(++count > 2) {
print(mime ? "text/html\n" : "HTML file\n");
return 1;
}
}
break; break;
} }
} }