From c5eba36cf41a73238d2721e7f86ca0c0a4791ba4 Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Mon, 4 May 2009 01:09:52 +0200 Subject: [PATCH] Reject non-local requests to the res_server This sever is solely meant to provide internal resources and should not be accessible from outside, so anything non-local is blocked with a No Content error. --- midori/sokoke.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/midori/sokoke.c b/midori/sokoke.c index c144aa79..4af14af6 100644 --- a/midori/sokoke.c +++ b/midori/sokoke.c @@ -980,6 +980,12 @@ res_server_handler_cb (SoupServer* res_server, SoupClientContext* client, gpointer data) { + if (g_strcmp0 (soup_message_get_uri (msg)->host, "localhost")) + { + soup_message_set_status (msg, 204); + return; + } + if (g_str_has_prefix (path, "/res")) { gchar* filename = g_strconcat (DATADIR "/midori", path, NULL); @@ -995,7 +1001,7 @@ res_server_handler_cb (SoupServer* res_server, soup_message_set_response (msg, mime_type, SOUP_MEMORY_TAKE, contents, length); g_free (mime_type); - soup_message_set_status (msg, 401); + soup_message_set_status (msg, 200); } else soup_message_set_status (msg, 404);