File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -1104,4 +1104,15 @@ describe Redis do
1104
1104
callbacks_received.should eq([" psubscribe" , " pmessage" , " punsubscribe" ])
1105
1105
end
1106
1106
end
1107
+
1108
+ describe " large values" do
1109
+ redis = Redis .new
1110
+
1111
+ it " sends and receives a large value correctly" do
1112
+ redis.del(" foo" )
1113
+ large_value = " 0123456789" * 100_000 # 1 MB
1114
+ redis.set(" foo" , large_value)
1115
+ redis.get(" foo" ).should eq(large_value)
1116
+ end
1117
+ end
1107
1118
end
Original file line number Diff line number Diff line change @@ -87,9 +87,10 @@ class Redis::Connection
87
87
# The "Null bulk string" aka nil
88
88
return nil if length == -1
89
89
90
- slice = Slice (UInt8 ).new(length)
91
- @socket .read(slice)
92
- bulk_string = String .new(slice)
90
+ bulk_string = String .new(length) do |buffer |
91
+ @socket .read_fully(Slice .new(buffer, length))
92
+ {length, 0 }
93
+ end
93
94
# Ignore CR/LF
94
95
@socket .skip(2 )
95
96
bulk_string
You can’t perform that action at this time.
0 commit comments