Project

General

Profile

Actions

Bug #4509

closed

Net::IMAP::ResponseParseError: unexpected token CRLF (expected NUMBER)

Added by digger69 (Mark Nadig) about 13 years ago. Updated almost 13 years ago.

Status:
Closed
Target version:
-
ruby -v:
1.9.2-p136
Backport:
[ruby-core:<unknown>]

Description

=begin
To reproduce, create a free yahoo mail account. Using those credentials try this ruby code:

require 'net/imap'
Net::IMAP.debug = true
conn = Net::IMAP.new('imap.mail.yahoo.com', 143, false)
conn.instance_eval { send_command('ID ("GUID" "1")') }
conn.authenticate('LOGIN', <username>, <password>)
conn.select("INBOX")
uids = conn.uid_search(['ALL'])
conn.logout
conn.disconnect

You should have at least one welcome email and the response from the conn.uid_search(['ALL']) will return "* SEARCH 1 \r\n" The trailing space before the CRLF seems unanticipated by search_response and causes the 'unexpected token' downstream in number. Here is my patch:

 def search_response # line 2706 imap.rb
    token = match(T_ATOM)
    name = token.value.upcase
    token = lookahead
    if token.symbol == T_SPACE
      shift_token
      data = []
      while true
        token = lookahead

#begin patch - yahoo IMAP was returning pattern " SEARCH 1 2 \r\n so was doing push on CRLF
=begin before patch
case token.symbol
when T_CRLF
break
when T_SPACE
shift_token
end
data.push(number)
=end
case token.symbol
when T_CRLF
break
when T_SPACE
shift_token
else
data.push(number)
end
#end patch
end
else
data = []
end
return UntaggedResponse.new(name, data, @str)
end

I confirmed this code is unchanged in p180 so didn't test it there. I hope this helps.
=end


Files

bug4509.txt (1.63 KB) bug4509.txt bug report digger69 (Mark Nadig), 03/19/2011 12:50 AM
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0