]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/convert_json.cpp
FIx wrong error message on invalid use of the formspec element image_button
[dragonfireclient.git] / src / convert_json.cpp
index 71cba06954e47fbca5fc2c1bfc4b99dc58e6a1a5..61db67fd55808a2cc907c81c956ca77f739c92da 100644 (file)
@@ -25,6 +25,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "mods.h"
 #include "config.h"
 #include "log.h"
+#include "main.h" // for g_settings
+#include "settings.h"
 
 #if USE_CURL
 #include <curl/curl.h>
@@ -52,11 +54,12 @@ Json::Value                 fetchJsonValue(const std::string url,
                curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
                curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
                curl_easy_setopt(curl, CURLOPT_WRITEDATA, &liststring);
+               curl_easy_setopt(curl, CURLOPT_TIMEOUT_MS, g_settings->getS32("curl_timeout"));
+               curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT_MS, g_settings->getS32("curl_timeout"));
 
                if (chunk != 0)
                        curl_easy_setopt(curl, CURLOPT_HTTPHEADER, chunk);
 
-
                res = curl_easy_perform(curl);
                if (res != CURLE_OK)
                        errorstream<<"Jsonreader: "<< url <<" not found (" << curl_easy_strerror(res) << ")" <<std::endl;