ruby-changes:47257
From: shugo <ko1@a...>
Date: Thu, 20 Jul 2017 08:08:40 +0900 (JST)
Subject: [ruby-changes:47257] shugo:r59372 (trunk): lib/net/imap.rb: Ignore trailing space for Microsoft Exchange Server
shugo 2017-07-20 08:08:34 +0900 (Thu, 20 Jul 2017) New Revision: 59372 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=59372 Log: lib/net/imap.rb: Ignore trailing space for Microsoft Exchange Server Based on the patch by keysen (J?\195?\169r?\195?\169my Carlier). [ruby-core:81641] [Bug #13649] Modified files: trunk/lib/net/imap.rb trunk/test/net/imap/test_imap_response_parser.rb Index: test/net/imap/test_imap_response_parser.rb =================================================================== --- test/net/imap/test_imap_response_parser.rb (revision 59371) +++ test/net/imap/test_imap_response_parser.rb (revision 59372) @@ -291,4 +291,17 @@ EOF https://github.com/ruby/ruby/blob/trunk/test/net/imap/test_imap_response_parser.rb#L291 assert_equal("test.xml", body.parts[1].disposition.param["FILENAME"]) assert_equal(nil, body.parts[1].language) end + + # [Bug #13649] + def test_status + parser = Net::IMAP::ResponseParser.new + response = parser.parse("* STATUS INBOX (UIDNEXT 1 UIDVALIDITY 1234)\r\n") + assert_equal("STATUS", response.name) + assert_equal("INBOX", response.data.mailbox) + assert_equal(1234, response.data.attr["UIDVALIDITY"]) + response = parser.parse("* STATUS INBOX (UIDNEXT 1 UIDVALIDITY 1234) \r\n") + assert_equal("STATUS", response.name) + assert_equal("INBOX", response.data.mailbox) + assert_equal(1234, response.data.attr["UIDVALIDITY"]) + end end Index: lib/net/imap.rb =================================================================== --- lib/net/imap.rb (revision 59371) +++ lib/net/imap.rb (revision 59372) @@ -2232,6 +2232,10 @@ module Net https://github.com/ruby/ruby/blob/trunk/lib/net/imap.rb#L2232 else result = response_tagged end + while lookahead.symbol == T_SPACE + # Ignore trailing space for Microsoft Exchange Server + shift_token + end match(T_CRLF) match(T_EOF) return result -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/