Bug #5163
closed(Net::IMAP::ResponseParseError) unknown attribute `)'
Description
Every now and then we get the following ResponseParseError.
(Net::IMAP::ResponseParseError) unknown attribute `)'
Full Trace:
.....rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/net/imap.rb:3235:in parse_error' .....rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/net/imap.rb:2159:in
msg_att'
.....rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/net/imap.rb:2125:in numeric_response' .....rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/net/imap.rb:2067:in
response_untagged'
.....rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/net/imap.rb:2047:in response' .....rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/net/imap.rb:1973:in
parse'
.....rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/net/imap.rb:1124:in get_response' .....rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/net/imap.rb:1036:in
receive_responses'
.....rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/net/imap.rb:1023:in `block in initialize'
What is happening is that some mail servers are sending down a space in front of the closing ")".
What I propose is that when we get a "T_SPACE", instead of looking ahead, we just start another loop.
def msg_att
match(T_LPAR)
attr = {}
while true
token = lookahead
case token.symbol
when T_RPAR
shift_token
break
when T_SPACE
shift_token
# CHANGE CHANGE CHANGE CHANGE
#token = lookahead
next
end
case token.value
when /\A(?:ENVELOPE)\z/ni
name, val = envelope_data
when /\A(?:FLAGS)\z/ni
name, val = flags_data
when /\A(?:INTERNALDATE)\z/ni
name, val = internaldate_data
when /\A(?:RFC822(?:\.HEADER|\.TEXT)?)\z/ni
name, val = rfc822_text
when /\A(?:RFC822\.SIZE)\z/ni
name, val = rfc822_size
when /\A(?:BODY(?:STRUCTURE)?)\z/ni
name, val = body_data
when /\A(?:UID)\z/ni
name, val = uid_data
else
parse_error("unknown attribute `%s'", token.value)
end
attr[name] = val
end
return attr
end
Updated by shugo (Shugo Maeda) about 13 years ago
- Status changed from Open to Assigned
- Assignee set to shugo (Shugo Maeda)
Updated by shugo (Shugo Maeda) almost 13 years ago
- Status changed from Assigned to Closed
- % Done changed from 0 to 100
This issue was solved with changeset r33001.
art , thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
- lib/net/imap.rb (msg_att): accepts extra space before ')'.
based on the patch by art lussos. [Bug #5163] [ruby-core:38820]