lib/curl/Escape: add CurlUnescape()

This commit is contained in:
Max Kellermann 2019-10-15 13:39:02 +02:00
parent a8f4d2b6fc
commit 364acc8949
2 changed files with 22 additions and 0 deletions

View File

@ -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);
}

View File

@ -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