From 6960958276457fe5fbcee0ad10fb1d3c991a41fd Mon Sep 17 00:00:00 2001 From: Martin Loidl Date: Thu, 6 Sep 2018 19:07:54 +0200 Subject: [PATCH] minor changes for url_encode --- xs/src/slic3r/Utils/Duet.cpp | 1 - xs/src/slic3r/Utils/Http.cpp | 5 ++++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/xs/src/slic3r/Utils/Duet.cpp b/xs/src/slic3r/Utils/Duet.cpp index a3dc4a3bb9..f253271611 100644 --- a/xs/src/slic3r/Utils/Duet.cpp +++ b/xs/src/slic3r/Utils/Duet.cpp @@ -8,7 +8,6 @@ #include #include #include -#include #include #include diff --git a/xs/src/slic3r/Utils/Http.cpp b/xs/src/slic3r/Utils/Http.cpp index 3024b08fe0..9b67ceea87 100644 --- a/xs/src/slic3r/Utils/Http.cpp +++ b/xs/src/slic3r/Utils/Http.cpp @@ -424,11 +424,14 @@ bool Http::ca_file_supported() std::string Http::url_encode(const std::string &str) { ::CURL *curl = ::curl_easy_init(); + if (curl == nullptr) { + return str; + } 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); } + ::curl_easy_cleanup(curl); return encoded; }