Michael, Michael Kaply wrote: > > We need a way to map some default mime types to extensions in OS/2, > similar to a mime.types file on Linux or the registry on Windows.
Can you explain exactly why we need this ? Is it for content coming from non-HTTP data sources (maybe FTP ??) where the downloaded object's MIME type is not transmitted by the server in the response ? Or misconfigured HTTP servers that give no MIME type for some objects ? That problem would require a file extension to MIME type mapping, but not a MIME type to file extension mapping. Unfortunately, many objects of different MIME types share the same file extensions, so I don't think one could come up with a reliabl elist of file extensions to MIME types mappings. I know that Windows indeed offers a mapping from file extensions to MIME types in its registry, but that does not necessarily make it the right thing to do. I don't think it's capable of having several different MIME types configured for an identical extension, which Mozilla could then offer the user to pick from. That may be an intermediate solution for those conflicts of file extensions and MIME types. You say however that you need a MIME type to extension mapping. I'm not sure why you need that. If you already have the MIME type of the object, you shouldn't have a need for a file extension at all. You just go through the available plug-ins and helpers to find a match for your new object's MIME type. If you have a match, you are in business. If not, then you should bring up the dialog to ask the user what to do with the content. The MIME RFCs for internet content don't talk about file extensions at all, only MIME types, so this is the right thing to do. I think the truly correct thing to do would be to have a file analyzer that would be able to identify the MIME type of an object if it is missing by looking at the data, rather than the file extension. Of course this would be a much more complicated and slower step, that would involve looking at all your known file loaders and seeing if the new object is of that type by trying to load it. Maybe a mini-file loader that just checks the headers would do better for that purpose, but I'm sure the existing plug-ins and built-in loaders in mozilla can be used to check this. This won't work for helper apps, though. Note to audience : even though I work for Netscape, I do not work on the client and have never looked at this part of the code in the browser. But I have written plug-ins before, so I think I know a little bit about the MIME type subject here at stake.
