mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
lib/net/imap.rb: Accept continuation requests without response text
The IMAP server of DOCOMO returns such continuation requests. [ruby-list:50558] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59666 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
917beef327
commit
21e4ade56b
3 changed files with 18 additions and 5 deletions
|
@ -964,7 +964,7 @@ module Net
|
||||||
@idle_done_cond.wait(timeout)
|
@idle_done_cond.wait(timeout)
|
||||||
@idle_done_cond = nil
|
@idle_done_cond = nil
|
||||||
if @receiver_thread_terminating
|
if @receiver_thread_terminating
|
||||||
raise Net::IMAP::Error, "connection closed"
|
raise @exception || Net::IMAP::Error.new("connection closed")
|
||||||
end
|
end
|
||||||
ensure
|
ensure
|
||||||
unless @receiver_thread_terminating
|
unless @receiver_thread_terminating
|
||||||
|
@ -2268,8 +2268,13 @@ module Net
|
||||||
|
|
||||||
def continue_req
|
def continue_req
|
||||||
match(T_PLUS)
|
match(T_PLUS)
|
||||||
match(T_SPACE)
|
token = lookahead
|
||||||
return ContinuationRequest.new(resp_text, @str)
|
if token.symbol == T_SPACE
|
||||||
|
shift_token
|
||||||
|
return ContinuationRequest.new(resp_text, @str)
|
||||||
|
else
|
||||||
|
return ContinuationRequest.new(ResponseText.new(nil, ""), @str)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def response_untagged
|
def response_untagged
|
||||||
|
|
|
@ -432,7 +432,7 @@ class IMAPTest < Test::Unit::TestCase
|
||||||
c.signal
|
c.signal
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
assert_raise(Net::IMAP::Error) do
|
assert_raise(EOFError) do
|
||||||
imap.idle do |res|
|
imap.idle do |res|
|
||||||
m.synchronize do
|
m.synchronize do
|
||||||
in_idle = true
|
in_idle = true
|
||||||
|
|
|
@ -60,7 +60,7 @@ EOF
|
||||||
|
|
||||||
def test_flag_xlist_inbox
|
def test_flag_xlist_inbox
|
||||||
parser = Net::IMAP::ResponseParser.new
|
parser = Net::IMAP::ResponseParser.new
|
||||||
response = parser.parse(<<EOF.gsub(/\n/, "\r\n").taint)
|
response = parser.parse(<<EOF.gsub(/\n/, "\r\n").taint)
|
||||||
* XLIST (\\Inbox) "." "INBOX"
|
* XLIST (\\Inbox) "." "INBOX"
|
||||||
EOF
|
EOF
|
||||||
assert_equal [:Inbox], response.data.attr
|
assert_equal [:Inbox], response.data.attr
|
||||||
|
@ -311,4 +311,12 @@ EOF
|
||||||
response = parser.parse("* 1 FETCH (FLAGS (\Seen) MODSEQ (12345) UID 5)\r\n")
|
response = parser.parse("* 1 FETCH (FLAGS (\Seen) MODSEQ (12345) UID 5)\r\n")
|
||||||
assert_equal(12345, response.data.attr["MODSEQ"])
|
assert_equal(12345, response.data.attr["MODSEQ"])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_continuation_request_without_response_text
|
||||||
|
parser = Net::IMAP::ResponseParser.new
|
||||||
|
response = parser.parse("+\r\n")
|
||||||
|
assert_instance_of(Net::IMAP::ContinuationRequest, response)
|
||||||
|
assert_equal(nil, response.data.code)
|
||||||
|
assert_equal("", response.data.text)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue