From: Edsard Boelen Date: 2011-11-11T18:33:25+09:00 Subject: [ruby-core:40938] [ruby-trunk - Bug #5616][Open] * /lib/net/imap.rb exception in IMAP.new when get_response returns nil Issue #5616 has been reported by Edsard Boelen. ---------------------------------------- Bug #5616: * /lib/net/imap.rb exception in IMAP.new when get_response returns nil http://redmine.ruby-lang.org/issues/5616 Author: Edsard Boelen Status: Open Priority: Normal Assignee: Category: lib Target version: ruby -v: ruby 1.8.7 (2011-02-18 patchlevel 334) The error occurred in ruby 1.8.7 when connecting to a buggy IMAP server. The error message was: Undefined method 'name' in imap.rb It is this piece of code in line 915 (line 1067 in ruby 1.9.3): @greeting = get_response if @greeting.name == "BYE" @sock.close raise ByeResponseError, @greeting end after a little search I saw that the function 'get_response' returns nil if the buffer is empty: def get_response buff = "" while true ... end return nil if buff.length == 0 ... return @parser.parse(buff) end -- http://redmine.ruby-lang.org