Use the MIME type parsing code from Freenet.