mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
net/imap: separate @continuation_request_exception from @exception
Otherwise literal data will be sent even if NO response is returned because @exception is set to nil in receive_responses. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58844 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
c45a52af36
commit
27fb27ff42
2 changed files with 23 additions and 13 deletions
|
@ -1100,6 +1100,7 @@ module Net
|
|||
@tagged_response_arrival = new_cond
|
||||
@continued_command_tag = nil
|
||||
@continuation_request_arrival = new_cond
|
||||
@continuation_request_exception = nil
|
||||
@idle_done_cond = nil
|
||||
@logout_command_tag = nil
|
||||
@debug_output_bol = true
|
||||
|
@ -1165,7 +1166,8 @@ module Net
|
|||
when @logout_command_tag
|
||||
return
|
||||
when @continued_command_tag
|
||||
@exception = RESPONSE_ERRORS[resp.name].new(resp)
|
||||
@continuation_request_exception =
|
||||
RESPONSE_ERRORS[resp.name].new(resp)
|
||||
@continuation_request_arrival.signal
|
||||
end
|
||||
when UntaggedResponse
|
||||
|
@ -1351,14 +1353,19 @@ module Net
|
|||
end
|
||||
|
||||
def send_literal(str, tag)
|
||||
put_string("{" + str.bytesize.to_s + "}" + CRLF)
|
||||
@continued_command_tag = tag
|
||||
begin
|
||||
@continuation_request_arrival.wait
|
||||
raise @exception if @exception
|
||||
put_string(str)
|
||||
ensure
|
||||
@continued_command_tag = nil
|
||||
synchronize do
|
||||
put_string("{" + str.bytesize.to_s + "}" + CRLF)
|
||||
@continued_command_tag = tag
|
||||
@continuation_request_exception = nil
|
||||
begin
|
||||
@continuation_request_arrival.wait
|
||||
e = @continuation_request_exception || @exception
|
||||
raise e if e
|
||||
put_string(str)
|
||||
ensure
|
||||
@continued_command_tag = nil
|
||||
@continuation_request_exception = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -582,7 +582,7 @@ EOF
|
|||
received_mail = sock.read(size)
|
||||
sock.gets
|
||||
sock.print("RUBY0001 OK APPEND completed\r\n")
|
||||
sock.gets
|
||||
requests.push(sock.gets)
|
||||
sock.print("* BYE terminating connection\r\n")
|
||||
sock.print("RUBY0002 OK LOGOUT completed\r\n")
|
||||
ensure
|
||||
|
@ -598,6 +598,8 @@ EOF
|
|||
assert_equal("RUBY0001 APPEND INBOX {#{mail.size}}\r\n", requests[0])
|
||||
assert_equal(mail, received_mail)
|
||||
imap.logout
|
||||
assert_equal(2, requests.length)
|
||||
assert_equal("RUBY0002 LOGOUT\r\n", requests[1])
|
||||
ensure
|
||||
imap.disconnect if imap
|
||||
end
|
||||
|
@ -619,10 +621,9 @@ EOF
|
|||
sock = server.accept
|
||||
begin
|
||||
sock.print("* OK test server\r\n")
|
||||
line = sock.gets
|
||||
requests.push(line)
|
||||
requests.push(sock.gets)
|
||||
sock.print("RUBY0001 NO Mailbox doesn't exist\r\n")
|
||||
sock.gets
|
||||
requests.push(sock.gets)
|
||||
sock.print("* BYE terminating connection\r\n")
|
||||
sock.print("RUBY0002 OK LOGOUT completed\r\n")
|
||||
ensure
|
||||
|
@ -639,6 +640,8 @@ EOF
|
|||
assert_equal(1, requests.length)
|
||||
assert_equal("RUBY0001 APPEND INBOX {#{mail.size}}\r\n", requests[0])
|
||||
imap.logout
|
||||
assert_equal(2, requests.length)
|
||||
assert_equal("RUBY0002 LOGOUT\r\n", requests[1])
|
||||
ensure
|
||||
imap.disconnect if imap
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue