diff options
| author | Carl Hetherington <cth@carlh.net> | 2018-02-27 22:56:42 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2018-02-27 22:56:42 +0000 |
| commit | f508191f9d794e7762270d19a4211739470cfe0d (patch) | |
| tree | f6deb3d3bb14e7d52dbbfe528481f6c9b6120f7b /src/lib/internet.cc | |
| parent | cb0d899ec71a854e8d54213245812702d85b5670 (diff) | |
Remove some unused code.
Diffstat (limited to 'src/lib/internet.cc')
| -rw-r--r-- | src/lib/internet.cc | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/src/lib/internet.cc b/src/lib/internet.cc index 67f6ed2bc..c1bb5e88f 100644 --- a/src/lib/internet.cc +++ b/src/lib/internet.cc @@ -126,68 +126,3 @@ get_from_zip_url (string url, string file, bool pasv, function<void (boost::file load (temp_cert.file ()); return optional<string> (); } - -static size_t -ftp_ls_data (void* buffer, size_t size, size_t nmemb, void* data) -{ - string* s = reinterpret_cast<string *> (data); - uint8_t* b = reinterpret_cast<uint8_t *> (buffer); - for (size_t i = 0; i < (size * nmemb); ++i) { - *s += b[i]; - } - return size * nmemb; -} - -list<string> -ftp_ls (string url, bool pasv) -{ - CURL* curl = curl_easy_init (); - if (!curl) { - throw NetworkError ("could not set up curl"); - } - - if (url.substr (url.length() - 1, 1) != "/") { - 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; - commands = curl_slist_append (commands, "NLST"); - curl_easy_setopt (curl, CURLOPT_POSTQUOTE, commands); - curl_easy_setopt (curl, CURLOPT_WRITEDATA, &ls_raw); - curl_easy_setopt (curl, CURLOPT_WRITEFUNCTION, ftp_ls_data); - curl_easy_setopt (curl, CURLOPT_FTP_USE_EPSV, 0); - curl_easy_setopt (curl, CURLOPT_FTP_USE_EPRT, 0); - curl_easy_setopt (curl, CURLOPT_VERBOSE, 1); - if (!pasv) { - curl_easy_setopt (curl, CURLOPT_FTPPORT, "-"); - } - CURLcode const r = curl_easy_perform (curl); - if (r != CURLE_OK) { - curl_easy_cleanup (curl); - throw NetworkError (curl_easy_strerror (r)); - } - - list<string> ls; - string line; - for (size_t i = 0; i < ls_raw.length(); ++i) { - line += ls_raw[i]; - if (ls_raw[i] == '\n') { - trim (line); - if (line.length() > 55) { - string const file = line.substr (55); - if (file != "." && file != "..") { - ls.push_back (file); - } - } - line = ""; - } - } - - curl_easy_cleanup (curl); - - return ls; -} |
