mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 06:58:57 +01:00
refactor: move url.h/cpp from lib util to lib common
This commit is contained in:
@@ -1,22 +0,0 @@
|
||||
// Copyright (c) 2015-2019 The Bitcoin Core developers
|
||||
// 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 <cstdlib>
|
||||
#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;
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
// Copyright (c) 2015-2020 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#ifndef BITCOIN_UTIL_URL_H
|
||||
#define BITCOIN_UTIL_URL_H
|
||||
|
||||
#include <string>
|
||||
|
||||
using UrlDecodeFn = std::string(const std::string& url_encoded);
|
||||
UrlDecodeFn urlDecode;
|
||||
extern UrlDecodeFn* const URL_DECODE;
|
||||
|
||||
#endif // BITCOIN_UTIL_URL_H
|
||||
Reference in New Issue
Block a user