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

* Modified 'RDAudioInfo' to use multipart-mime encoding.
This commit is contained in:
Fred Gleason 2018-07-30 09:52:52 -04:00
parent 0822477d37
commit 9fc591971b
2 changed files with 21 additions and 8 deletions

View File

@ -17255,3 +17255,5 @@
the 'Conductor' field to be ignored.
2018-07-30 Fred Gleason <fredg@paravelsystems.com>
* Modified 'RDAudioExport' to use multipart-mime encoding.
2018-07-30 Fred Gleason <fredg@paravelsystems.com>
* Modified 'RDAudioInfo' to use multipart-mime encoding.

View File

@ -115,19 +115,31 @@ RDAudioInfo::ErrorCode RDAudioInfo::runInfo(const QString &username,
CURL *curl=NULL;
char url[1024];
CURLcode curl_err;
struct curl_httppost *first=NULL;
struct curl_httppost *last=NULL;
//
// Generate POST Data
//
QString post=QString().sprintf("COMMAND=%d&",RDXPORT_COMMAND_AUDIOINFO)+
"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_AUDIOINFO),
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 RDAudioInfo::ErrorInternal;
}
//
// Write out URL as a C string before passing to curl_easy_setopt(),
// otherwise some versions of LibCurl will throw a 'bad/illegal format'
@ -137,8 +149,7 @@ RDAudioInfo::ErrorCode RDAudioInfo::runInfo(const QString &username,
curl_easy_setopt(curl,CURLOPT_URL,url);
curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,RDAudioInfoCallback);
curl_easy_setopt(curl,CURLOPT_WRITEDATA,&conv_xml);
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_USERAGENT,
(const char *)rda->config()->userAgent());
curl_easy_setopt(curl,CURLOPT_TIMEOUT,RD_CURL_TIMEOUT);