From fc14fb7a0bc93994bfb73af3d3f8b440202cd8e0 Mon Sep 17 00:00:00 2001 From: Alexander Butenko Date: Tue, 5 May 2009 23:32:38 +0200 Subject: [PATCH] Restrict res_server to listen only to localhost --- midori/sokoke.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/midori/sokoke.c b/midori/sokoke.c index 4af14af6..49a99a44 100644 --- a/midori/sokoke.c +++ b/midori/sokoke.c @@ -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); } -- 2.39.5