Return the correct content type in res_server responses
This commit is contained in:
parent
6ab464075d
commit
b6dde64875
1 changed files with 7 additions and 3 deletions
|
@ -984,13 +984,17 @@ res_server_handler_cb (SoupServer* res_server,
|
||||||
{
|
{
|
||||||
gchar* filename = g_strconcat (DATADIR "/midori", path, NULL);
|
gchar* filename = g_strconcat (DATADIR "/midori", path, NULL);
|
||||||
gchar* contents;
|
gchar* contents;
|
||||||
guint length;
|
gsize length;
|
||||||
|
|
||||||
if (g_file_get_contents (filename, &contents, &length, NULL))
|
if (g_file_get_contents (filename, &contents, &length, NULL))
|
||||||
{
|
{
|
||||||
/* FIXME: Support any MIME type */
|
gchar* content_type = g_content_type_guess (filename, (guchar*)contents,
|
||||||
soup_message_set_response (msg, "image/png", SOUP_MEMORY_TAKE,
|
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);
|
contents, length);
|
||||||
|
g_free (mime_type);
|
||||||
soup_message_set_status (msg, 401);
|
soup_message_set_status (msg, 401);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue