2019-12-30 06:39:22 -03:00
|
|
|
// Copyright (c) 2015-2019 The Bitcoin Core developers
|
2019-04-02 18:03:37 -03:00
|
|
|
// Distributed under the MIT software license, see the accompanying
|
|
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
|
|
|
|
#include <util/url.h>
|
|
|
|
|
|
|
|
#include <event2/http.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
std::string urlDecode(const std::string &urlEncoded) {
|
|
|
|
std::string res;
|
|
|
|
if (!urlEncoded.empty()) {
|
|
|
|
char *decoded = evhttp_uridecode(urlEncoded.c_str(), false, nullptr);
|
|
|
|
if (decoded) {
|
|
|
|
res = std::string(decoded);
|
|
|
|
free(decoded);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return res;
|
|
|
|
}
|