From ec79802cb6bef71f29eb8c4169391cc5b622517f Mon Sep 17 00:00:00 2001 From: Fred Gleason Date: Fri, 17 Jun 2016 14:06:19 -0400 Subject: [PATCH] 2016-06-17 Fred Gleason * Fixed a bug in 'lib/rddownload.cpp' that caused download URLs using 'https' protocol to fail to be properly escaped. --- ChangeLog | 3 +++ lib/rddownload.cpp | 4 ++-- rdcatchd/batch.cpp | 6 ++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 90ac5e0e..87d415bb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15249,3 +15249,6 @@ 2016-06-17 Fred Gleason * Modified rdexport(1) to list correct audio format parameters in the XML output. +2016-06-17 Fred Gleason + * Fixed a bug in 'lib/rddownload.cpp' that caused download URLs + using 'https' protocol to fail to be properly escaped. diff --git a/lib/rddownload.cpp b/lib/rddownload.cpp index 13ce23a5..94f04c2e 100644 --- a/lib/rddownload.cpp +++ b/lib/rddownload.cpp @@ -131,8 +131,8 @@ RDDownload::ErrorCode RDDownload::runDownload(const QString &username, // otherwise some versions of LibCurl will throw a 'bad/illegal format' // error. // - strncpy(url,conv_src_url.toString(conv_src_url.protocol().lower()=="http"), - 1024); + strncpy(url,conv_src_url. + toString(conv_src_url.protocol().lower().left(4)=="http"),1024); curl_easy_setopt(curl,CURLOPT_URL,url); curl_easy_setopt(curl,CURLOPT_WRITEDATA,f); strncpy(userpwd,username+":"+password,256); diff --git a/rdcatchd/batch.cpp b/rdcatchd/batch.cpp index 556c8d87..42e50532 100644 --- a/rdcatchd/batch.cpp +++ b/rdcatchd/batch.cpp @@ -59,6 +59,7 @@ #include #include #include +#include #include void MainObject::catchConnectedData(int serial,bool state) @@ -192,14 +193,15 @@ void MainObject::RunDownload(CatchEvent *evt) // // Execute Download // + evt->setTempName(BuildTempName(evt,"download")); LogLine(RDConfig::LogInfo,QString(). sprintf("starting download of %s to %s, id=%d", (const char *)evt->resolvedUrl(), (const char *)evt->tempName(), evt->id())); - evt->setTempName(BuildTempName(evt,"download")); RDDownload *conv=new RDDownload(catch_config->stationName(),this); - conv->setSourceUrl(evt->resolvedUrl()); + + conv->setSourceUrl(RDUrlEscape(evt->resolvedUrl())); conv->setDestinationFile(evt->tempName()); QString url_username=evt->urlUsername(); QString url_password=evt->urlPassword();