lib/aws-eventstream/decoder.rb in aws-eventstream-1.0.0 vs lib/aws-eventstream/decoder.rb in aws-eventstream-1.0.1
- old
+ new
@@ -121,9 +121,12 @@
def decode_io(io)
::Enumerator.new {|e| e << decode_message(io) unless io.eof? }
end
def decode_message(io)
+ # incomplete message prelude received, leave it in the buffer
+ return [nil, true] if io.bytesize < PRELUDE_LENGTH
+
# decode prelude
total_len, headers_len, prelude_buffer = prelude(io)
# incomplete message received, leave it in the buffer
return [nil, true] if io.bytesize < total_len