Branch data Line data Source code
# 1 : : // Copyright (c) 2015-2019 The Bitcoin Core developers # 2 : : // Distributed under the MIT software license, see the accompanying # 3 : : // file COPYING or http://www.opensource.org/licenses/mit-license.php. # 4 : : # 5 : : #include <util/url.h> # 6 : : # 7 : : #include <event2/http.h> # 8 : : #include <stdlib.h> # 9 : : #include <string> # 10 : : # 11 : 8664 : std::string urlDecode(const std::string &urlEncoded) { # 12 : 8664 : std::string res; # 13 [ + + ]: 8664 : if (!urlEncoded.empty()) { # 14 : 8159 : char *decoded = evhttp_uridecode(urlEncoded.c_str(), false, nullptr); # 15 [ + - ]: 8159 : if (decoded) { # 16 : 8159 : res = std::string(decoded); # 17 : 8159 : free(decoded); # 18 : 8159 : } # 19 : 8159 : } # 20 : 8664 : return res; # 21 : 8664 : }