summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-31 11:26:08 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-31 11:26:08 +0000
commit937457fee8b10359036b5bf47753505d8daf4610 (patch)
tree229c0e316a8e2bd2aff30ba84fb2150ab2771afa
parent1f32210886991820d815c4d1962dded7ff7eb816 (diff)
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
-rw-r--r--ChangeLog7
-rw-r--r--lib/net/imap.rb4
-rw-r--r--test/net/imap/test_imap_response_parser.rb13
-rw-r--r--version.h2
4 files changed, 25 insertions, 1 deletions
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 <shugo@ruby-lang.org>
+
+ 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) <her@sorah.jp>
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