_NativeFrameworkDSException::_NativeFrameworkDSException(string errorMessage, string filename, string function, int line){ this -> errorMessage = errorMessage; this -> filename = filename; this -> function = function; this -> line = line; _printError(); }
void CachedImage::download() { if (_url.isEmpty() || isDownloading()) return; if (_available) { emit available(); return; } if (_headReply) _headReply->abort(); _reply = _man->web()->get(QNetworkRequest(_url)); Q_TEST(connect(_reply, SIGNAL(finished()), this, SLOT(_saveData()))); Q_TEST(connect(_reply, SIGNAL(downloadProgress(qint64,qint64)), this, SLOT(_changeBytes(qint64,qint64)))); Q_TEST(connect(_reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(_printError(QNetworkReply::NetworkError)))); Q_TEST(connect(_reply, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(_printErrors(QList<QSslError>)))); emit downloadingChanged(); }
void CachedImage::getInfo() { if (_headReply || _reply) return; _headReply = _man->web()->head(QNetworkRequest(_url)); Q_TEST(connect(_headReply, SIGNAL(finished()), this, SLOT(_setProperties()))); Q_TEST(connect(_headReply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(_printError(QNetworkReply::NetworkError)))); Q_TEST(connect(_headReply, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(_printErrors(QList<QSslError>)))); }
//----------------------------------------------------------------// void MOAIHttpTaskInfo::InitForGet ( cc8* url, cc8* useragent, bool verbose ) { this->Clear (); CURLcode result; CURL* easyHandle = curl_easy_init (); result = curl_easy_setopt ( easyHandle, CURLOPT_URL, url ); _printError ( result ); result = curl_easy_setopt ( easyHandle, CURLOPT_HEADERFUNCTION, _writeHeader ); _printError ( result ); result = curl_easy_setopt ( easyHandle, CURLOPT_HEADERDATA, this ); _printError ( result ); result = curl_easy_setopt ( easyHandle, CURLOPT_WRITEFUNCTION, _writeData ); _printError ( result ); result = curl_easy_setopt ( easyHandle, CURLOPT_WRITEDATA, this ); _printError ( result ); result = curl_easy_setopt ( easyHandle, CURLOPT_FAILONERROR, 1 ); _printError ( result ); result = curl_easy_setopt ( easyHandle, CURLOPT_NOPROGRESS, 1 ); _printError ( result ); result = curl_easy_setopt ( easyHandle, CURLOPT_SSL_VERIFYPEER, 0 ); _printError ( result ); result = curl_easy_setopt ( easyHandle, CURLOPT_SSL_VERIFYHOST, 0 ); _printError ( result ); if ( useragent ) { result = curl_easy_setopt ( easyHandle, CURLOPT_USERAGENT, useragent ); _printError ( result ); } if ( verbose ) { result = curl_easy_setopt ( easyHandle, CURLOPT_VERBOSE, 1 ); _printError ( result ); } this->mEasyHandle = easyHandle; this->mUrl = url; }
//----------------------------------------------------------------// void MOAIHttpTaskInfo::InitForPost ( cc8* url, cc8* useragent, const void* buffer, u32 size, bool verbose ) { this->Clear (); CURLcode result; CURL* easyHandle = curl_easy_init (); result = curl_easy_setopt ( easyHandle, CURLOPT_URL, url ); _printError ( result ); result = curl_easy_setopt ( easyHandle, CURLOPT_POSTFIELDS, buffer ); _printError ( result ); result = curl_easy_setopt ( easyHandle, CURLOPT_POSTFIELDSIZE, ( long )size ); _printError ( result ); /* curl_httppost* formpost = 0; curl_httppost* lastptr = 0; curl_formadd ( &formpost, &lastptr, CURLFORM_COPYNAME, "uploaded", //CURLFORM_CONTENTTYPE, "multipart/form-data", CURLFORM_FILENAME, filename, CURLFORM_COPYCONTENTS, buffer, CURLFORM_CONTENTSLENGTH, ( long )size, CURLFORM_END ); curl_easy_setopt ( easyHandle, CURLOPT_URL, url ); curl_easy_setopt ( easyHandle, CURLOPT_HTTPPOST, formpost ); */ result = curl_easy_setopt ( easyHandle, CURLOPT_WRITEFUNCTION, _writeData ); _printError ( result ); result = curl_easy_setopt ( easyHandle, CURLOPT_WRITEDATA, this ); _printError ( result ); result = curl_easy_setopt ( easyHandle, CURLOPT_FAILONERROR, 1 ); _printError ( result ); result = curl_easy_setopt ( easyHandle, CURLOPT_NOPROGRESS, 1 ); _printError ( result ); result = curl_easy_setopt ( easyHandle, CURLOPT_SSL_VERIFYPEER, 0 ); _printError ( result ); result = curl_easy_setopt ( easyHandle, CURLOPT_SSL_VERIFYHOST, 0 ); _printError ( result ); if ( useragent ) { result = curl_easy_setopt ( easyHandle, CURLOPT_USERAGENT, useragent ); _printError ( result ); } if ( verbose ) { result = curl_easy_setopt ( easyHandle, CURLOPT_VERBOSE, 1 ); _printError ( result ); } this->mEasyHandle = easyHandle; this->mUrl = url; }