You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
Send 0 length buffers properly.
Still need to handle 0 length bulk data properly though. Whoops.
This commit is contained in:
12
index.js
12
index.js
@@ -512,9 +512,14 @@ RedisClient.prototype.send_command = function () {
|
||||
}
|
||||
|
||||
if (arg instanceof Buffer) {
|
||||
stream.write("$" + arg.length + "\r\n");
|
||||
stream.write(arg);
|
||||
stream.write("\r\n");
|
||||
if (arg.length === 0) {
|
||||
console.log("Using empty string for 0 length buffer");
|
||||
stream.write("$0\r\n\r\n");
|
||||
} else {
|
||||
stream.write("$" + arg.length + "\r\n");
|
||||
stream.write(arg);
|
||||
stream.write("\r\n");
|
||||
}
|
||||
} else {
|
||||
stream.write("$" + arg.length + "\r\n" + arg + "\r\n");
|
||||
}
|
||||
@@ -524,6 +529,7 @@ RedisClient.prototype.send_command = function () {
|
||||
|
||||
RedisClient.prototype.end = function () {
|
||||
this.stream._events = {};
|
||||
this.connected = false;
|
||||
return this.stream.end();
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user