| Index: net/base/mime_sniffer.cc
|
| diff --git a/net/base/mime_sniffer.cc b/net/base/mime_sniffer.cc
|
| index bd16462f159b7430508093044786e3b44deccf64..6c845ccb4c957cef5b584bd0398ad1b4c6dcbf0c 100644
|
| --- a/net/base/mime_sniffer.cc
|
| +++ b/net/base/mime_sniffer.cc
|
| @@ -534,15 +534,10 @@ static bool SniffCRX(const char* content,
|
| };
|
|
|
| // Only consider files that have the extension ".crx".
|
| - static const char kCRXExtension[] = ".crx";
|
| - // Ignore null by subtracting 1.
|
| - static const int kExtensionLength = arraysize(kCRXExtension) - 1;
|
| - if (url.path().rfind(kCRXExtension, std::string::npos, kExtensionLength) ==
|
| - url.path().size() - kExtensionLength) {
|
| - counter->Add(1);
|
| - } else {
|
| + if (!EndsWith(url.path(), ".crx", true))
|
| return false;
|
| - }
|
| +
|
| + counter->Add(1);
|
|
|
| *have_enough_content &= TruncateSize(kBytesRequiredForMagic, &size);
|
| if (CheckForMagicNumbers(content, size,
|
| @@ -663,6 +658,14 @@ bool SniffMimeType(const char* content, size_t content_size,
|
| &have_enough_content, result))
|
| return true;
|
|
|
| + // MHTML cannot be easily sniffed as its header might be relatively long
|
| + // before the "Content-Type: multipart/related".
|
| + std::string path = url.path();
|
| + if (EndsWith(path, ".mht", false) || EndsWith(path, ".mhtml", false)) {
|
| + result->assign("multipart/related");
|
| + return true;
|
| + }
|
| +
|
| // We're not interested in sniffing for magic numbers when the type_hint
|
| // is application/octet-stream. Time to bail out.
|
| if (type_hint == "application/octet-stream")
|
|
|