aboutsummaryrefslogtreecommitdiffstats
path: root/ext/openssl
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2016-07-04 20:59:32 +0900
committerKazuki Yamaguchi <k@rhe.jp>2016-07-09 16:17:36 +0900
commitf1aefdcb9e9a591fbca84e41f3121e0cdf93f431 (patch)
tree5acf5ed3e5a948c733b7185c08a2e3348e6a9509 /ext/openssl
parent08e1881f5663ceb3527c8953f353dfaef42062fb (diff)
downloadruby-openssl-f1aefdcb9e9a591fbca84e41f3121e0cdf93f431.tar.gz
Document OpenSSL::SSL::SSLSocket#sync_closetopic/doc-ssl-sync-close
Add rdoc for OpenSSL::SSL::SSLSocket#sync_close, and mention it in the example code in the rdoc for OpenSSL namespace. [GH ruby/openssl#11]
Diffstat (limited to 'ext/openssl')
-rw-r--r--ext/openssl/ossl.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/ext/openssl/ossl.c b/ext/openssl/ossl.c
index 83baa7b6..1af9b247 100644
--- a/ext/openssl/ossl.c
+++ b/ext/openssl/ossl.c
@@ -1063,15 +1063,21 @@ static void Init_ossl_locks(void)
* SSLSocket#connect must be called to initiate the SSL handshake and start
* encryption. A key and certificate are not required for the client socket.
*
+ * Note that SSLSocket#close doesn't close the underlying socket by default. Set
+ * SSLSocket#sync_close to true if you want.
+ *
* require 'socket'
*
* tcp_socket = TCPSocket.new 'localhost', 5000
* ssl_client = OpenSSL::SSL::SSLSocket.new tcp_socket, context
+ * ssl_client.sync_close = true
* ssl_client.connect
*
* ssl_client.puts "hello server!"
* puts ssl_client.gets
*
+ * ssl_client.close # shutdown the TLS connection and close tcp_socket
+ *
* === Peer Verification
*
* An unverified SSL connection does not provide much security. For enhanced