From 506b700dcb5dd5a7c1d8ffa7c77043a93e4e10de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20Tim=C3=B3n?= Date: Wed, 29 Mar 2017 17:51:41 +0200 Subject: Util: Remove redundant calls to gArgs.IsArgSet() Return empty std::vector with ArgsManager::GetArgs if nothing is set for that string --- src/httpserver.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/httpserver.cpp') diff --git a/src/httpserver.cpp b/src/httpserver.cpp index 1557cf98f..e7ece42b0 100644 --- a/src/httpserver.cpp +++ b/src/httpserver.cpp @@ -196,8 +196,7 @@ static bool InitHTTPAllowList() LookupHost("::1", localv6, false); rpc_allow_subnets.push_back(CSubNet(localv4, 8)); // always allow IPv4 local subnet rpc_allow_subnets.push_back(CSubNet(localv6)); // always allow IPv6 localhost - if (gArgs.IsArgSet("-rpcallowip")) { - for (const std::string& strAllow : gArgs.GetArgs("-rpcallowip")) { + for (const std::string& strAllow : gArgs.GetArgs("-rpcallowip")) { CSubNet subnet; LookupSubNet(strAllow.c_str(), subnet); if (!subnet.IsValid()) { @@ -207,7 +206,6 @@ static bool InitHTTPAllowList() return false; } rpc_allow_subnets.push_back(subnet); - } } std::string strAllowed; for (const CSubNet& subnet : rpc_allow_subnets) -- cgit v1.2.3 From ed866ab923c01d9da2ddd067144e74978383e304 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20Tim=C3=B3n?= Date: Tue, 27 Jun 2017 03:10:39 +0200 Subject: Indentation after 'Remove redundant calls to gArgs.IsArgSet()' --- src/httpserver.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/httpserver.cpp') diff --git a/src/httpserver.cpp b/src/httpserver.cpp index e7ece42b0..8841a4e9e 100644 --- a/src/httpserver.cpp +++ b/src/httpserver.cpp @@ -197,15 +197,15 @@ static bool InitHTTPAllowList() rpc_allow_subnets.push_back(CSubNet(localv4, 8)); // always allow IPv4 local subnet rpc_allow_subnets.push_back(CSubNet(localv6)); // always allow IPv6 localhost for (const std::string& strAllow : gArgs.GetArgs("-rpcallowip")) { - CSubNet subnet; - LookupSubNet(strAllow.c_str(), subnet); - if (!subnet.IsValid()) { - uiInterface.ThreadSafeMessageBox( - strprintf("Invalid -rpcallowip subnet specification: %s. Valid are a single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0) or a network/CIDR (e.g. 1.2.3.4/24).", strAllow), - "", CClientUIInterface::MSG_ERROR); - return false; - } - rpc_allow_subnets.push_back(subnet); + CSubNet subnet; + LookupSubNet(strAllow.c_str(), subnet); + if (!subnet.IsValid()) { + uiInterface.ThreadSafeMessageBox( + strprintf("Invalid -rpcallowip subnet specification: %s. Valid are a single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0) or a network/CIDR (e.g. 1.2.3.4/24).", strAllow), + "", CClientUIInterface::MSG_ERROR); + return false; + } + rpc_allow_subnets.push_back(subnet); } std::string strAllowed; for (const CSubNet& subnet : rpc_allow_subnets) -- cgit v1.2.3