Issue #8415 has been reported by peter / sanebox.com (Peter Kovacs).

----------------------------------------
Bug #8415: Net::IMAP#capability_response raises "Net::IMAP::ResponseParseError: unexpected token CRLF" for common CAPABILITY
https://bugs.ruby-lang.org/issues/8415

Author: peter / sanebox.com (Peter Kovacs)
Status: Open
Priority: Normal
Assignee: 
Category: lib
Target version: 
ruby -v: 2.0.0p0
Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN


Unfortunately Apple's iCloud IMAP service returns a non-conforming CAPABILITY response which causes this parse error to be raised:

"* CAPABILITY st11p00mm-iscream009 1Q49 XAPPLEPUSHSERVICE IMAP4 IMAP4rev1 SASL-IR AUTH=ATOKEN AUTH=PLAIN \r\n"

To reproduce:

    require 'net/imap'
    imap = Net::IMAP.new( 'imap.mail.me.com', 993, true )
    imap.capability

To fix:
  
--- lib/ruby/2.0.0/net/imap.rb~ 2013-05-17 07:12:04.000000000 -0400
+++ lib/ruby/2.0.0/net/imap.rb  2013-05-17 07:13:05.000000000 -0400
@@ -2954,6 +2954,7 @@
             break
           when T_SPACE
             shift_token
+           next
           end
           data.push(atom.upcase)
         end

This bug also applies to 1.8.7


-- 
http://bugs.ruby-lang.org/