summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOran Agra <oran@redislabs.com>2023-03-22 14:32:36 +0200
committerGitHub <noreply@github.com>2023-03-22 14:32:36 +0200
commitd38df59a3f79c3781e98f8b94f4296fa0ad6d25f (patch)
tree85f65e2d7c3576d6b009d2dbb8fec182526e2894
parent9c4c90c1bf28d5da738eb5a461b40193ce0b70c3 (diff)
downloadredis-d38df59a3f79c3781e98f8b94f4296fa0ad6d25f.tar.gz
fix CLIENT SETINFO to use error replies instead of status replies (#11952)
-rw-r--r--src/networking.c4
-rw-r--r--tests/unit/introspection.tcl6
2 files changed, 5 insertions, 5 deletions
diff --git a/src/networking.c b/src/networking.c
index 3b66dd59e..e0716b8a4 100644
--- a/src/networking.c
+++ b/src/networking.c
@@ -2909,12 +2909,12 @@ void clientSetinfoCommand(client *c) {
} else if (!strcasecmp(attr,"lib-ver")) {
destvar = &c->lib_ver;
} else {
- addReplyStatusFormat(c,"Unrecognized option '%s'", attr);
+ addReplyErrorFormat(c,"Unrecognized option '%s'", attr);
return;
}
if (validateClientAttr(val)==C_ERR) {
- addReplyStatusFormat(c,
+ addReplyErrorFormat(c,
"%s cannot contain spaces, newlines or special characters.", attr);
return;
}
diff --git a/tests/unit/introspection.tcl b/tests/unit/introspection.tcl
index c8bc3eb89..4452de6b1 100644
--- a/tests/unit/introspection.tcl
+++ b/tests/unit/introspection.tcl
@@ -333,9 +333,9 @@ start_server {tags {"introspection"}} {
test {CLIENT SETINFO invalid args} {
assert_error {*wrong number of arguments*} {r CLIENT SETINFO lib-name}
- assert_match {*cannot contain spaces*} [r CLIENT SETINFO lib-name "redis py"]
- assert_match {*newlines*} [r CLIENT SETINFO lib-name "redis.py\n"]
- assert_match {*Unrecognized*} [r CLIENT SETINFO badger hamster]
+ assert_error {*cannot contain spaces*} {r CLIENT SETINFO lib-name "redis py"}
+ assert_error {*newlines*} {r CLIENT SETINFO lib-name "redis.py\n"}
+ assert_error {*Unrecognized*} {r CLIENT SETINFO badger hamster}
# test that all of these didn't affect the previously set values
r client info
} {*lib-name=redis.py lib-ver=1.2.3*}