On 03/03/2011 12:48 AM, Alan Bateman wrote:
Charles Lee wrote:
Hi guys,
With test case[1] below, you can see guessContent does not support
UTF8/32 BOM.
I don't see a problem with this proposal but I just wonder if this
method is even used these days. It is a legacy method and I don't
think anyone can rely on it to reliably detect any content type. I'm
curious how you ran into this, was it a test or custom protocol
handler that overrides getContentType and uses
guessContentTypeFromStream as a fallback?
-Alan.
Hi Alan,
Sorry for the late reply. This test case comes from a big test case,
which test more types of stream. I am not sure if no one use it. But
from the spec:
/Ideally, this routine would not be needed. But many |http| servers
return the incorrect content type; in addition, there are many
nonstandard extensions. Direct inspection of the bytes to determine the
content type is often more accurate than believing the content type
claimed by the |http| server.
/guessContentTypeFromStream is needed as a fallback.