Boris Zbarsky wrote:
> 
> Darin Fisher wrote:
> > well, we can learn if a file is a named pipe or not just by doing a stat
> > (see nsIFile::isSpecial).  for normal files, we could just go ahead and
> > sniff the file contents.
> 
> Ah, true.  That sounds pretty reasonable to me....  I'm still not sure
> what I want file:// channels to do, to be truthful, because I still want
> to make it possible to treat .gz files as being content-encoded.  But we
> could certainly do what Axel suggests in the short term and sniff in the
> GetTypeFromFile code.  Of course that needs some refactoring of the
> sniffer (either factoring out the sniffing code or implementing the sync
> Convert() function).
> 
> -Boris

Mozilla's use of stat completely ignores the possible race conditions so it's
insecure. This would just make it worse.

Also, is there any context in which you want to know the file type but not
actually use it? The bug you mention assumes use. I can't see why you wouldn't
want to treat all files as streams. It works on all (POSIX) file types and it
uses a common method on all files.

-- 
Uranus
    2003-08-11 11:39:51.331 UTC (JD 2452862.986011)
    X  =  17.459659458, Y  =  -8.905378009, Z  =  -4.147277892
    X' =   0.001899310, Y' =   0.002982106, Z' =   0.001279225

Reply via email to