Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
d38df59a
Unverified
Commit
d38df59a
authored
Mar 22, 2023
by
Oran Agra
Committed by
GitHub
Mar 22, 2023
Browse files
fix CLIENT SETINFO to use error replies instead of status replies (#11952)
parent
9c4c90c1
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/networking.c
View file @
d38df59a
...
@@ -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
{
addReply
Status
Format
(
c
,
"Unrecognized option '%s'"
,
attr
);
addReply
Error
Format
(
c
,
"Unrecognized option '%s'"
,
attr
);
return
;
return
;
}
}
if
(
validateClientAttr
(
val
)
==
C_ERR
)
{
if
(
validateClientAttr
(
val
)
==
C_ERR
)
{
addReply
Status
Format
(
c
,
addReply
Error
Format
(
c
,
"%s cannot contain spaces, newlines or special characters."
,
attr
);
"%s cannot contain spaces, newlines or special characters."
,
attr
);
return
;
return
;
}
}
...
...
tests/unit/introspection.tcl
View file @
d38df59a
...
@@ -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*
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment