This commit is contained in:
Negash 2024-02-09 07:45:14 -07:00 committed by GitHub
commit 748f106681
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 4 deletions

View File

@ -35,8 +35,8 @@ bool ServerConf::parse(ServerConf& s, const char* str)
void CustomCommandConf::init(CustomCommandConf&c, const char* name) { void CustomCommandConf::init(CustomCommandConf&c, const char* name) {
c.name = name; c.name = name;
c.minArgs = 2; c.minArgs = 1;
c.maxArgs = 2; c.maxArgs = 1;
c.mode = Command::Write; c.mode = Command::Write;
} }
@ -400,8 +400,8 @@ void Conf::setCustomCommand(const ConfParser::Node* node)
CustomCommandConf::init(cc, p->key.c_str()); CustomCommandConf::init(cc, p->key.c_str());
auto s = p->sub; auto s = p->sub;
for (;s ; s = s->next) { for (;s ; s = s->next) {
if (setInt(cc.minArgs, "MinArgs", s, 2)) { if (setInt(cc.minArgs, "MinArgs", s, 1)) {
} else if (setInt(cc.maxArgs, "MaxArgs", s, 2, 9999)) { } else if (setInt(cc.maxArgs, "MaxArgs", s, 1, 9999)) {
} else if (setCommandMode(cc.mode, "Mode", s)) { } else if (setCommandMode(cc.mode, "Mode", s)) {
} else { } else {
Throw(UnknownKey, "%s:%d unknown key %s", s->file, s->line, s->key.c_str()); Throw(UnknownKey, "%s:%d unknown key %s", s->file, s->line, s->key.c_str());

View File

@ -641,6 +641,7 @@ bool Handler::preHandleRequest(Request* req, const String& key)
return true; return true;
case Command::Watch: case Command::Watch:
case Command::Multi: case Command::Multi:
case Command::Exec:
if (!mProxy->supportTransaction()) { if (!mProxy->supportTransaction()) {
directResponse(req, Response::ForbidTransaction); directResponse(req, Response::ForbidTransaction);
return true; return true;