137 signed char retVal = 0;
138 struct FtpFile ftpfile = {destPath, 0, destBuf};
144 struct MyProgressData pd;
148 curl_easy_setopt(
session, CURLOPT_URL, sourceURL);
150 SWBuf credentials =
u +
":" +
p;
151 curl_easy_setopt(
session, CURLOPT_USERPWD, credentials.
c_str());
154 curl_easy_setopt(
session, CURLOPT_FTPPORT,
"-");
155 curl_easy_setopt(
session, CURLOPT_NOPROGRESS, 0);
156 curl_easy_setopt(
session, CURLOPT_PROGRESSDATA, &pd);
162 curl_easy_setopt(
session, CURLOPT_FILE, &ftpfile);
165 curl_easy_setopt(
session, CURLOPT_VERBOSE,
true);
175 #if (LIBCURL_VERSION_MAJOR > 7) || \
176 ((LIBCURL_VERSION_MAJOR == 7) && (LIBCURL_VERSION_MINOR > 10)) || \
177 ((LIBCURL_VERSION_MAJOR == 7) && (LIBCURL_VERSION_MINOR == 10) && (LIBCURL_VERSION_PATCH >= 5))
178 # define EPRT_AVAILABLE 1
181 #ifdef EPRT_AVAILABLE
182 curl_easy_setopt(
session, CURLOPT_FTP_USE_EPRT, 0);
183 SWLOGD(
"***** using CURLOPT_FTP_USE_EPRT\n");
187 SWLOGD(
"***** About to perform curl easy action. \n");
188 SWLOGD(
"***** destPath: %s \n", destPath);
189 SWLOGD(
"***** sourceURL: %s \n", sourceURL);
190 res = curl_easy_perform(
session);
191 SWLOGD(
"***** Finished performing curl easy action. \n");
194 curl_easy_setopt(
session, CURLOPT_PROGRESSDATA, (
void*)
NULL);
196 if (CURLE_OK != res) {
197 if (CURLE_OPERATION_TIMEDOUT == res
199 #ifdef CURLE_FTP_ACCEPT_TIMEOUT
200 || CURLE_FTP_ACCEPT_TIMEOUT == res
static int my_trace(CURL *handle, curl_infotype type, unsigned char *data, size_t size, void *userp)
static void closeFile(int fd)
static int my_fwrite(void *buffer, size_t size, size_t nmemb, void *stream)
static int my_fprogress(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow)
const char * c_str() const
StatusReporter * statusReporter