Use configured bind_address for HTTPFetch 1634/head
authorShadowNinja <shadowninja@minetest.net>
Mon, 15 Sep 2014 00:58:21 +0000 (20:58 -0400)
committerShadowNinja <shadowninja@minetest.net>
Fri, 19 Sep 2014 01:54:23 +0000 (21:54 -0400)
src/defaultsettings.cpp
src/httpfetch.cpp

index 22e7b4dfa1b931d0c84cb9c6762e86806dbf3d22..ccde6b5779339f5246f2a00fb7157ea0ce80bcce 100644 (file)
@@ -189,7 +189,7 @@ void set_default_settings(Settings *settings)
        settings->setDefault("workaround_window_size","5");
        settings->setDefault("max_packets_per_iteration","1024");
        settings->setDefault("port", "30000");
-       settings->setDefault("bind_address","");
+       settings->setDefault("bind_address", "");
        settings->setDefault("default_game", "minetest");
        settings->setDefault("motd", "");
        settings->setDefault("max_users", "15");
index f61dbbf71a1d473ba4f6ea3294b4405511b06ab9..47e33480b2f96808e98e21668b1b0c331ff0e55a 100644 (file)
@@ -221,6 +221,11 @@ HTTPFetchOngoing::HTTPFetchOngoing(HTTPFetchRequest request_, CurlHandlePool *po
        curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);
        curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 1);
 
+       std::string bind_address = g_settings->get("bind_address");
+       if (!bind_address.empty()) {
+               curl_easy_setopt(curl, CURLOPT_INTERFACE, bind_address.c_str());
+       }
+
 #if LIBCURL_VERSION_NUM >= 0x071304
        // Restrict protocols so that curl vulnerabilities in
        // other protocols don't affect us.