net-pop
net-pop copied to clipboard
When retrieving UIDL with POP, data sometimes goes missing.
Hello,
Thank you for your continuous contributions to Ruby. I am using this library for work, and I have encountered a peculiar issue where UIDLs are sometimes missing.
I attempted to address this with the following patch:
diff --git a/lib/net/pop.rb b/lib/net/pop.rb
index d4ee8f8..d56a270 100644
--- a/lib/net/pop.rb
+++ b/lib/net/pop.rb
@@ -969,6 +969,7 @@ module Net
getok('UIDL')
table = {}
@socket.each_list_item do |line|
+ pp "bad size #{line} #{line.split(' ').size}" if line.split(' ').size != 2
num, uid = line.split(' ')
table[num.to_i] = uid
end
The results were as follows:
"bad size 588 UID794684-1450674668\r\n" + "589 UID794685-1450674668 4"
"bad size 3789 UID797886-1450674668\r\n" + "3790 UID797887-1450674668 4"
"bad size 7885 UID801982-1450674668\r\n" + "7886 UID801983-1450674668 4"
It seems that the delimiter is being ignored during the reading process. Although it appears that the socket is implemented to read up to \r\n
as seen here:
https://github.com/ruby/ruby/blob/c0938fd24c927954dbe5d42e70844b6a89516786/lib/net/protocol.rb#L387
However, it seems this is being ignored. This is quite peculiar, and I am wondering if you have any ideas about this issue. If not, I am considering some potential solutions.
Thank you for your assistance.