about summary refs log tree commit homepage
path: root/test
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-02-20 02:54:31 +0000
committerEric Wong <e@80x24.org>2016-02-20 02:54:43 +0000
commit551e670281bea77e727a732ba94275265ccae5f6 (patch)
tree215e3d000a7dcbc73cd6378198e60e2e64e22edd /test
parentfa7ae447b47085ab661898d0015c6d4f4c27c596 (diff)
downloadyahns-551e670281bea77e727a732ba94275265ccae5f6.tar.gz
The underlying SSL_write called by the OpenSSL socket when
we use write_nonblock must get the same arguments after a
call returns SSL_ERROR_WANT_READ or SSL_ERROR_WANT_WRITE.

Ensure that by always passing a copy of the user-supplied
buffer to OpenSSL::SSL::SSLSocket#write_nonblock and retaining
our copy of the string internally as @ssl_blocked if we hit
EAGAIN on the socket.

String#dup is inexpensive in modern Ruby, as copying a
non-embedded string is implemented using copy-on-write.

We also prefer to use write_nonblock directly instead of
using our kgio-dependent sendfile emulation layer to avoid
allocating a new string on partial writes.

ref: https://bugs.ruby-lang.org/issues/12085
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/73882
http://mid.gmane.org/redmine.issue-12085.20160219020243.4b790a77f1cdd593@ruby-lang.org
Diffstat (limited to 'test')
0 files changed, 0 insertions, 0 deletions