Remove POSIX backtraces; move ScopedTemporary into its own file.
[dcpomatic.git] / src / lib / internet.cc
index c28e650fdd92f4514bb850dacd13c7869b040ad4..b45eaabf7580ec2c74a0d0559d3b0ed54b377223 100644 (file)
@@ -23,7 +23,8 @@
 #include <boost/filesystem.hpp>
 #include <curl/curl.h>
 #include <zip.h>
-#include "util.h"
+#include "scoped_temporary.h"
+#include "compose.hpp"
 #include "safe_stringstream.h"
 
 #include "i18n.h"
@@ -56,6 +57,8 @@ get_from_zip_url (string url, string file, function<void (boost::filesystem::pat
        curl_easy_setopt (curl, CURLOPT_WRITEFUNCTION, get_from_zip_url_data);
        curl_easy_setopt (curl, CURLOPT_WRITEDATA, f);
        curl_easy_setopt (curl, CURLOPT_FTP_USE_EPSV, 0);
+       /* Maximum time is 20s */
+       curl_easy_setopt (curl, CURLOPT_TIMEOUT, 20);
 
        CURLcode const cr = curl_easy_perform (curl);
 
@@ -117,6 +120,8 @@ ftp_ls (string url)
                url += "/";
        }
        curl_easy_setopt (curl, CURLOPT_URL, url.c_str ());
+       /* 20s timeout */
+       curl_easy_setopt (curl, CURLOPT_TIMEOUT, 20);
 
        string ls_raw;
        struct curl_slist* commands = 0;