mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-14 18:27:58 -06:00
minor changes for url_encode
This commit is contained in:
parent
e1417f1827
commit
6960958276
2 changed files with 4 additions and 2 deletions
|
@ -8,7 +8,6 @@
|
||||||
#include <boost/log/trivial.hpp>
|
#include <boost/log/trivial.hpp>
|
||||||
#include <boost/property_tree/ptree.hpp>
|
#include <boost/property_tree/ptree.hpp>
|
||||||
#include <boost/property_tree/json_parser.hpp>
|
#include <boost/property_tree/json_parser.hpp>
|
||||||
#include <boost/algorithm/string/replace.hpp>
|
|
||||||
|
|
||||||
#include <wx/frame.h>
|
#include <wx/frame.h>
|
||||||
#include <wx/event.h>
|
#include <wx/event.h>
|
||||||
|
|
|
@ -424,11 +424,14 @@ bool Http::ca_file_supported()
|
||||||
std::string Http::url_encode(const std::string &str)
|
std::string Http::url_encode(const std::string &str)
|
||||||
{
|
{
|
||||||
::CURL *curl = ::curl_easy_init();
|
::CURL *curl = ::curl_easy_init();
|
||||||
|
if (curl == nullptr) {
|
||||||
|
return str;
|
||||||
|
}
|
||||||
char *ce = ::curl_easy_escape(curl, str.c_str(), str.length());
|
char *ce = ::curl_easy_escape(curl, str.c_str(), str.length());
|
||||||
std::string encoded = std::string(ce);
|
std::string encoded = std::string(ce);
|
||||||
|
|
||||||
::curl_free(ce);
|
::curl_free(ce);
|
||||||
if (curl != nullptr) { ::curl_easy_cleanup(curl); }
|
::curl_easy_cleanup(curl);
|
||||||
|
|
||||||
return encoded;
|
return encoded;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue