diff options
author | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-05-22 06:13:11 +0000 |
---|---|---|
committer | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-05-22 06:13:11 +0000 |
commit | 9cbf0b4c27c15d0d31db33c4e3e96bbfcbcf875a (patch) | |
tree | 18b4268ab27e8d4573d88ce65facf9a932f1b70b /lib/net/imap.rb | |
parent | 4396022e080b157b4ad6c8e3be14d88656e5e856 (diff) | |
download | ruby-9cbf0b4c27c15d0d31db33c4e3e96bbfcbcf875a.tar.gz |
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
Diffstat (limited to 'lib/net/imap.rb')
-rw-r--r-- | lib/net/imap.rb | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/lib/net/imap.rb b/lib/net/imap.rb index 770e45db7d..39c6734d3b 100644 --- a/lib/net/imap.rb +++ b/lib/net/imap.rb @@ -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 |