[webkit-dev] Content sniffing in WebCore

Benjamin Meyer ben at meyerhome.net
Thu Oct 9 20:01:23 PDT 2008


On Oct 9, 2008, at 1:38 PM, Adam Barth wrote:

> Currently, every WebKit port has to implement its own content sniffing
> algorithm.  This is problematic for compatibility and security.  We
> should implement a content sniffing algorithm in WebCore so that it
> can be used by every port.

Yah!  I was a bit surprised myself when I discovered that the browsers  
would sniff to such an extent and that each browser was implementing  
this differently. This will be a good addition to WebKit.

>  For example, Safari and Chromium each
> implement their own content sniffing algorithm and I imagine (although
> I haven't tested) that other ports do so as well.

QtWebKit doesn't have any content sniffing and so Arora also has its  
own crude ContentType handling.

> Feedback
>
> I'm sending this email to the list to get buy-in from the rest of the
> WebKit community on the general direction of implementing a content
> sniffer.

I only speak for myself and not QtWebKit, but I think this is a good  
move for something that can be moved into WebKit.

> http://src.chromium.org/viewvc/chrome/trunk/src/net/base/mime_sniffer.cc?view=markup
>
> The top of that file has some comments that explain some of the
> guiding design choices in the algorithm and a comparison with the
> behavior of some other browsers.

For what it is worth with Konq with its KParts system will follow the  
content type and just load a a text editor in the browser if there is  
no content-type for example.
-Benjamin Meyer


More information about the webkit-dev mailing list