]> spindle.queued.net Git - midori/commitdiff
Reject non-local requests to the res_server
authorChristian Dywan <christian@twotoasts.de>
Sun, 3 May 2009 23:09:52 +0000 (01:09 +0200)
committerChristian Dywan <christian@twotoasts.de>
Sun, 3 May 2009 23:09:52 +0000 (01:09 +0200)
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

index c144aa79d3897be13b5303eb473fdbb0a233c4a6..4af14af64a4c1d855f8aecc7a4648dbb502f6aa2 100644 (file)
@@ -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);