diff --git a/src/lib/curl/Escape.cxx b/src/lib/curl/Escape.cxx index 765de3b94..ab832eac9 100644 --- a/src/lib/curl/Escape.cxx +++ b/src/lib/curl/Escape.cxx @@ -53,3 +53,19 @@ CurlEscapeUriPath(StringView src) noexcept CurlEasy easy; return CurlEscapeUriPath(easy.Get(), src); } + +std::string +CurlUnescape(CURL *curl, StringView src) noexcept +{ + int outlength; + CurlString tmp(curl_easy_unescape(curl, src.data, src.size, + &outlength)); + return std::string(tmp.c_str(), outlength); +} + +std::string +CurlUnescape(StringView src) noexcept +{ + CurlEasy easy; + return CurlUnescape(easy.Get(), src); +} diff --git a/src/lib/curl/Escape.hxx b/src/lib/curl/Escape.hxx index e09ed8fed..1a7c9ab70 100644 --- a/src/lib/curl/Escape.hxx +++ b/src/lib/curl/Escape.hxx @@ -42,4 +42,10 @@ CurlEscapeUriPath(CURL *curl, StringView src) noexcept; std::string CurlEscapeUriPath(StringView src) noexcept; +std::string +CurlUnescape(CURL *curl, StringView src) noexcept; + +std::string +CurlUnescape(StringView src) noexcept; + #endif