| @@ -18,5 +18,6 @@ enum RequestMethod { | |||||
| json_t *requestJson(RequestMethod method, std::string url, json_t *dataJ); | json_t *requestJson(RequestMethod method, std::string url, json_t *dataJ); | ||||
| /** Returns the filename, blank if unsuccessful */ | /** Returns the filename, blank if unsuccessful */ | ||||
| bool requestDownload(std::string url, std::string filename, float *progress); | bool requestDownload(std::string url, std::string filename, float *progress); | ||||
| std::string requestEscape(std::string s); | |||||
| } // namespace rack | } // namespace rack | ||||
| @@ -237,9 +237,9 @@ static void refreshPurchase(json_t *pluginJ) { | |||||
| url += "?product="; | url += "?product="; | ||||
| url += slug; | url += slug; | ||||
| url += "&version="; | url += "&version="; | ||||
| url += gApplicationVersion; | |||||
| url += requestEscape(gApplicationVersion); | |||||
| url += "&token="; | url += "&token="; | ||||
| url += gToken; | |||||
| url += requestEscape(gToken); | |||||
| // If plugin is not loaded, download the zip file to /plugins | // If plugin is not loaded, download the zip file to /plugins | ||||
| downloadName = name; | downloadName = name; | ||||
| @@ -143,5 +143,15 @@ bool requestDownload(std::string url, std::string filename, float *progress) { | |||||
| return res == CURLE_OK; | return res == CURLE_OK; | ||||
| } | } | ||||
| std::string requestEscape(std::string s) { | |||||
| CURL *curl = curl_easy_init(); | |||||
| assert(curl); | |||||
| char *escaped = curl_easy_escape(curl, s.c_str(), s.size()); | |||||
| std::string ret = escaped; | |||||
| curl_free(escaped); | |||||
| curl_easy_cleanup(curl); | |||||
| return ret; | |||||
| } | |||||
| } // namespace rack | } // namespace rack | ||||