From 209c72b0113b5235a49af7a16e2aecb8e9f9c8ef Mon Sep 17 00:00:00 2001 From: François Revel Date: Fri, 3 Oct 2008 03:40:42 +0000 Subject: Add a function to tell the mime type for a content type. svn path=/trunk/netsurf/; revision=5478 --- content/content.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'content/content.c') diff --git a/content/content.c b/content/content.c index 935f3657f..090eb399d 100644 --- a/content/content.c +++ b/content/content.c @@ -382,6 +382,23 @@ content_type content_lookup(const char *mime_type) } +/** + * Convert a content_type to a MIME type. + * + */ + +const char *content_mime(content_type type) +{ + struct mime_entry *m; + int i; + m = mime_map; + for (i = MIME_MAP_COUNT - 1; i >= 0; i--) + if (m[i].type == type) + return m[i].mime_type; + return "application/octet-stream"; +} + + /** * Create a new content structure. * -- cgit v1.2.3