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

* Modified 'RDCopyAudio' to use multipart-mime encoding.
This commit is contained in:
Fred Gleason
2018-07-30 10:15:36 -04:00
parent 91fb00a284
commit 1983dd45d3
2 changed files with 29 additions and 10 deletions

View File

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

View File

@@ -77,18 +77,36 @@ RDCopyAudio::ErrorCode RDCopyAudio::runCopy(const QString &username,
long response_code; long response_code;
CURL *curl=NULL; CURL *curl=NULL;
char url[1024]; char url[1024];
struct curl_httppost *first=NULL;
struct curl_httppost *last=NULL;
// //
// Generate POST Data // Generate POST Data
// //
QString post=QString().sprintf("COMMAND=%d&",RDXPORT_COMMAND_COPYAUDIO)+ curl_formadd(&first,&last,CURLFORM_PTRNAME,"COMMAND",
"LOGIN_NAME="+RDFormPost::urlEncode(username)+"&"+ CURLFORM_COPYCONTENTS,
"PASSWORD="+RDFormPost::urlEncode(password)+"&"+ (const char *)QString().sprintf("%u",RDXPORT_COMMAND_COPYAUDIO),
QString().sprintf("SOURCE_CART_NUMBER=%u&",conv_source_cart_number)+ CURLFORM_END);
QString().sprintf("SOURCE_CUT_NUMBER=%u&",conv_source_cut_number)+ curl_formadd(&first,&last,CURLFORM_PTRNAME,"LOGIN_NAME",
QString().sprintf("DESTINATION_CART_NUMBER=%u&", CURLFORM_COPYCONTENTS,(const char *)username,CURLFORM_END);
conv_destination_cart_number)+ curl_formadd(&first,&last,CURLFORM_PTRNAME,"PASSWORD",
QString().sprintf("DESTINATION_CUT_NUMBER=%u",conv_destination_cut_number); CURLFORM_COPYCONTENTS,(const char *)password,CURLFORM_END);
curl_formadd(&first,&last,CURLFORM_PTRNAME,"SOURCE_CART_NUMBER",
CURLFORM_COPYCONTENTS,
(const char *)QString().sprintf("%u",conv_source_cart_number),
CURLFORM_END);
curl_formadd(&first,&last,CURLFORM_PTRNAME,"SOURCE_CUT_NUMBER",
CURLFORM_COPYCONTENTS,
(const char *)QString().sprintf("%u",conv_source_cut_number),
CURLFORM_END);
curl_formadd(&first,&last,CURLFORM_PTRNAME,"DESTINATION_CART_NUMBER",
CURLFORM_COPYCONTENTS,
(const char *)QString().sprintf("%u",conv_destination_cart_number),
CURLFORM_END);
curl_formadd(&first,&last,CURLFORM_PTRNAME,"DESTINATION_CUT_NUMBER",
CURLFORM_COPYCONTENTS,
(const char *)QString().sprintf("%u",conv_destination_cut_number),
CURLFORM_END);
if((curl=curl_easy_init())==NULL) { if((curl=curl_easy_init())==NULL) {
return RDCopyAudio::ErrorInternal; return RDCopyAudio::ErrorInternal;
} }
@@ -100,8 +118,7 @@ RDCopyAudio::ErrorCode RDCopyAudio::runCopy(const QString &username,
// //
strncpy(url,conv_station->webServiceUrl(conv_config),1024); strncpy(url,conv_station->webServiceUrl(conv_config),1024);
curl_easy_setopt(curl,CURLOPT_URL,url); curl_easy_setopt(curl,CURLOPT_URL,url);
curl_easy_setopt(curl,CURLOPT_POST,1); curl_easy_setopt(curl,CURLOPT_HTTPPOST,first);
curl_easy_setopt(curl,CURLOPT_POSTFIELDS,(const char *)post);
curl_easy_setopt(curl,CURLOPT_USERAGENT, curl_easy_setopt(curl,CURLOPT_USERAGENT,
(const char *)conv_config->userAgent()); (const char *)conv_config->userAgent());
curl_easy_setopt(curl,CURLOPT_TIMEOUT,RD_CURL_TIMEOUT); curl_easy_setopt(curl,CURLOPT_TIMEOUT,RD_CURL_TIMEOUT);