1.23b - XHTML vs HTML changes

- A minor improvement to XHTML detection.
  - HTML vs XHTML mismatches no longer trigger a warning.
This commit is contained in:
Steve Pinkham 2010-03-25 00:32:32 -04:00
parent 942cb96f58
commit ffa63decdb
3 changed files with 19 additions and 5 deletions

View File

@ -1,3 +1,10 @@
Version 1.23b:
--------------
- A minor improvement to XHTML detection.
- HTML vs XHTML mismatches no longer trigger a warning.
Version 1.22b:
--------------

View File

@ -1757,12 +1757,19 @@ binary_checks:
/* CHECK 6: MIME mismatch? Ignore cases where the response had a valid
MIME type declared in headers, but we failed to map it to a known
value... and also failed to sniff. */
value... and also failed to sniff.
Mismatch between MIME_ASC_HTML and MIME_XML_XHTML is not worth
complaining about, too. */
if (res->sniff_mime_id != res->decl_mime_id &&
!(res->decl_mime_id == MIME_ASC_HTML &&
res->sniff_mime_id == MIME_XML_XHTML) &&
!(res->decl_mime_id == MIME_XML_XHTML &&
res->sniff_mime_id == MIME_ASC_HTML) &&
!(res->header_mime && !res->decl_mime_id &&
(res->sniff_mime_id == MIME_ASC_GENERIC ||
res->sniff_mime_id == MIME_BIN_GENERIC)))
(res->sniff_mime_id == MIME_ASC_GENERIC ||
res->sniff_mime_id == MIME_BIN_GENERIC)))
problem(high_risk ? PROB_BAD_MIME_DYN : PROB_BAD_MIME_STAT,
req, res, res->sniffed_mime, req->pivot, 0);
@ -1929,7 +1936,7 @@ static void detect_mime(struct http_request* req, struct http_response* res) {
if (strstr((char*)sniffbuf, "<?xml") ||
strstr((char*)sniffbuf, "<!DOCTYPE")) {
if (strstr((char*)sniffbuf, "<!DOCTYPE html") ||
if (inl_strcasestr(sniffbuf, (u8*)"<!DOCTYPE html") ||
strstr((char*)sniffbuf, "http://www.w3.org/1999/xhtml"))
res->sniff_mime_id = MIME_XML_XHTML;
else

View File

@ -23,7 +23,7 @@
#ifndef _HAVE_CONFIG_H
#define _HAVE_CONFIG_H
#define VERSION "1.22b"
#define VERSION "1.23b"
#define USE_COLOR 1 /* Use terminal colors */