Skip to content

Commit e3b4434

Browse files
Lorenzo ManganiLorenzo Mangani
Lorenzo Mangani
authored and
Lorenzo Mangani
committed
result_newline
1 parent 4d2ea3e commit e3b4434

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/redis_extension.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,16 @@ class RedisProtocol {
3939
// Bulk string response
4040
size_t pos = response.find("\r\n");
4141
if (pos == std::string::npos) return "";
42-
return response.substr(pos + 2);
42+
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;
4352
} else if (response[0] == '+') {
4453
// Simple string response
4554
return response.substr(1, response.find("\r\n") - 1);

0 commit comments

Comments
 (0)