From: noreply@... Date: 2007-05-30T05:45:30+09:00 Subject: [ ruby-Bugs-7233 ] Net::IMAP seems unable to parse NOMODSEQ line from Cyrus IMAP server Bugs item #7233, was opened at 2006-12-12 03:36 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=1698&aid=7233&group_id=426 >Category: Networking / Communication / P Group: None Status: Open Resolution: None Priority: 3 Submitted By: Pete Birkinshaw (binaryape) Assigned to: Nobody (None) Summary: Net::IMAP seems unable to parse NOMODSEQ line from Cyrus IMAP server Initial Comment: The 'select' method of Net::IMAP in Ruby 1.8.5 works fine with older Cyrus IMAP servers but is failing with the latest Cyrus test release (2.3.7). There seems to be a problem parsing the NOMODSEQ line. The code require 'net/imap' Net::IMAP.debug = true # ... imap = Net::IMAP.new(server) imap.login(user, password) imap.select('INBOX') produces: S: * OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID AUTH=PLAIN SASL-IR] imap.example.com Cyrus IMAP4 v2.3.7 server ready C: RUBY0001 LOGIN usernamehere passwordhere S: RUBY0001 OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID LOGINDISABLED ACL RIGHTS=kxte QUOTA MAILBOX-REFERRALS NAMESPACE UIDPLUS NO_ATOMIC_RENAME UNSELECT CHILDREN MULTIAPPEND BINARY SORT SORT=MODSEQ THREAD=ORDEREDSUBJECT THREAD=REFERENCES ANNOTATEMORE CATENATE CONDSTORE IDLE LISTEXT LIST-SUBSCRIBED X-NETSCAPE URLAUTH] User logged in C: RUBY0002 NOOP S: RUBY0002 OK Completed C: RUBY0003 SELECT INBOX S: * FLAGS (\Answered \Flagged \Draft \Deleted \Seen) S: * OK [PERMANENTFLAGS (\Answered \Flagged \Draft \Deleted \Seen \*)] S: * 0 EXISTS S: * 0 RECENT S: * OK [UIDVALIDITY 1165577702] S: * OK [UIDNEXT 1] S: * OK [NOMODSEQ] Sorry, modsequences have not been enabled on this mailbox @str: "* OK [NOMODSEQ] Sorry, modsequences have not been enabled on this mailbox\r\n" @pos: 15 @lex_state: EXPR_BEG @token.symbol: RBRA @token.value: "]" /usr/lib/ruby/1.8/net/imap.rb:3104:in `parse_error': unexpected token RBRA (expected SPACE) (Net::IMAP::ResponseParseError) from /usr/lib/ruby/1.8/net/imap.rb:2956:in `match' from /usr/lib/ruby/1.8/net/imap.rb:2747:in `resp_text_code' from /usr/lib/ruby/1.8/net/imap.rb:2723:in `resp_text' from /usr/lib/ruby/1.8/net/imap.rb:1994:in `response_cond' from /usr/lib/ruby/1.8/net/imap.rb:1954:in `response_untagged' from /usr/lib/ruby/1.8/net/imap.rb:1930:in `response' from /usr/lib/ruby/1.8/net/imap.rb:1856:in `parse' from /usr/lib/ruby/1.8/net/imap.rb:996:in `get_response' from /usr/lib/ruby/1.8/net/imap.rb:925:in `receive_responses' from /usr/lib/ruby/1.8/net/imap.rb:918:in `initialize' from /usr/lib/ruby/1.8/net/imap.rb:917:in `initialize' from ./test.rb:10 ---------------------------------------------------------------------- Comment By: Brian Chapados (chapados) Date: 2007-02-19 02:29 Message: Here is a patch to recognize and ignore the [NOMODSEQ] response. This is probably not the proper way to handle this, but it will allow Net::IMAP to function with these Cyrus IMAP servers: Here is a pastie link in case the text below doesn't work http://pastie.caboo.se/41345 --- imap.rb 2007-02-19 02:20:05.000000000 -0800 +++ imap-patched.rb 2007-02-19 02:22:00.000000000 -0800 @@ -2743,6 +2743,10 @@ when /\A(?:UIDVALIDITY|UIDNEXT|UNSEEN)\z/n match(T_SPACE) result = ResponseCode.new(name, number) + when /\A(?:NOMODSEQ)\z/n + # recognize and ignore Cyrus IMAP 2.3.7+ NOMODSEQ response + # reference: http://rubyforge.org/tracker/?func=detail&atid=1698&aid=7233&group_id=426 + result = ResponseCode.new(name, nil) else match(T_SPACE) @lex_state = EXPR_CTEXT ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=1698&aid=7233&group_id=426