116 signed char retVal = 0;
117 struct FtpFile ftpfile = {destPath, 0, destBuf};
122 curl_easy_setopt(
session, CURLOPT_URL, sourceURL);
124 SWBuf credentials =
u +
":" +
p;
125 curl_easy_setopt(
session, CURLOPT_USERPWD, credentials.
c_str());
128 curl_easy_setopt(
session, CURLOPT_FTPPORT,
"-");
129 curl_easy_setopt(
session, CURLOPT_NOPROGRESS, 0);
130 curl_easy_setopt(
session, CURLOPT_FAILONERROR, 1);
135 curl_easy_setopt(
session, CURLOPT_FILE, &ftpfile);
138 curl_easy_setopt(
session, CURLOPT_VERBOSE,
true);
149 curl_easy_setopt(
session, CURLOPT_SSL_VERIFYPEER,
false);
154 #if (LIBCURL_VERSION_MAJOR > 7) || \
155 ((LIBCURL_VERSION_MAJOR == 7) && (LIBCURL_VERSION_MINOR > 10)) || \
156 ((LIBCURL_VERSION_MAJOR == 7) && (LIBCURL_VERSION_MINOR == 10) && (LIBCURL_VERSION_PATCH >= 5))
157 # define EPRT_AVAILABLE 1
160 #ifdef EPRT_AVAILABLE
161 curl_easy_setopt(
session, CURLOPT_FTP_USE_EPRT, 0);
162 SWLOGD(
"***** using CURLOPT_FTP_USE_EPRT\n");
166 SWLOGD(
"***** About to perform curl easy action. \n");
167 SWLOGD(
"***** destPath: %s \n", destPath);
168 SWLOGD(
"***** sourceURL: %s \n", sourceURL);
169 res = curl_easy_perform(
session);
170 SWLOGD(
"***** Finished performing curl easy action. \n");
172 if(CURLE_OK != res) {
173 if (CURLE_OPERATION_TIMEDOUT == res
174 #ifdef CURLE_FTP_ACCEPT_TIMEOUT
175 || CURLE_FTP_ACCEPT_TIMEOUT == res
static void closeFile(int fd)
static int my_httpfprogress(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow)
const char * c_str() const
bool isUnverifiedPeerAllowed()
static int my_httpfwrite(void *buffer, size_t size, size_t nmemb, void *stream)
static int myhttp_trace(CURL *handle, curl_infotype type, unsigned char *data, size_t size, void *userp)
StatusReporter * statusReporter