Unverified Commit d38df59a authored by Oran Agra's avatar Oran Agra Committed by GitHub
Browse files

fix CLIENT SETINFO to use error replies instead of status replies (#11952)

parent 9c4c90c1
...@@ -2909,12 +2909,12 @@ void clientSetinfoCommand(client *c) { ...@@ -2909,12 +2909,12 @@ void clientSetinfoCommand(client *c) {
} else if (!strcasecmp(attr,"lib-ver")) { } else if (!strcasecmp(attr,"lib-ver")) {
destvar = &c->lib_ver; destvar = &c->lib_ver;
} else { } else {
addReplyStatusFormat(c,"Unrecognized option '%s'", attr); addReplyErrorFormat(c,"Unrecognized option '%s'", attr);
return; return;
} }
if (validateClientAttr(val)==C_ERR) { if (validateClientAttr(val)==C_ERR) {
addReplyStatusFormat(c, addReplyErrorFormat(c,
"%s cannot contain spaces, newlines or special characters.", attr); "%s cannot contain spaces, newlines or special characters.", attr);
return; return;
} }
......
...@@ -333,9 +333,9 @@ start_server {tags {"introspection"}} { ...@@ -333,9 +333,9 @@ start_server {tags {"introspection"}} {
test {CLIENT SETINFO invalid args} { test {CLIENT SETINFO invalid args} {
assert_error {*wrong number of arguments*} {r CLIENT SETINFO lib-name} assert_error {*wrong number of arguments*} {r CLIENT SETINFO lib-name}
assert_match {*cannot contain spaces*} [r CLIENT SETINFO lib-name "redis py"] assert_error {*cannot contain spaces*} {r CLIENT SETINFO lib-name "redis py"}
assert_match {*newlines*} [r CLIENT SETINFO lib-name "redis.py\n"] assert_error {*newlines*} {r CLIENT SETINFO lib-name "redis.py\n"}
assert_match {*Unrecognized*} [r CLIENT SETINFO badger hamster] assert_error {*Unrecognized*} {r CLIENT SETINFO badger hamster}
# test that all of these didn't affect the previously set values # test that all of these didn't affect the previously set values
r client info r client info
} {*lib-name=redis.py lib-ver=1.2.3*} } {*lib-name=redis.py lib-ver=1.2.3*}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment