From 3c1c316a935918f1afc5dcdbf7cec6ec6cd9c605 Mon Sep 17 00:00:00 2001 From: Steve Gooberman-Hill Date: Tue, 8 Oct 2013 11:27:34 +0100 Subject: [PATCH] Update packet.rb eof? method can fail to recognise EOF, possibly depending on encodings. By explicitly unpacking the packet, the EOF packet first byte is always correctly recognised --- lib/mysql/packet.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/mysql/packet.rb b/lib/mysql/packet.rb index d7c5169..0aef91b 100644 --- a/lib/mysql/packet.rb +++ b/lib/mysql/packet.rb @@ -67,7 +67,8 @@ def ulong end def eof? - @data[0] == ?\xfe && @data.length == 5 + type, warnings, flags=@data.unpack("Cvv") + type == 0xfe && @data.length == 5 end def to_s