From 8852333eb3042580592ade478e5def20f8ed5d4c Mon Sep 17 00:00:00 2001 From: ShadowNinja Date: Sun, 14 Sep 2014 20:58:21 -0400 Subject: [PATCH] Use configured bind_address for HTTPFetch --- src/defaultsettings.cpp | 2 +- src/httpfetch.cpp | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index 22e7b4df..ccde6b57 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -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"); diff --git a/src/httpfetch.cpp b/src/httpfetch.cpp index f61dbbf7..47e33480 100644 --- a/src/httpfetch.cpp +++ b/src/httpfetch.cpp @@ -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.