mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-06-06 23:22:40 +02:00
2018-07-30 Fred Gleason <fredg@paravelsystems.com>
* Cleaned up memory leaks in 'RDAudioExport', 'RDAudioImport', 'RDAudioStore', 'RDCart', 'RDCopyAudio', 'RDPeakExport', 'RDRehash', and 'RDTrimAudio'. * Modified Xload operations in 'RDDelete', 'RDDownload' and 'RDUpload' to work properly with credentials using UTF-8 strings.
This commit is contained in:
parent
0605d2ff83
commit
5482e87e23
@ -17269,3 +17269,9 @@
|
|||||||
* Modified 'RDRehash' to use multipart-mime encoding.
|
* Modified 'RDRehash' to use multipart-mime encoding.
|
||||||
2018-07-30 Fred Gleason <fredg@paravelsystems.com>
|
2018-07-30 Fred Gleason <fredg@paravelsystems.com>
|
||||||
* Modified 'RDTrimAudio' to use multipart-mime encoding.
|
* Modified 'RDTrimAudio' to use multipart-mime encoding.
|
||||||
|
2018-07-30 Fred Gleason <fredg@paravelsystems.com>
|
||||||
|
* Cleaned up memory leaks in 'RDAudioExport', 'RDAudioImport',
|
||||||
|
'RDAudioStore', 'RDCart', 'RDCopyAudio', 'RDPeakExport',
|
||||||
|
'RDRehash', and 'RDTrimAudio'.
|
||||||
|
* Modified Xload operations in 'RDDelete', 'RDDownload' and
|
||||||
|
'RDUpload' to work properly with credentials using UTF-8 strings.
|
||||||
|
@ -196,6 +196,7 @@ RDAudioExport::ErrorCode RDAudioExport::runExport(const QString &username,
|
|||||||
(const char *)QString().sprintf("%u",conv_enable_metadata),
|
(const char *)QString().sprintf("%u",conv_enable_metadata),
|
||||||
CURLFORM_END);
|
CURLFORM_END);
|
||||||
if((curl=curl_easy_init())==NULL) {
|
if((curl=curl_easy_init())==NULL) {
|
||||||
|
curl_formfree(first);
|
||||||
return RDAudioExport::ErrorInternal;
|
return RDAudioExport::ErrorInternal;
|
||||||
}
|
}
|
||||||
if((f=fopen(conv_dst_filename,"w"))==NULL) {
|
if((f=fopen(conv_dst_filename,"w"))==NULL) {
|
||||||
@ -226,6 +227,7 @@ RDAudioExport::ErrorCode RDAudioExport::runExport(const QString &username,
|
|||||||
|
|
||||||
case CURLE_ABORTED_BY_CALLBACK:
|
case CURLE_ABORTED_BY_CALLBACK:
|
||||||
curl_easy_cleanup(curl);
|
curl_easy_cleanup(curl);
|
||||||
|
curl_formfree(first);
|
||||||
unlink(conv_dst_filename);
|
unlink(conv_dst_filename);
|
||||||
return RDAudioExport::ErrorAborted;
|
return RDAudioExport::ErrorAborted;
|
||||||
|
|
||||||
@ -240,6 +242,7 @@ RDAudioExport::ErrorCode RDAudioExport::runExport(const QString &username,
|
|||||||
case CURLE_HTTP_POST_ERROR:
|
case CURLE_HTTP_POST_ERROR:
|
||||||
default:
|
default:
|
||||||
curl_easy_cleanup(curl);
|
curl_easy_cleanup(curl);
|
||||||
|
curl_formfree(first);
|
||||||
return RDAudioExport::ErrorInternal;
|
return RDAudioExport::ErrorInternal;
|
||||||
|
|
||||||
case CURLE_URL_MALFORMAT:
|
case CURLE_URL_MALFORMAT:
|
||||||
@ -247,6 +250,7 @@ RDAudioExport::ErrorCode RDAudioExport::runExport(const QString &username,
|
|||||||
case CURLE_COULDNT_CONNECT:
|
case CURLE_COULDNT_CONNECT:
|
||||||
case 9: // CURLE_REMOTE_ACCESS_DENIED:
|
case 9: // CURLE_REMOTE_ACCESS_DENIED:
|
||||||
curl_easy_cleanup(curl);
|
curl_easy_cleanup(curl);
|
||||||
|
curl_formfree(first);
|
||||||
return RDAudioExport::ErrorUrlInvalid;
|
return RDAudioExport::ErrorUrlInvalid;
|
||||||
}
|
}
|
||||||
curl_easy_getinfo(curl,CURLINFO_RESPONSE_CODE,&response_code);
|
curl_easy_getinfo(curl,CURLINFO_RESPONSE_CODE,&response_code);
|
||||||
@ -255,6 +259,8 @@ RDAudioExport::ErrorCode RDAudioExport::runExport(const QString &username,
|
|||||||
|
|
||||||
if(response_code==200) {
|
if(response_code==200) {
|
||||||
*conv_err=RDAudioConvert::ErrorOk;
|
*conv_err=RDAudioConvert::ErrorOk;
|
||||||
|
curl_easy_cleanup(curl);
|
||||||
|
curl_formfree(first);
|
||||||
return RDAudioExport::ErrorOk;
|
return RDAudioExport::ErrorOk;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -274,6 +280,8 @@ RDAudioExport::ErrorCode RDAudioExport::runExport(const QString &username,
|
|||||||
default:
|
default:
|
||||||
ret=RDAudioExport::ErrorConverter;
|
ret=RDAudioExport::ErrorConverter;
|
||||||
}
|
}
|
||||||
|
curl_easy_cleanup(curl);
|
||||||
|
curl_formfree(first);
|
||||||
unlink(conv_dst_filename);
|
unlink(conv_dst_filename);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -163,6 +163,7 @@ RDAudioImport::ErrorCode RDAudioImport::runImport(const QString &username,
|
|||||||
// Set up the transfer
|
// Set up the transfer
|
||||||
//
|
//
|
||||||
if((curl=curl_easy_init())==NULL) {
|
if((curl=curl_easy_init())==NULL) {
|
||||||
|
curl_formfree(first);
|
||||||
return RDAudioImport::ErrorInternal;
|
return RDAudioImport::ErrorInternal;
|
||||||
}
|
}
|
||||||
curl_easy_setopt(curl,CURLOPT_WRITEDATA,stdout);
|
curl_easy_setopt(curl,CURLOPT_WRITEDATA,stdout);
|
||||||
@ -192,6 +193,7 @@ RDAudioImport::ErrorCode RDAudioImport::runImport(const QString &username,
|
|||||||
|
|
||||||
case CURLE_ABORTED_BY_CALLBACK:
|
case CURLE_ABORTED_BY_CALLBACK:
|
||||||
curl_easy_cleanup(curl);
|
curl_easy_cleanup(curl);
|
||||||
|
curl_formfree(first);
|
||||||
return RDAudioImport::ErrorAborted;
|
return RDAudioImport::ErrorAborted;
|
||||||
|
|
||||||
case CURLE_UNSUPPORTED_PROTOCOL:
|
case CURLE_UNSUPPORTED_PROTOCOL:
|
||||||
@ -203,8 +205,9 @@ RDAudioImport::ErrorCode RDAudioImport::runImport(const QString &username,
|
|||||||
case CURLE_OUT_OF_MEMORY:
|
case CURLE_OUT_OF_MEMORY:
|
||||||
case CURLE_OPERATION_TIMEDOUT:
|
case CURLE_OPERATION_TIMEDOUT:
|
||||||
case CURLE_HTTP_POST_ERROR:
|
case CURLE_HTTP_POST_ERROR:
|
||||||
curl_easy_cleanup(curl);
|
|
||||||
default:
|
default:
|
||||||
|
curl_easy_cleanup(curl);
|
||||||
|
curl_formfree(first);
|
||||||
return RDAudioImport::ErrorInternal;
|
return RDAudioImport::ErrorInternal;
|
||||||
|
|
||||||
case CURLE_URL_MALFORMAT:
|
case CURLE_URL_MALFORMAT:
|
||||||
@ -212,6 +215,7 @@ RDAudioImport::ErrorCode RDAudioImport::runImport(const QString &username,
|
|||||||
case CURLE_COULDNT_CONNECT:
|
case CURLE_COULDNT_CONNECT:
|
||||||
case 9: // CURLE_REMOTE_ACCESS_DENIED:
|
case 9: // CURLE_REMOTE_ACCESS_DENIED:
|
||||||
curl_easy_cleanup(curl);
|
curl_easy_cleanup(curl);
|
||||||
|
curl_formfree(first);
|
||||||
return RDAudioImport::ErrorUrlInvalid;
|
return RDAudioImport::ErrorUrlInvalid;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
@ -138,6 +138,7 @@ RDAudioInfo::ErrorCode RDAudioInfo::runInfo(const QString &username,
|
|||||||
(const char *)QString().sprintf("%u",conv_cut_number),
|
(const char *)QString().sprintf("%u",conv_cut_number),
|
||||||
CURLFORM_END);
|
CURLFORM_END);
|
||||||
if((curl=curl_easy_init())==NULL) {
|
if((curl=curl_easy_init())==NULL) {
|
||||||
|
curl_formfree(first);
|
||||||
return RDAudioInfo::ErrorInternal;
|
return RDAudioInfo::ErrorInternal;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
@ -168,6 +169,7 @@ RDAudioInfo::ErrorCode RDAudioInfo::runInfo(const QString &username,
|
|||||||
case CURLE_OPERATION_TIMEDOUT:
|
case CURLE_OPERATION_TIMEDOUT:
|
||||||
case CURLE_HTTP_POST_ERROR:
|
case CURLE_HTTP_POST_ERROR:
|
||||||
curl_easy_cleanup(curl);
|
curl_easy_cleanup(curl);
|
||||||
|
curl_formfree(first);
|
||||||
fprintf(stderr,"curl error: %d\n",curl_err);
|
fprintf(stderr,"curl error: %d\n",curl_err);
|
||||||
return RDAudioInfo::ErrorInternal;
|
return RDAudioInfo::ErrorInternal;
|
||||||
|
|
||||||
@ -176,14 +178,17 @@ RDAudioInfo::ErrorCode RDAudioInfo::runInfo(const QString &username,
|
|||||||
case CURLE_COULDNT_CONNECT:
|
case CURLE_COULDNT_CONNECT:
|
||||||
case 9: // CURLE_REMOTE_ACCESS_DENIED
|
case 9: // CURLE_REMOTE_ACCESS_DENIED
|
||||||
curl_easy_cleanup(curl);
|
curl_easy_cleanup(curl);
|
||||||
|
curl_formfree(first);
|
||||||
return RDAudioInfo::ErrorUrlInvalid;
|
return RDAudioInfo::ErrorUrlInvalid;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
curl_easy_cleanup(curl);
|
curl_easy_cleanup(curl);
|
||||||
|
curl_formfree(first);
|
||||||
return RDAudioInfo::ErrorService;
|
return RDAudioInfo::ErrorService;
|
||||||
}
|
}
|
||||||
curl_easy_getinfo(curl,CURLINFO_RESPONSE_CODE,&response_code);
|
curl_easy_getinfo(curl,CURLINFO_RESPONSE_CODE,&response_code);
|
||||||
curl_easy_cleanup(curl);
|
curl_easy_cleanup(curl);
|
||||||
|
curl_formfree(first);
|
||||||
|
|
||||||
switch(response_code) {
|
switch(response_code) {
|
||||||
case 200:
|
case 200:
|
||||||
|
@ -89,6 +89,7 @@ RDAudioStore::ErrorCode RDAudioStore::runStore(const QString &username,
|
|||||||
curl_formadd(&first,&last,CURLFORM_PTRNAME,"PASSWORD",
|
curl_formadd(&first,&last,CURLFORM_PTRNAME,"PASSWORD",
|
||||||
CURLFORM_COPYCONTENTS,(const char *)password,CURLFORM_END);
|
CURLFORM_COPYCONTENTS,(const char *)password,CURLFORM_END);
|
||||||
if((curl=curl_easy_init())==NULL) {
|
if((curl=curl_easy_init())==NULL) {
|
||||||
|
curl_formfree(first);
|
||||||
return RDAudioStore::ErrorInternal;
|
return RDAudioStore::ErrorInternal;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,6 +121,7 @@ RDAudioStore::ErrorCode RDAudioStore::runStore(const QString &username,
|
|||||||
case CURLE_OPERATION_TIMEDOUT:
|
case CURLE_OPERATION_TIMEDOUT:
|
||||||
case CURLE_HTTP_POST_ERROR:
|
case CURLE_HTTP_POST_ERROR:
|
||||||
curl_easy_cleanup(curl);
|
curl_easy_cleanup(curl);
|
||||||
|
curl_formfree(first);
|
||||||
fprintf(stderr,"curl error: %d\n",curl_err);
|
fprintf(stderr,"curl error: %d\n",curl_err);
|
||||||
return RDAudioStore::ErrorInternal;
|
return RDAudioStore::ErrorInternal;
|
||||||
|
|
||||||
@ -128,14 +130,17 @@ RDAudioStore::ErrorCode RDAudioStore::runStore(const QString &username,
|
|||||||
case CURLE_COULDNT_CONNECT:
|
case CURLE_COULDNT_CONNECT:
|
||||||
case 9: // CURLE_REMOTE_ACCESS_DENIED
|
case 9: // CURLE_REMOTE_ACCESS_DENIED
|
||||||
curl_easy_cleanup(curl);
|
curl_easy_cleanup(curl);
|
||||||
|
curl_formfree(first);
|
||||||
return RDAudioStore::ErrorUrlInvalid;
|
return RDAudioStore::ErrorUrlInvalid;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
curl_easy_cleanup(curl);
|
curl_easy_cleanup(curl);
|
||||||
|
curl_formfree(first);
|
||||||
return RDAudioStore::ErrorService;
|
return RDAudioStore::ErrorService;
|
||||||
}
|
}
|
||||||
curl_easy_getinfo(curl,CURLINFO_RESPONSE_CODE,&response_code);
|
curl_easy_getinfo(curl,CURLINFO_RESPONSE_CODE,&response_code);
|
||||||
curl_easy_cleanup(curl);
|
curl_easy_cleanup(curl);
|
||||||
|
curl_formfree(first);
|
||||||
|
|
||||||
switch(response_code) {
|
switch(response_code) {
|
||||||
case 200:
|
case 200:
|
||||||
|
@ -1681,6 +1681,7 @@ bool RDCart::removeCutAudio(RDStation *station,RDUser *user,unsigned cart_num,
|
|||||||
(const char *)QString().sprintf("%u",RDCut::cutNumber(cutname)),
|
(const char *)QString().sprintf("%u",RDCut::cutNumber(cutname)),
|
||||||
CURLFORM_END);
|
CURLFORM_END);
|
||||||
if((curl=curl_easy_init())==NULL) {
|
if((curl=curl_easy_init())==NULL) {
|
||||||
|
curl_formfree(first);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
@ -1700,6 +1701,7 @@ bool RDCart::removeCutAudio(RDStation *station,RDUser *user,unsigned cart_num,
|
|||||||
curl_easy_getinfo(curl,CURLINFO_RESPONSE_CODE,&response_code);
|
curl_easy_getinfo(curl,CURLINFO_RESPONSE_CODE,&response_code);
|
||||||
ret&=response_code==200;
|
ret&=response_code==200;
|
||||||
curl_easy_cleanup(curl);
|
curl_easy_cleanup(curl);
|
||||||
|
curl_formfree(first);
|
||||||
}
|
}
|
||||||
#endif // WIN32
|
#endif // WIN32
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -108,6 +108,7 @@ RDCopyAudio::ErrorCode RDCopyAudio::runCopy(const QString &username,
|
|||||||
(const char *)QString().sprintf("%u",conv_destination_cut_number),
|
(const char *)QString().sprintf("%u",conv_destination_cut_number),
|
||||||
CURLFORM_END);
|
CURLFORM_END);
|
||||||
if((curl=curl_easy_init())==NULL) {
|
if((curl=curl_easy_init())==NULL) {
|
||||||
|
curl_formfree(first);
|
||||||
return RDCopyAudio::ErrorInternal;
|
return RDCopyAudio::ErrorInternal;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,6 +139,7 @@ RDCopyAudio::ErrorCode RDCopyAudio::runCopy(const QString &username,
|
|||||||
case CURLE_HTTP_POST_ERROR:
|
case CURLE_HTTP_POST_ERROR:
|
||||||
default:
|
default:
|
||||||
curl_easy_cleanup(curl);
|
curl_easy_cleanup(curl);
|
||||||
|
curl_formfree(first);
|
||||||
return RDCopyAudio::ErrorInternal;
|
return RDCopyAudio::ErrorInternal;
|
||||||
|
|
||||||
case CURLE_URL_MALFORMAT:
|
case CURLE_URL_MALFORMAT:
|
||||||
@ -145,10 +147,12 @@ RDCopyAudio::ErrorCode RDCopyAudio::runCopy(const QString &username,
|
|||||||
case CURLE_COULDNT_CONNECT:
|
case CURLE_COULDNT_CONNECT:
|
||||||
case 9: // CURLE_REMOTE_ACCESS_DENIED:
|
case 9: // CURLE_REMOTE_ACCESS_DENIED:
|
||||||
curl_easy_cleanup(curl);
|
curl_easy_cleanup(curl);
|
||||||
|
curl_formfree(first);
|
||||||
return RDCopyAudio::ErrorUrlInvalid;
|
return RDCopyAudio::ErrorUrlInvalid;
|
||||||
}
|
}
|
||||||
curl_easy_getinfo(curl,CURLINFO_RESPONSE_CODE,&response_code);
|
curl_easy_getinfo(curl,CURLINFO_RESPONSE_CODE,&response_code);
|
||||||
curl_easy_cleanup(curl);
|
curl_easy_cleanup(curl);
|
||||||
|
curl_formfree(first);
|
||||||
|
|
||||||
switch(response_code) {
|
switch(response_code) {
|
||||||
case 200:
|
case 200:
|
||||||
|
@ -98,15 +98,15 @@ RDDelete::ErrorCode RDDelete::runDelete(const QString &username,
|
|||||||
return RDDelete::ErrorInternal;
|
return RDDelete::ErrorInternal;
|
||||||
}
|
}
|
||||||
strncpy(urlstr,(const char *)(conv_target_url.protocol()+"://"+
|
strncpy(urlstr,(const char *)(conv_target_url.protocol()+"://"+
|
||||||
conv_target_url.host()+"/"),1024);
|
conv_target_url.host()+"/").utf8(),1024);
|
||||||
curl_easy_setopt(curl,CURLOPT_URL,urlstr);
|
curl_easy_setopt(curl,CURLOPT_URL,urlstr);
|
||||||
strncpy(userpwd,QString(username)+":"+password,256);
|
strncpy(userpwd,(QString(username)+":"+password).utf8(),256);
|
||||||
curl_easy_setopt(curl,CURLOPT_USERPWD,userpwd);
|
curl_easy_setopt(curl,CURLOPT_USERPWD,userpwd);
|
||||||
curl_easy_setopt(curl,CURLOPT_HTTPAUTH,CURLAUTH_ANY);
|
curl_easy_setopt(curl,CURLOPT_HTTPAUTH,CURLAUTH_ANY);
|
||||||
curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,DeleteWriteCallback);
|
curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,DeleteWriteCallback);
|
||||||
curl_easy_setopt(curl,CURLOPT_WRITEDATA,&xml);
|
curl_easy_setopt(curl,CURLOPT_WRITEDATA,&xml);
|
||||||
curl_easy_setopt(curl,CURLOPT_USERAGENT,
|
curl_easy_setopt(curl,CURLOPT_USERAGENT,
|
||||||
(const char *)conv_config->userAgent());
|
(const char *)conv_config->userAgent().utf8());
|
||||||
if(log_debug) {
|
if(log_debug) {
|
||||||
curl_easy_setopt(curl,CURLOPT_VERBOSE,1);
|
curl_easy_setopt(curl,CURLOPT_VERBOSE,1);
|
||||||
curl_easy_setopt(curl,CURLOPT_DEBUGFUNCTION,DeleteErrorCallback);
|
curl_easy_setopt(curl,CURLOPT_DEBUGFUNCTION,DeleteErrorCallback);
|
||||||
|
@ -133,10 +133,10 @@ RDDownload::ErrorCode RDDownload::runDownload(const QString &username,
|
|||||||
// error.
|
// error.
|
||||||
//
|
//
|
||||||
strncpy(url,conv_src_url.
|
strncpy(url,conv_src_url.
|
||||||
toString(conv_src_url.protocol().lower().left(4)=="http"),1024);
|
toString(conv_src_url.protocol().lower().left(4)=="http").utf8(),1024);
|
||||||
curl_easy_setopt(curl,CURLOPT_URL,url);
|
curl_easy_setopt(curl,CURLOPT_URL,url);
|
||||||
curl_easy_setopt(curl,CURLOPT_WRITEDATA,f);
|
curl_easy_setopt(curl,CURLOPT_WRITEDATA,f);
|
||||||
strncpy(userpwd,username+":"+password,256);
|
strncpy(userpwd,(username+":"+password).utf8(),256);
|
||||||
curl_easy_setopt(curl,CURLOPT_USERPWD,userpwd);
|
curl_easy_setopt(curl,CURLOPT_USERPWD,userpwd);
|
||||||
curl_easy_setopt(curl,CURLOPT_TIMEOUT,RD_CURL_TIMEOUT);
|
curl_easy_setopt(curl,CURLOPT_TIMEOUT,RD_CURL_TIMEOUT);
|
||||||
curl_easy_setopt(curl,CURLOPT_FOLLOWLOCATION,1);
|
curl_easy_setopt(curl,CURLOPT_FOLLOWLOCATION,1);
|
||||||
@ -144,7 +144,7 @@ RDDownload::ErrorCode RDDownload::runDownload(const QString &username,
|
|||||||
curl_easy_setopt(curl,CURLOPT_PROGRESSDATA,this);
|
curl_easy_setopt(curl,CURLOPT_PROGRESSDATA,this);
|
||||||
curl_easy_setopt(curl,CURLOPT_NOPROGRESS,0);
|
curl_easy_setopt(curl,CURLOPT_NOPROGRESS,0);
|
||||||
curl_easy_setopt(curl,CURLOPT_USERAGENT,
|
curl_easy_setopt(curl,CURLOPT_USERAGENT,
|
||||||
(const char *)conv_config->userAgent());
|
(const char *)conv_config->userAgent().utf8());
|
||||||
if(log_debug) {
|
if(log_debug) {
|
||||||
curl_easy_setopt(curl,CURLOPT_VERBOSE,1);
|
curl_easy_setopt(curl,CURLOPT_VERBOSE,1);
|
||||||
curl_easy_setopt(curl,CURLOPT_DEBUGFUNCTION,DownloadErrorCallback);
|
curl_easy_setopt(curl,CURLOPT_DEBUGFUNCTION,DownloadErrorCallback);
|
||||||
|
@ -115,6 +115,7 @@ RDPeaksExport::ErrorCode RDPeaksExport::runExport(const QString &username,
|
|||||||
(const char *)QString().sprintf("%u",conv_cut_number),
|
(const char *)QString().sprintf("%u",conv_cut_number),
|
||||||
CURLFORM_END);
|
CURLFORM_END);
|
||||||
if((curl=curl_easy_init())==NULL) {
|
if((curl=curl_easy_init())==NULL) {
|
||||||
|
curl_formfree(first);
|
||||||
return RDPeaksExport::ErrorInternal;
|
return RDPeaksExport::ErrorInternal;
|
||||||
}
|
}
|
||||||
curl_easy_setopt(curl,CURLOPT_WRITEDATA,this);
|
curl_easy_setopt(curl,CURLOPT_WRITEDATA,this);
|
||||||
@ -140,6 +141,7 @@ RDPeaksExport::ErrorCode RDPeaksExport::runExport(const QString &username,
|
|||||||
|
|
||||||
case CURLE_ABORTED_BY_CALLBACK:
|
case CURLE_ABORTED_BY_CALLBACK:
|
||||||
curl_easy_cleanup(curl);
|
curl_easy_cleanup(curl);
|
||||||
|
curl_formfree(first);
|
||||||
return RDPeaksExport::ErrorAborted;
|
return RDPeaksExport::ErrorAborted;
|
||||||
|
|
||||||
case CURLE_UNSUPPORTED_PROTOCOL:
|
case CURLE_UNSUPPORTED_PROTOCOL:
|
||||||
@ -153,6 +155,7 @@ RDPeaksExport::ErrorCode RDPeaksExport::runExport(const QString &username,
|
|||||||
case CURLE_HTTP_POST_ERROR:
|
case CURLE_HTTP_POST_ERROR:
|
||||||
default:
|
default:
|
||||||
curl_easy_cleanup(curl);
|
curl_easy_cleanup(curl);
|
||||||
|
curl_formfree(first);
|
||||||
return RDPeaksExport::ErrorInternal;
|
return RDPeaksExport::ErrorInternal;
|
||||||
|
|
||||||
case CURLE_URL_MALFORMAT:
|
case CURLE_URL_MALFORMAT:
|
||||||
@ -160,10 +163,12 @@ RDPeaksExport::ErrorCode RDPeaksExport::runExport(const QString &username,
|
|||||||
case CURLE_COULDNT_CONNECT:
|
case CURLE_COULDNT_CONNECT:
|
||||||
case 9: // CURLE_REMOTE_ACCESS_DENIED
|
case 9: // CURLE_REMOTE_ACCESS_DENIED
|
||||||
curl_easy_cleanup(curl);
|
curl_easy_cleanup(curl);
|
||||||
|
curl_formfree(first);
|
||||||
return RDPeaksExport::ErrorUrlInvalid;
|
return RDPeaksExport::ErrorUrlInvalid;
|
||||||
}
|
}
|
||||||
curl_easy_getinfo(curl,CURLINFO_RESPONSE_CODE,&response_code);
|
curl_easy_getinfo(curl,CURLINFO_RESPONSE_CODE,&response_code);
|
||||||
curl_easy_cleanup(curl);
|
curl_easy_cleanup(curl);
|
||||||
|
curl_formfree(first);
|
||||||
|
|
||||||
switch(response_code) {
|
switch(response_code) {
|
||||||
case 200:
|
case 200:
|
||||||
|
@ -309,13 +309,14 @@ bool RDPodcast::removeAudio(RDFeed *feed,QString *err_text,bool log_debug) const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
url=new QUrl(feed->purgeUrl());
|
url=new QUrl(feed->purgeUrl());
|
||||||
strncpy(urlstr,(const char *)(url->protocol()+"://"+url->host()+"/"),1024);
|
strncpy(urlstr,(const char *)(url->protocol()+"://"+url->host()+"/").utf8(),
|
||||||
|
1024);
|
||||||
curl_easy_setopt(curl,CURLOPT_URL,urlstr);
|
curl_easy_setopt(curl,CURLOPT_URL,urlstr);
|
||||||
strncpy(userpwd,feed->purgeUsername()+":"+feed->purgePassword(),256);
|
strncpy(userpwd,(feed->purgeUsername()+":"+feed->purgePassword()).utf8(),256);
|
||||||
curl_easy_setopt(curl,CURLOPT_USERPWD,userpwd);
|
curl_easy_setopt(curl,CURLOPT_USERPWD,userpwd);
|
||||||
curl_easy_setopt(curl,CURLOPT_HTTPAUTH,CURLAUTH_ANY);
|
curl_easy_setopt(curl,CURLOPT_HTTPAUTH,CURLAUTH_ANY);
|
||||||
curl_easy_setopt(curl,CURLOPT_USERAGENT,
|
curl_easy_setopt(curl,CURLOPT_USERAGENT,
|
||||||
(const char *)podcast_config->userAgent());
|
(const char *)podcast_config->userAgent().utf8());
|
||||||
if(log_debug) {
|
if(log_debug) {
|
||||||
curl_easy_setopt(curl,CURLOPT_VERBOSE,1);
|
curl_easy_setopt(curl,CURLOPT_VERBOSE,1);
|
||||||
curl_easy_setopt(curl,CURLOPT_DEBUGFUNCTION,PodcastErrorCallback);
|
curl_easy_setopt(curl,CURLOPT_DEBUGFUNCTION,PodcastErrorCallback);
|
||||||
|
@ -93,6 +93,7 @@ RDRehash::ErrorCode RDRehash::runRehash(const QString &username,
|
|||||||
(const char *)QString().sprintf("%u",conv_cut_number),
|
(const char *)QString().sprintf("%u",conv_cut_number),
|
||||||
CURLFORM_END);
|
CURLFORM_END);
|
||||||
if((curl=curl_easy_init())==NULL) {
|
if((curl=curl_easy_init())==NULL) {
|
||||||
|
curl_formfree(first);
|
||||||
return RDRehash::ErrorInternal;
|
return RDRehash::ErrorInternal;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,6 +124,7 @@ RDRehash::ErrorCode RDRehash::runRehash(const QString &username,
|
|||||||
case CURLE_OPERATION_TIMEDOUT:
|
case CURLE_OPERATION_TIMEDOUT:
|
||||||
case CURLE_HTTP_POST_ERROR:
|
case CURLE_HTTP_POST_ERROR:
|
||||||
curl_easy_cleanup(curl);
|
curl_easy_cleanup(curl);
|
||||||
|
curl_formfree(first);
|
||||||
fprintf(stderr,"curl error: %d\n",curl_err);
|
fprintf(stderr,"curl error: %d\n",curl_err);
|
||||||
return RDRehash::ErrorInternal;
|
return RDRehash::ErrorInternal;
|
||||||
|
|
||||||
@ -131,6 +133,7 @@ RDRehash::ErrorCode RDRehash::runRehash(const QString &username,
|
|||||||
case CURLE_COULDNT_CONNECT:
|
case CURLE_COULDNT_CONNECT:
|
||||||
case 9: // CURLE_REMOTE_ACCESS_DENIED
|
case 9: // CURLE_REMOTE_ACCESS_DENIED
|
||||||
curl_easy_cleanup(curl);
|
curl_easy_cleanup(curl);
|
||||||
|
curl_formfree(first);
|
||||||
return RDRehash::ErrorUrlInvalid;
|
return RDRehash::ErrorUrlInvalid;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -139,6 +142,7 @@ RDRehash::ErrorCode RDRehash::runRehash(const QString &username,
|
|||||||
}
|
}
|
||||||
curl_easy_getinfo(curl,CURLINFO_RESPONSE_CODE,&response_code);
|
curl_easy_getinfo(curl,CURLINFO_RESPONSE_CODE,&response_code);
|
||||||
curl_easy_cleanup(curl);
|
curl_easy_cleanup(curl);
|
||||||
|
curl_formfree(first);
|
||||||
|
|
||||||
switch(response_code) {
|
switch(response_code) {
|
||||||
case 200:
|
case 200:
|
||||||
|
@ -121,6 +121,7 @@ RDTrimAudio::ErrorCode RDTrimAudio::runTrim(const QString &username,
|
|||||||
(const char *)QString().sprintf("%u",conv_trim_level),
|
(const char *)QString().sprintf("%u",conv_trim_level),
|
||||||
CURLFORM_END);
|
CURLFORM_END);
|
||||||
if((curl=curl_easy_init())==NULL) {
|
if((curl=curl_easy_init())==NULL) {
|
||||||
|
curl_formfree(first);
|
||||||
return RDTrimAudio::ErrorInternal;
|
return RDTrimAudio::ErrorInternal;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -155,6 +156,7 @@ RDTrimAudio::ErrorCode RDTrimAudio::runTrim(const QString &username,
|
|||||||
//fprintf(stderr,"CURL Error: %s [%d]\n",curl_easy_strerror(curl_err),
|
//fprintf(stderr,"CURL Error: %s [%d]\n",curl_easy_strerror(curl_err),
|
||||||
//curl_err);
|
//curl_err);
|
||||||
curl_easy_cleanup(curl);
|
curl_easy_cleanup(curl);
|
||||||
|
curl_formfree(first);
|
||||||
return RDTrimAudio::ErrorInternal;
|
return RDTrimAudio::ErrorInternal;
|
||||||
|
|
||||||
case CURLE_URL_MALFORMAT:
|
case CURLE_URL_MALFORMAT:
|
||||||
@ -162,10 +164,12 @@ RDTrimAudio::ErrorCode RDTrimAudio::runTrim(const QString &username,
|
|||||||
case CURLE_COULDNT_CONNECT:
|
case CURLE_COULDNT_CONNECT:
|
||||||
case 9: // CURLE_REMOTE_ACCESS_DENIED
|
case 9: // CURLE_REMOTE_ACCESS_DENIED
|
||||||
curl_easy_cleanup(curl);
|
curl_easy_cleanup(curl);
|
||||||
|
curl_formfree(first);
|
||||||
return RDTrimAudio::ErrorUrlInvalid;
|
return RDTrimAudio::ErrorUrlInvalid;
|
||||||
}
|
}
|
||||||
curl_easy_getinfo(curl,CURLINFO_RESPONSE_CODE,&response_code);
|
curl_easy_getinfo(curl,CURLINFO_RESPONSE_CODE,&response_code);
|
||||||
curl_easy_cleanup(curl);
|
curl_easy_cleanup(curl);
|
||||||
|
curl_formfree(first);
|
||||||
|
|
||||||
switch(response_code) {
|
switch(response_code) {
|
||||||
case 200:
|
case 200:
|
||||||
|
@ -134,20 +134,20 @@ RDUpload::ErrorCode RDUpload::runUpload(const QString &username,
|
|||||||
// otherwise some versions of LibCurl will throw a 'bad/illegal format'
|
// otherwise some versions of LibCurl will throw a 'bad/illegal format'
|
||||||
// error.
|
// error.
|
||||||
//
|
//
|
||||||
strncpy(url,conv_dst_url.toString(conv_dst_url.protocol().lower()=="http"),
|
strncpy(url,conv_dst_url.toString(conv_dst_url.protocol().lower()=="http").utf8(),
|
||||||
1024);
|
1024);
|
||||||
curl_easy_setopt(curl,CURLOPT_URL,url);
|
curl_easy_setopt(curl,CURLOPT_URL,url);
|
||||||
curl_easy_setopt(curl,CURLOPT_UPLOAD,1);
|
curl_easy_setopt(curl,CURLOPT_UPLOAD,1);
|
||||||
curl_easy_setopt(curl,CURLOPT_READDATA,f);
|
curl_easy_setopt(curl,CURLOPT_READDATA,f);
|
||||||
curl_easy_setopt(curl,CURLOPT_INFILESIZE,(long)conv_src_size);
|
curl_easy_setopt(curl,CURLOPT_INFILESIZE,(long)conv_src_size);
|
||||||
strncpy(userpwd,(username+":"+password),256);
|
strncpy(userpwd,(username+":"+password).utf8(),256);
|
||||||
curl_easy_setopt(curl,CURLOPT_USERPWD,userpwd);
|
curl_easy_setopt(curl,CURLOPT_USERPWD,userpwd);
|
||||||
curl_easy_setopt(curl,CURLOPT_TIMEOUT,RD_CURL_TIMEOUT);
|
curl_easy_setopt(curl,CURLOPT_TIMEOUT,RD_CURL_TIMEOUT);
|
||||||
curl_easy_setopt(curl,CURLOPT_PROGRESSFUNCTION,UploadProgressCallback);
|
curl_easy_setopt(curl,CURLOPT_PROGRESSFUNCTION,UploadProgressCallback);
|
||||||
curl_easy_setopt(curl,CURLOPT_PROGRESSDATA,this);
|
curl_easy_setopt(curl,CURLOPT_PROGRESSDATA,this);
|
||||||
curl_easy_setopt(curl,CURLOPT_NOPROGRESS,0);
|
curl_easy_setopt(curl,CURLOPT_NOPROGRESS,0);
|
||||||
curl_easy_setopt(curl,CURLOPT_USERAGENT,
|
curl_easy_setopt(curl,CURLOPT_USERAGENT,
|
||||||
(const char *)rda->config()->userAgent());
|
(const char *)rda->config()->userAgent().utf8());
|
||||||
if(log_debug) {
|
if(log_debug) {
|
||||||
curl_easy_setopt(curl,CURLOPT_VERBOSE,1);
|
curl_easy_setopt(curl,CURLOPT_VERBOSE,1);
|
||||||
curl_easy_setopt(curl,CURLOPT_DEBUGFUNCTION,UploadErrorCallback);
|
curl_easy_setopt(curl,CURLOPT_DEBUGFUNCTION,UploadErrorCallback);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user