You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kvrocks.apache.org by GitBox <gi...@apache.org> on 2022/09/29 16:59:34 UTC

[GitHub] [incubator-kvrocks] tisonkun commented on a diff in pull request #933: fix: ping return bulk string

tisonkun commented on code in PR #933:
URL: https://github.com/apache/incubator-kvrocks/pull/933#discussion_r983802750


##########
src/redis_cmd.cc:
##########
@@ -242,7 +242,13 @@ class CommandFlushAll : public Commander {
 class CommandPing : public Commander {
  public:
   Status Execute(Server *svr, Connection *conn, std::string *output) override {
-    *output = Redis::SimpleString("PONG");
+    if (args_.size() == 1) {
+      *output = Redis::SimpleString("PONG");
+    } else if (args_.size() == 2) {
+      *output = Redis::SimpleString(args_[1]);

Review Comment:
   IIRC Redis will return bulk string here. That is,
   
   ```bash
   $ echo -e '*1\r\n$4\r\nPING\r\n' | nc localhost 6379
   +PONG
   
   $ echo -e '*2\r\n$4\r\nPING\r\n$4\r\nPONG\r\n' | nc localhost 6379
   $4
   PONG
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org