From b6dde648759f66da9d6d02cf38b405704bbd0b1e Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Mon, 4 May 2009 00:51:14 +0200 Subject: [PATCH] Return the correct content type in res_server responses --- midori/sokoke.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/midori/sokoke.c b/midori/sokoke.c index 1af7289d..c144aa79 100644 --- a/midori/sokoke.c +++ b/midori/sokoke.c @@ -984,13 +984,17 @@ res_server_handler_cb (SoupServer* res_server, { gchar* filename = g_strconcat (DATADIR "/midori", path, NULL); gchar* contents; - guint length; + gsize length; if (g_file_get_contents (filename, &contents, &length, NULL)) { - /* FIXME: Support any MIME type */ - soup_message_set_response (msg, "image/png", SOUP_MEMORY_TAKE, + gchar* content_type = g_content_type_guess (filename, (guchar*)contents, + length, NULL); + gchar* mime_type = g_content_type_get_mime_type (content_type); + g_free (content_type); + soup_message_set_response (msg, mime_type, SOUP_MEMORY_TAKE, contents, length); + g_free (mime_type); soup_message_set_status (msg, 401); } else