diff --git a/ChangeLog b/ChangeLog index 651cc8f2..fb5cb7d1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -17255,3 +17255,5 @@ the 'Conductor' field to be ignored. 2018-07-30 Fred Gleason * Modified 'RDAudioExport' to use multipart-mime encoding. +2018-07-30 Fred Gleason + * Modified 'RDAudioInfo' to use multipart-mime encoding. diff --git a/lib/rdaudioinfo.cpp b/lib/rdaudioinfo.cpp index 6d9a3755..fb7de53c 100644 --- a/lib/rdaudioinfo.cpp +++ b/lib/rdaudioinfo.cpp @@ -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);