#include <xercesc/util/TranscodingException.hpp>
#include <xercesc/util/PlatformUtils.hpp>
+#include <xmltooling/logging.h>
#include <xmltooling/util/CurlURLInputStream.hpp>
using namespace xmltooling;
curl_easy_setopt(fEasy, CURLOPT_URL, fURL.get());
curl_easy_setopt(fEasy, CURLOPT_WRITEDATA, this); // Pass this pointer to write function
curl_easy_setopt(fEasy, CURLOPT_WRITEFUNCTION, staticWriteCallback); // Our static write function
+ curl_easy_setopt(fEasy, CURLOPT_CONNECTTIMEOUT, 15);
+ curl_easy_setopt(fEasy, CURLOPT_TIMEOUT, 30);
+ curl_easy_setopt(fEasy, CURLOPT_SSLVERSION, CURL_SSLVERSION_SSLv3);
+ curl_easy_setopt(fEasy, CURLOPT_SSL_VERIFYHOST, 0);
+ curl_easy_setopt(fEasy, CURLOPT_SSL_VERIFYPEER, 0);
+ curl_easy_setopt(fEasy, CURLOPT_NOPROGRESS, 1);
+ curl_easy_setopt(fEasy, CURLOPT_NOSIGNAL, 1);
+ curl_easy_setopt(fEasy, CURLOPT_FAILONERROR, 1);
// Add easy handle to the multi stack
curl_multi_add_handle(fMulti, fEasy);
break;
default:
+ logging::Category::getInstance(XMLTOOLING_LOGCAT"libcurl.NetAccessor").error(
+ "curl NetAccessor encountered error from libcurl (%d)", msg->data.result
+ );
ThrowXMLwithMemMgr1(NetAccessorException, XMLExcepts::NetAcc_InternalError, fURLSource.getURLText(), fMemoryManager);
break;
}
// read any yet on this invocation, call select to wait for data
if (!tryAgain && fBytesRead == 0)
{
- fd_set readSet[16];
- fd_set writeSet[16];
- fd_set exceptSet[16];
- int fdcnt = 16;
+ fd_set readSet;
+ fd_set writeSet;
+ fd_set exceptSet;
+ int fdcnt=0;
- // As curl for the file descriptors to wait on
- (void) curl_multi_fdset(fMulti, readSet, writeSet, exceptSet, &fdcnt);
+ // Ask curl for the file descriptors to wait on
+ FD_ZERO(&readSet);
+ FD_ZERO(&writeSet);
+ FD_ZERO(&exceptSet);
+ (void) curl_multi_fdset(fMulti, &readSet, &writeSet, &exceptSet, &fdcnt);
// Wait on the file descriptors
timeval tv;
tv.tv_sec = 2;
tv.tv_usec = 0;
- (void) select(fdcnt, readSet, writeSet, exceptSet, &tv);
+ (void) select(fdcnt+1, &readSet, &writeSet, &exceptSet, &tv);
}
}