mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-19 18:09:47 +01:00
refactor: Remove hooking code for urlDecode
The point of this was to be able to build bitcoin-tx and bitcoin-wallet without libevent, see #18504. Now that we use our own implementation of urlDecode this is not needed anymore. Co-authored-by: stickies-v <stickies-v@protonmail.com>
This commit is contained in:
parent
650d43ec15
commit
8f39aaae41
@ -11,7 +11,6 @@
|
||||
#include <clientversion.h>
|
||||
#include <common/args.h>
|
||||
#include <common/system.h>
|
||||
#include <common/url.h>
|
||||
#include <compat/compat.h>
|
||||
#include <compat/stdin.h>
|
||||
#include <policy/feerate.h>
|
||||
@ -51,7 +50,6 @@
|
||||
using CliClock = std::chrono::system_clock;
|
||||
|
||||
const std::function<std::string(const char*)> G_TRANSLATION_FUN = nullptr;
|
||||
UrlDecodeFn* const URL_DECODE = urlDecode;
|
||||
|
||||
static const char DEFAULT_RPCCONNECT[] = "127.0.0.1";
|
||||
static const int DEFAULT_HTTP_CLIENT_TIMEOUT=900;
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include <clientversion.h>
|
||||
#include <common/args.h>
|
||||
#include <common/system.h>
|
||||
#include <common/url.h>
|
||||
#include <compat/compat.h>
|
||||
#include <interfaces/init.h>
|
||||
#include <key.h>
|
||||
@ -28,7 +27,6 @@
|
||||
#include <tuple>
|
||||
|
||||
const std::function<std::string(const char*)> G_TRANSLATION_FUN = nullptr;
|
||||
UrlDecodeFn* const URL_DECODE = nullptr;
|
||||
|
||||
static void SetupWalletToolArgs(ArgsManager& argsman)
|
||||
{
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include <common/args.h>
|
||||
#include <common/init.h>
|
||||
#include <common/system.h>
|
||||
#include <common/url.h>
|
||||
#include <compat/compat.h>
|
||||
#include <init.h>
|
||||
#include <interfaces/chain.h>
|
||||
@ -35,7 +34,6 @@
|
||||
using node::NodeContext;
|
||||
|
||||
const std::function<std::string(const char*)> G_TRANSLATION_FUN = nullptr;
|
||||
UrlDecodeFn* const URL_DECODE = urlDecode;
|
||||
|
||||
#if HAVE_DECL_FORK
|
||||
|
||||
|
@ -8,8 +8,10 @@
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
using UrlDecodeFn = std::string(std::string_view url_encoded);
|
||||
UrlDecodeFn urlDecode;
|
||||
extern UrlDecodeFn* const URL_DECODE;
|
||||
/* Decode a URL.
|
||||
*
|
||||
* Notably this implementation does not decode a '+' to a ' '.
|
||||
*/
|
||||
std::string urlDecode(std::string_view url_encoded);
|
||||
|
||||
#endif // BITCOIN_COMMON_URL_H
|
||||
|
@ -4,7 +4,6 @@
|
||||
|
||||
#include <qt/bitcoin.h>
|
||||
|
||||
#include <common/url.h>
|
||||
#include <compat/compat.h>
|
||||
#include <util/translation.h>
|
||||
|
||||
@ -17,7 +16,6 @@
|
||||
extern const std::function<std::string(const char*)> G_TRANSLATION_FUN = [](const char* psz) {
|
||||
return QCoreApplication::translate("bitcoin-core", psz).toStdString();
|
||||
};
|
||||
UrlDecodeFn* const URL_DECODE = urlDecode;
|
||||
|
||||
const std::function<std::string()> G_TEST_GET_FULL_NAME{};
|
||||
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include <banman.h>
|
||||
#include <chainparams.h>
|
||||
#include <common/system.h>
|
||||
#include <common/url.h>
|
||||
#include <consensus/consensus.h>
|
||||
#include <consensus/params.h>
|
||||
#include <consensus/validation.h>
|
||||
@ -81,7 +80,6 @@ using node::RegenerateCommitments;
|
||||
using node::VerifyLoadedChainstate;
|
||||
|
||||
const std::function<std::string(const char*)> G_TRANSLATION_FUN = nullptr;
|
||||
UrlDecodeFn* const URL_DECODE = nullptr;
|
||||
|
||||
/** Random context to get unique temp data dirs. Separate from g_insecure_rand_ctx, which can be seeded from a const env var */
|
||||
static FastRandomContext g_insecure_rand_ctx_temp_path;
|
||||
|
@ -62,9 +62,9 @@ bool ParseIncludeWatchonly(const UniValue& include_watchonly, const CWallet& wal
|
||||
|
||||
bool GetWalletNameFromJSONRPCRequest(const JSONRPCRequest& request, std::string& wallet_name)
|
||||
{
|
||||
if (URL_DECODE && request.URI.starts_with(WALLET_ENDPOINT_BASE)) {
|
||||
if (request.URI.starts_with(WALLET_ENDPOINT_BASE)) {
|
||||
// wallet endpoint was used
|
||||
wallet_name = URL_DECODE(std::string_view{request.URI}.substr(WALLET_ENDPOINT_BASE.size()));
|
||||
wallet_name = urlDecode(std::string_view{request.URI}.substr(WALLET_ENDPOINT_BASE.size()));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user