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

* Modified 'RDAudioStore' to use multipart-mime encoding.
This commit is contained in:
Fred Gleason 2018-07-30 09:58:24 -04:00
parent 9fc591971b
commit 8d94c2c8f0
2 changed files with 13 additions and 5 deletions

View File

@ -17257,3 +17257,5 @@
* Modified 'RDAudioExport' to use multipart-mime encoding.
2018-07-30 Fred Gleason <fredg@paravelsystems.com>
* Modified 'RDAudioInfo' to use multipart-mime encoding.
2018-07-30 Fred Gleason <fredg@paravelsystems.com>
* Modified 'RDAudioStore' to use multipart-mime encoding.

View File

@ -74,13 +74,20 @@ RDAudioStore::ErrorCode RDAudioStore::runStore(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_AUDIOSTORE)+
"LOGIN_NAME="+RDFormPost::urlEncode(username)+"&"+
"PASSWORD="+RDFormPost::urlEncode(password);
curl_formadd(&first,&last,CURLFORM_PTRNAME,"COMMAND",
CURLFORM_COPYCONTENTS,
(const char *)QString().sprintf("%u",RDXPORT_COMMAND_AUDIOSTORE),
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);
if((curl=curl_easy_init())==NULL) {
return RDAudioStore::ErrorInternal;
}
@ -94,8 +101,7 @@ RDAudioStore::ErrorCode RDAudioStore::runStore(const QString &username,
curl_easy_setopt(curl,CURLOPT_URL,url);
curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,RDAudioStoreCallback);
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 *)conv_config->userAgent());
curl_easy_setopt(curl,CURLOPT_TIMEOUT,RD_CURL_TIMEOUT);