From 937457fee8b10359036b5bf47753505d8daf4610 Mon Sep 17 00:00:00 2001 From: usa Date: Wed, 31 Jan 2018 11:26:08 +0000 Subject: merge revision(s) 59372: [Backport #13649] lib/net/imap.rb: Ignore trailing space for Microsoft Exchange Server Based on the patch by keysen (Jeremy Carlier). [ruby-core:81641] [Bug #13649] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@62131 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 7 +++++++ lib/net/imap.rb | 4 ++++ test/net/imap/test_imap_response_parser.rb | 13 +++++++++++++ version.h | 2 +- 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 0d8b0cb151..30ea6b5c76 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Wed Jan 31 20:25:09 2018 Shugo Maeda + + lib/net/imap.rb: Ignore trailing space for Microsoft Exchange Server + + Based on the patch by keysen (Jeremy Carlier). + [ruby-core:81641] [Bug #13649] + Wed Jan 31 20:23:49 2018 sorah (Shota Fukumori) Add documents on Process::CLOCK_* constants diff --git a/lib/net/imap.rb b/lib/net/imap.rb index 439ca13206..88fccdbcce 100644 --- a/lib/net/imap.rb +++ b/lib/net/imap.rb @@ -2201,6 +2201,10 @@ module Net 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 diff --git a/test/net/imap/test_imap_response_parser.rb b/test/net/imap/test_imap_response_parser.rb index db07f9b022..3ebb248b4e 100644 --- a/test/net/imap/test_imap_response_parser.rb +++ b/test/net/imap/test_imap_response_parser.rb @@ -291,4 +291,17 @@ EOF 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 diff --git a/version.h b/version.h index 7378b0b975..449f0e516d 100644 --- a/version.h +++ b/version.h @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.3.7" #define RUBY_RELEASE_DATE "2018-01-31" -#define RUBY_PATCHLEVEL 392 +#define RUBY_PATCHLEVEL 393 #define RUBY_RELEASE_YEAR 2018 #define RUBY_RELEASE_MONTH 1 -- cgit v1.2.3