aboutsummaryrefslogtreecommitdiff
path: root/modules/httpd_acl.cpp
diff options
context:
space:
mode:
authorGravatar Sadie Powell2026-03-14 02:15:38 +0000
committerGravatar Sadie Powell2026-03-14 03:09:11 +0000
commit76f3f24c03c22576324e5af199d3e61d02a79b0d (patch)
treeefa6b9a0295e7b99dc8c0c47c8dd6030238c8cac /modules/httpd_acl.cpp
parentConvert some methods to use string_view. (diff)
Rewrite sepstream and move to stringutils.
Diffstat (limited to 'modules/httpd_acl.cpp')
-rw-r--r--modules/httpd_acl.cpp19
1 files changed, 7 insertions, 12 deletions
diff --git a/modules/httpd_acl.cpp b/modules/httpd_acl.cpp
index 77000ec26..b65b3d954 100644
--- a/modules/httpd_acl.cpp
+++ b/modules/httpd_acl.cpp
@@ -70,8 +70,7 @@ public:
for (const auto& [_, c] : ServerInstance->Config->ConfTags("httpdacl"))
{
std::string path = c->getString("path");
- std::string types = c->getString("types");
- irc::commasepstream sep(types);
+ StringSplitter sep(c->getString("types"), ',');
std::string type;
std::string username;
std::string password;
@@ -137,10 +136,8 @@ public:
if (!acl.blacklist.empty())
{
/* Blacklist */
- irc::commasepstream sep(acl.blacklist);
- std::string entry;
-
- while (sep.GetToken(entry))
+ StringSplitter sep(acl.blacklist, ',');
+ for (std::string entry; sep.GetToken(entry); )
{
if (InspIRCd::Match(http->GetIP(), entry, ascii_case_insensitive_map))
{
@@ -154,11 +151,9 @@ public:
if (!acl.whitelist.empty())
{
/* Whitelist */
- irc::commasepstream sep(acl.whitelist);
- std::string entry;
bool allow_access = false;
-
- while (sep.GetToken(entry))
+ StringSplitter sep(acl.whitelist, ',');
+ for (std::string entry; sep.GetToken(entry); )
{
if (InspIRCd::Match(http->GetIP(), entry, ascii_case_insensitive_map))
allow_access = true;
@@ -182,7 +177,7 @@ public:
{
/* Password has been given, validate it */
std::string authorization = http->headers->GetHeader("Authorization");
- irc::spacesepstream sep(authorization);
+ StringSplitter sep(authorization);
std::string authtype;
std::string base64;
@@ -196,7 +191,7 @@ public:
std::string userpass = Base64::Decode(base64);
ServerInstance->Logs.Debug(MODNAME, "HTTP authorization: {} ({})", userpass, base64);
- irc::sepstream userpasspair(userpass, ':');
+ StringSplitter userpasspair(userpass, ':');
if (userpasspair.GetToken(user))
{
userpasspair.GetToken(pass);