We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4d2ea3e commit e3b4434Copy full SHA for e3b4434
src/redis_extension.cpp
@@ -39,7 +39,16 @@ class RedisProtocol {
39
// Bulk string response
40
size_t pos = response.find("\r\n");
41
if (pos == std::string::npos) return "";
42
- return response.substr(pos + 2);
+
43
+ // Skip the length prefix and first \r\n
44
+ pos += 2;
45
+ std::string value = response.substr(pos);
46
47
+ // Remove trailing \r\n if present
48
+ if (value.size() >= 2 && value.substr(value.size() - 2) == "\r\n") {
49
+ value = value.substr(0, value.size() - 2);
50
+ }
51
+ return value;
52
} else if (response[0] == '+') {
53
// Simple string response
54
return response.substr(1, response.find("\r\n") - 1);
0 commit comments