allow whitespaces for duet upload

* now url_encoding characters which could not used for URLs
This commit is contained in:
Martin Loidl 2018-09-04 23:55:37 +02:00
parent 22569de00f
commit e1417f1827
3 changed files with 19 additions and 3 deletions

View file

@ -421,6 +421,18 @@ bool Http::ca_file_supported()
return res;
}
std::string Http::url_encode(const std::string &str)
{
::CURL *curl = ::curl_easy_init();
char *ce = ::curl_easy_escape(curl, str.c_str(), str.length());
std::string encoded = std::string(ce);
::curl_free(ce);
if (curl != nullptr) { ::curl_easy_cleanup(curl); }
return encoded;
}
std::ostream& operator<<(std::ostream &os, const Http::Progress &progress)
{
os << "Http::Progress("