Changeset View
Changeset View
Standalone View
Standalone View
src/httpserver.cpp
Show All 11 Lines | |||||
#include <netbase.h> | #include <netbase.h> | ||||
#include <rpc/protocol.h> // For HTTP status codes | #include <rpc/protocol.h> // For HTTP status codes | ||||
#include <shutdown.h> | #include <shutdown.h> | ||||
#include <sync.h> | #include <sync.h> | ||||
#include <ui_interface.h> | #include <ui_interface.h> | ||||
#include <util/strencodings.h> | #include <util/strencodings.h> | ||||
#include <util/system.h> | #include <util/system.h> | ||||
#include <util/threadnames.h> | #include <util/threadnames.h> | ||||
#include <util/translation.h> | |||||
#include <event2/buffer.h> | #include <event2/buffer.h> | ||||
#include <event2/bufferevent.h> | #include <event2/bufferevent.h> | ||||
#include <event2/keyvalq_struct.h> | #include <event2/keyvalq_struct.h> | ||||
#include <event2/thread.h> | #include <event2/thread.h> | ||||
#include <event2/util.h> | #include <event2/util.h> | ||||
#include <support/events.h> | #include <support/events.h> | ||||
▲ Show 20 Lines • Show All 146 Lines • ▼ Show 20 Lines | static bool InitHTTPAllowList() { | ||||
rpc_allow_subnets.push_back(CSubNet(localv4, 8)); | rpc_allow_subnets.push_back(CSubNet(localv4, 8)); | ||||
// always allow IPv6 localhost. | // always allow IPv6 localhost. | ||||
rpc_allow_subnets.push_back(CSubNet(localv6)); | rpc_allow_subnets.push_back(CSubNet(localv6)); | ||||
for (const std::string &strAllow : gArgs.GetArgs("-rpcallowip")) { | for (const std::string &strAllow : gArgs.GetArgs("-rpcallowip")) { | ||||
CSubNet subnet; | CSubNet subnet; | ||||
LookupSubNet(strAllow.c_str(), subnet); | LookupSubNet(strAllow.c_str(), subnet); | ||||
if (!subnet.IsValid()) { | if (!subnet.IsValid()) { | ||||
uiInterface.ThreadSafeMessageBox( | uiInterface.ThreadSafeMessageBox( | ||||
strprintf("Invalid -rpcallowip subnet specification: %s. " | strprintf( | ||||
"Valid are a single IP (e.g. 1.2.3.4), a " | Untranslated("Invalid -rpcallowip subnet specification: " | ||||
"network/netmask (e.g. 1.2.3.4/255.255.255.0) or a " | "%s. Valid are a single IP (e.g. 1.2.3.4), a " | ||||
"network/CIDR (e.g. 1.2.3.4/24).", | "network/netmask (e.g. 1.2.3.4/255.255.255.0) " | ||||
"or a network/CIDR (e.g. 1.2.3.4/24)."), | |||||
strAllow), | strAllow), | ||||
"", CClientUIInterface::MSG_ERROR); | "", CClientUIInterface::MSG_ERROR); | ||||
return false; | return false; | ||||
} | } | ||||
rpc_allow_subnets.push_back(subnet); | rpc_allow_subnets.push_back(subnet); | ||||
} | } | ||||
std::string strAllowed; | std::string strAllowed; | ||||
for (const CSubNet &subnet : rpc_allow_subnets) { | for (const CSubNet &subnet : rpc_allow_subnets) { | ||||
strAllowed += subnet.ToString() + " "; | strAllowed += subnet.ToString() + " "; | ||||
▲ Show 20 Lines • Show All 501 Lines • Show Last 20 Lines |