lib/net/imap.rb: Ignore trailing space for Microsoft Exchange Server

Based on the patch by keysen (Jérémy Carlier).
[ruby-core:81641] [Bug #13649]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59372 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
shugo 2017-07-19 23:08:34 +00:00
Родитель 02d1c08962
Коммит 016586824f
2 изменённых файлов: 17 добавлений и 0 удалений

Просмотреть файл

@ -2232,6 +2232,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

Просмотреть файл

@ -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