]> spindle.queued.net Git - midori/commitdiff
Restrict res_server to listen only to localhost
authorAlexander Butenko <a.butenka@gmail.com>
Tue, 5 May 2009 21:32:38 +0000 (23:32 +0200)
committerChristian Dywan <christian@twotoasts.de>
Tue, 5 May 2009 21:32:38 +0000 (23:32 +0200)
midori/sokoke.c

index 4af14af64a4c1d855f8aecc7a4648dbb502f6aa2..49a99a440bab222d6d0faeca9da9cbeb3cbf87b0 100644 (file)
@@ -980,12 +980,6 @@ 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);
@@ -1017,12 +1011,16 @@ SoupServer*
 sokoke_get_res_server (void)
 {
     static SoupServer* res_server = NULL;
+    SoupAddress* addr = NULL;
 
     if (G_UNLIKELY (!res_server))
     {
-        res_server = soup_server_new ("port", SOUP_ADDRESS_ANY_PORT, NULL);
+        addr = soup_address_new ("localhost", SOUP_ADDRESS_ANY_PORT);
+        soup_address_resolve_sync (addr, NULL);
+        res_server = soup_server_new ("interface", addr, NULL);
+        g_object_unref (addr);
         soup_server_add_handler (res_server, "/",
-            res_server_handler_cb, NULL, NULL);
+                                 res_server_handler_cb, NULL, NULL);
         soup_server_run_async (res_server);
     }