<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -324,6 +324,36 @@ QObject *WebPage::createPlugin(const QString &amp;classId, const QUrl &amp;url,
 #endif
 }
 
+// The chromium guys have documented many examples of incompatibilities that
+// different browsers have when they mime sniff.
+// http://src.chromium.org/viewvc/chrome/trunk/src/net/base/mime_sniffer.cc
+//
+// All WebKit ports should share a common set of rules to sniff content.
+// By having this here we are yet another browser that has different behavior :(
+// But sadly QtWebKit does no sniffing at all so we are forced to do something.
+static bool contentSniff(const QByteArray &amp;data)
+{
+    if (data.contains(&quot;&lt;!doctype&quot;)
+        || data.contains(&quot;&lt;script&quot;)
+        || data.contains(&quot;&lt;html&quot;)
+        || data.contains(&quot;&lt;!--&quot;)
+        || data.contains(&quot;&lt;head&quot;)
+        || data.contains(&quot;&lt;iframe&quot;)
+        || data.contains(&quot;&lt;h1&quot;)
+        || data.contains(&quot;&lt;div&quot;)
+        || data.contains(&quot;&lt;font&quot;)
+        || data.contains(&quot;&lt;table&quot;)
+        || data.contains(&quot;&lt;a&quot;)
+        || data.contains(&quot;&lt;style&quot;)
+        || data.contains(&quot;&lt;title&quot;)
+        || data.contains(&quot;&lt;b&quot;)
+        || data.contains(&quot;&lt;body&quot;)
+        || data.contains(&quot;&lt;br&quot;)
+        || data.contains(&quot;&lt;p&quot;))
+        return true;
+    return false;
+}
+
 void WebPage::handleUnsupportedContent(QNetworkReply *reply)
 {
     if (!reply)
@@ -363,6 +393,15 @@ void WebPage::handleUnsupportedContent(QNetworkReply *reply)
     if (!notFoundFrame)
         return;
 
+    if (reply-&gt;header(QNetworkRequest::ContentTypeHeader).toString().isEmpty()) {
+        // do evil
+        QByteArray data = reply-&gt;readAll();
+        if (contentSniff(data)) {
+            notFoundFrame-&gt;setHtml(QLatin1String(data), replyUrl);
+            return;
+        }
+    }
+
     // Generate translated not found error page with an image
     QFile notFoundErrorFile(QLatin1String(&quot;:/notfound.html&quot;));
     if (!notFoundErrorFile.open(QIODevice::ReadOnly))</diff>
      <filename>src/webpage.cpp</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>47c421ade333481ab2f14619db6810cbbb483b86</id>
    </parent>
  </parents>
  <author>
    <name>Benjamin C Meyer</name>
    <email>ben@meyerhome.net</email>
  </author>
  <url>http://github.com/icefox/arora/commit/f83796a6a2e79ddd4a02de19c6f61502924a69ec</url>
  <id>f83796a6a2e79ddd4a02de19c6f61502924a69ec</id>
  <committed-date>2009-10-07T21:45:02-07:00</committed-date>
  <authored-date>2009-10-07T21:34:33-07:00</authored-date>
  <message>Do some very basic content sniffing for sites that do not send a content
type in the reply.

Issue: 697</message>
  <tree>d6e82c9c7d855c48b0a9e33532e1ae960336f3fd</tree>
  <committer>
    <name>Benjamin C Meyer</name>
    <email>ben@meyerhome.net</email>
  </committer>
</commit>
