Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set minArgs/maxArgs to 1, and add Exec #72

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/Conf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ bool ServerConf::parse(ServerConf& s, const char* str)

void CustomCommandConf::init(CustomCommandConf&c, const char* name) {
c.name = name;
c.minArgs = 2;
c.maxArgs = 2;
c.minArgs = 1;
c.maxArgs = 1;
c.mode = Command::Write;
}

Expand Down Expand Up @@ -400,8 +400,8 @@ void Conf::setCustomCommand(const ConfParser::Node* node)
CustomCommandConf::init(cc, p->key.c_str());
auto s = p->sub;
for (;s ; s = s->next) {
if (setInt(cc.minArgs, "MinArgs", s, 2)) {
} else if (setInt(cc.maxArgs, "MaxArgs", s, 2, 9999)) {
if (setInt(cc.minArgs, "MinArgs", s, 1)) {
} else if (setInt(cc.maxArgs, "MaxArgs", s, 1, 9999)) {
} else if (setCommandMode(cc.mode, "Mode", s)) {
} else {
Throw(UnknownKey, "%s:%d unknown key %s", s->file, s->line, s->key.c_str());
Expand Down
1 change: 1 addition & 0 deletions src/Handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,7 @@ bool Handler::preHandleRequest(Request* req, const String& key)
return true;
case Command::Watch:
case Command::Multi:
case Command::Exec:
if (!mProxy->supportTransaction()) {
directResponse(req, Response::ForbidTransaction);
return true;
Expand Down