aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/defaultsettings.cpp2
-rw-r--r--src/httpfetch.cpp5
2 files changed, 6 insertions, 1 deletions
diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp
index 22e7b4dfa..ccde6b577 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 f61dbbf71..47e33480b 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.
n> if type(a) == "table" then assert(a.x and a.y and a.z, "Invalid vector passed to vector.new()") return {x=a.x, y=a.y, z=a.z} elseif a then assert(b and c, "Invalid arguments for vector.new()") return {x=a, y=b, z=c} end return {x=0, y=0, z=0} end function vector.equals(a, b) return a.x == b.x and a.y == b.y and a.z == b.z end function vector.length(v) return math.hypot(v.x, math.hypot(v.y, v.z)) end function vector.normalize(v) local len = vector.length(v) if len == 0 then return {x=0, y=0, z=0} else return vector.divide(v, len) end end function vector.round(v) return { x = math.floor(v.x + 0.5), y = math.floor(v.y + 0.5), z = math.floor(v.z + 0.5) } end function vector.apply(v, func) return { x = func(v.x), y = func(v.y), z = func(v.z) } end function vector.distance(a, b) local x = a.x - b.x local y = a.y - b.y local z = a.z - b.z return math.hypot(x, math.hypot(y, z)) end function vector.direction(pos1, pos2) local x_raw = pos2.x - pos1.x local y_raw = pos2.y - pos1.y local z_raw = pos2.z - pos1.z local x_abs = math.abs(x_raw) local y_abs = math.abs(y_raw) local z_abs = math.abs(z_raw) if x_abs >= y_abs and x_abs >= z_abs then y_raw = y_raw * (1 / x_abs) z_raw = z_raw * (1 / x_abs) x_raw = x_raw / x_abs end if y_abs >= x_abs and y_abs >= z_abs then x_raw = x_raw * (1 / y_abs) z_raw = z_raw * (1 / y_abs) y_raw = y_raw / y_abs end if z_abs >= y_abs and z_abs >= x_abs then x_raw = x_raw * (1 / z_abs) y_raw = y_raw * (1 / z_abs) z_raw = z_raw / z_abs end return {x=x_raw, y=y_raw, z=z_raw} end function vector.add(a, b) if type(b) == "table" then return {x = a.x + b.x, y = a.y + b.y, z = a.z + b.z} else return {x = a.x + b, y = a.y + b, z = a.z + b} end end function vector.subtract(a, b) if type(b) == "table" then return {x = a.x - b.x, y = a.y - b.y, z = a.z - b.z} else return {x = a.x - b, y = a.y - b, z = a.z - b} end end function vector.multiply(a, b) if type(b) == "table" then return {x = a.x * b.x, y = a.y * b.y, z = a.z * b.z} else return {x = a.x * b, y = a.y * b, z = a.z * b} end end function vector.divide(a, b) if type(b) == "table" then return {x = a.x / b.x, y = a.y / b.y, z = a.z / b.z} else return {x = a.x / b, y = a.y / b, z = a.z / b} end end