2018-07-30 Fred Gleason <fredg@paravelsystems.com>

* Modified 'RDPeakExport' to use multipart-mime encoding.
This commit is contained in:
Fred Gleason 2018-07-30 10:20:47 -04:00
parent 1983dd45d3
commit 210bc3dc16
2 changed files with 21 additions and 7 deletions

View File

@ -17263,3 +17263,5 @@
* Modified 'RDCart' to use multipart-mime encoding.
2018-07-30 Fred Gleason <fredg@paravelsystems.com>
* Modified 'RDCopyAudio' to use multipart-mime encoding.
2018-07-30 Fred Gleason <fredg@paravelsystems.com>
* Modified 'RDPeakExport' to use multipart-mime encoding.

View File

@ -92,15 +92,28 @@ RDPeaksExport::ErrorCode RDPeaksExport::runExport(const QString &username,
CURL *curl=NULL;
CURLcode curl_err;
char url[1024];
struct curl_httppost *first=NULL;
struct curl_httppost *last=NULL;
//
// Generate POST Data
//
QString post=QString().sprintf("COMMAND=%d&",RDXPORT_COMMAND_EXPORT_PEAKS)+
"LOGIN_NAME="+RDFormPost::urlEncode(username)+"&"+
"PASSWORD="+RDFormPost::urlEncode(password)+"&"+
QString().sprintf("CART_NUMBER=%u&",conv_cart_number)+
QString().sprintf("CUT_NUMBER=%u",conv_cut_number);
curl_formadd(&first,&last,CURLFORM_PTRNAME,"COMMAND",
CURLFORM_COPYCONTENTS,
(const char *)QString().sprintf("%u",RDXPORT_COMMAND_EXPORT_PEAKS),
CURLFORM_END);
curl_formadd(&first,&last,CURLFORM_PTRNAME,"LOGIN_NAME",
CURLFORM_COPYCONTENTS,(const char *)username,CURLFORM_END);
curl_formadd(&first,&last,CURLFORM_PTRNAME,"PASSWORD",
CURLFORM_COPYCONTENTS,(const char *)password,CURLFORM_END);
curl_formadd(&first,&last,CURLFORM_PTRNAME,"CART_NUMBER",
CURLFORM_COPYCONTENTS,
(const char *)QString().sprintf("%u",conv_cart_number),
CURLFORM_END);
curl_formadd(&first,&last,CURLFORM_PTRNAME,"CUT_NUMBER",
CURLFORM_COPYCONTENTS,
(const char *)QString().sprintf("%u",conv_cut_number),
CURLFORM_END);
if((curl=curl_easy_init())==NULL) {
return RDPeaksExport::ErrorInternal;
}
@ -114,8 +127,7 @@ RDPeaksExport::ErrorCode RDPeaksExport::runExport(const QString &username,
//
strncpy(url,rda->station()->webServiceUrl(rda->config()),1024);
curl_easy_setopt(curl,CURLOPT_URL,url);
curl_easy_setopt(curl,CURLOPT_POST,1);
curl_easy_setopt(curl,CURLOPT_POSTFIELDS,(const char *)post);
curl_easy_setopt(curl,CURLOPT_HTTPPOST,first);
curl_easy_setopt(curl,CURLOPT_TIMEOUT,RD_CURL_TIMEOUT);
curl_easy_setopt(curl,CURLOPT_NOPROGRESS,1);
curl_easy_setopt(curl,CURLOPT_USERAGENT,