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
4e2dd54d
Commit
4e2dd54d
authored
Dec 10, 2018
by
antirez
Browse files
RESP3: DEBUG PROTOCOL: fix strcasecmp() check.
parent
795ad670
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/debug.c
View file @
4e2dd54d
...
@@ -533,26 +533,26 @@ NULL
...
@@ -533,26 +533,26 @@ NULL
/* DEBUG PROTOCOL [string|integer|double|bignum|null|array|set|map|
/* DEBUG PROTOCOL [string|integer|double|bignum|null|array|set|map|
* attrib|push|verbatim|true|false|state|err|bloberr] */
* attrib|push|verbatim|true|false|state|err|bloberr] */
char *name = c->argv[2]->ptr;
char *name = c->argv[2]->ptr;
if
(
strcasecmp
(
name
,
"string"
))
{
if (
!
strcasecmp(name,"string")) {
addReplyBulkCString(c,"Hello World");
addReplyBulkCString(c,"Hello World");
}
else
if
(
strcasecmp
(
name
,
"integer"
))
{
} else if (
!
strcasecmp(name,"integer")) {
addReplyLongLong(c,12345);
addReplyLongLong(c,12345);
}
else
if
(
strcasecmp
(
name
,
"double"
))
{
} else if (
!
strcasecmp(name,"double")) {
addReplyDouble(c,3.14159265359);
addReplyDouble(c,3.14159265359);
}
else
if
(
strcasecmp
(
name
,
"bignum"
))
{
} else if (
!
strcasecmp(name,"bignum")) {
addReplyString(c,"(1234567999999999999999999999999999999\r\n",40);
addReplyString(c,"(1234567999999999999999999999999999999\r\n",40);
}
else
if
(
strcasecmp
(
name
,
"null"
))
{
} else if (
!
strcasecmp(name,"null")) {
addReplyNull(c);
addReplyNull(c);
}
else
if
(
strcasecmp
(
name
,
"array"
))
{
} else if (
!
strcasecmp(name,"array")) {
addReplyArrayLen(c,3);
addReplyArrayLen(c,3);
for (int j = 0; j < 3; j++) addReplyLongLong(c,j);
for (int j = 0; j < 3; j++) addReplyLongLong(c,j);
}
else
if
(
strcasecmp
(
name
,
"set"
))
{
} else if (
!
strcasecmp(name,"set")) {
addReplySetLen(c,3);
addReplySetLen(c,3);
for (int j = 0; j < 3; j++) addReplyLongLong(c,j);
for (int j = 0; j < 3; j++) addReplyLongLong(c,j);
}
else
if
(
strcasecmp
(
name
,
"map"
))
{
} else if (
!
strcasecmp(name,"map")) {
addReplyMapLen(c,3);
addReplyMapLen(c,3);
for (int j = 0; j < 3; j++) addReplyLongLong(c,j);
for (int j = 0; j < 3; j++) addReplyLongLong(c,j);
}
else
if
(
strcasecmp
(
name
,
"attrib"
))
{
} else if (
!
strcasecmp(name,"attrib")) {
addReplyAttributeLen(c,1);
addReplyAttributeLen(c,1);
addReplyBulkCString(c,"key-popularity");
addReplyBulkCString(c,"key-popularity");
addReplyArrayLen(c,2);
addReplyArrayLen(c,2);
...
@@ -561,7 +561,7 @@ NULL
...
@@ -561,7 +561,7 @@ NULL
/* Attributes are not real replies, so a well formed reply should
/* Attributes are not real replies, so a well formed reply should
* also have a normal reply type after the attribute. */
* also have a normal reply type after the attribute. */
addReplyBulkCString(c,"Some real reply following the attribute");
addReplyBulkCString(c,"Some real reply following the attribute");
}
else
if
(
strcasecmp
(
name
,
"push"
))
{
} else if (
!
strcasecmp(name,"push")) {
addReplyPushLen(c,2);
addReplyPushLen(c,2);
addReplyBulkCString(c,"server-cpu-usage");
addReplyBulkCString(c,"server-cpu-usage");
addReplyLongLong(c,42);
addReplyLongLong(c,42);
...
...
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