aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2016-05-08 01:12:56 +0900
committerKazuki Yamaguchi <k@rhe.jp>2016-05-08 15:17:15 +0900
commit69ad77f65dfb2d4f362c3d96bc6907e3d97a099a (patch)
tree3c9ae993c8b2eb1793c856890f34ac26c79484c6
parent2e0428a50a1190a06fded9dc52fce70c6e59e8a4 (diff)
downloadplum-69ad77f65dfb2d4f362c3d96bc6907e3d97a099a.tar.gz
client: OpenSSL::SSL::SSLContext always responds to hostname=
OpenSSL supports SNI since 0.9.8f and 1.0.0.
-rw-r--r--lib/plum/client.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/plum/client.rb b/lib/plum/client.rb
index bf288c9..b232a78 100644
--- a/lib/plum/client.rb
+++ b/lib/plum/client.rb
@@ -138,10 +138,12 @@ module Plum
if @config[:https]
ctx = @config[:ssl_context] || new_ssl_ctx
@socket = OpenSSL::SSL::SSLSocket.new(@socket, ctx)
- @socket.hostname = @config[:hostname] if @socket.respond_to?(:hostname=)
+ @socket.hostname = @config[:hostname]
@socket.sync_close = true
@socket.connect
- @socket.post_connection_check(@config[:hostname]) if ctx.verify_mode != OpenSSL::SSL::VERIFY_NONE
+ if ctx.verify_mode != OpenSSL::SSL::VERIFY_NONE
+ @socket.post_connection_check(@config[:hostname])
+ end
@socket.alpn_protocol == "h2"
end