Issue #12085 has been reported by Eric Wong.

----------------------------------------
Feature #12085: [PATCH] OpenSSL::SSL::SSLSocket#write_nonblock: expand documentation
https://bugs.ruby-lang.org/issues/12085

* Author: Eric Wong
* Status: Open
* Priority: Normal
* Assignee: Zachary Scott
----------------------------------------
~~~
* ext/openssl/lib/openssl/buffering.rb (write_nonblock):
  document `exception: false' keyword and warn about retrying
  the using the same object.

The following test patch illustrates the problem I encountered:

  --- a/test/openssl/test_pair.rb
  +++ b/test/openssl/test_pair.rb
  @@ -280,6 +280,33 @@ def test_write_nonblock_with_buffered_data_no_exceptions
       }
     end

  +  def test_write_nonblock_retry
  +    ssl_pair {|s1, s2|
  +      written = String.new
  +      n = 0
  +      buf = 'a' * 11
  +      case ret = s1.write_nonblock(buf, exception: false)
  +      when :wait_readable then break
  +      when :wait_writable then break
  +      when Integer
  +        written << buf
  +        n += ret
  +        exp = buf.bytesize
  +        if ret != exp
  +          buf = buf.byteslice(ret, exp - ret)
  +        end
  +      end while true
  +      readed = s2.read(n)
  +      assert_equal written, readed
  +      assert_kind_of Symbol, ret
  +      buf2 = Marshal.load(Marshal.dump(buf))
  +      assert_raise(OpenSSL::SSL::SSLError) do
  +        s1.write_nonblock(buf2, exception: false)
  +      end
  +      assert_kind_of Integer, s1.write_nonblock(buf, exception: false)
  +    }
  +  end
  +
     def tcp_pair
       host = "127.0.0.1"
       serv = TCPServer.new(host, 0)

I do not plan to commit the test change since OpenSSL behavior
may be improved in the future.
~~~


---Files--------------------------------
0001-OpenSSL-SSL-SSLSocket-write_nonblock-expand-document.patch (2.84 KB)


-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>