From 6418b22ff8fcaf7c3b7b1c3a81d2b98c23f66ea3 Mon Sep 17 00:00:00 2001 From: Kazuki Yamaguchi Date: Sat, 7 Nov 2015 16:42:36 +0900 Subject: client: hostname is set in SSLSocket, not in SSLContext --- lib/plum/client.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/plum/client.rb b/lib/plum/client.rb index 35c4001..197b214 100644 --- a/lib/plum/client.rb +++ b/lib/plum/client.rb @@ -166,6 +166,9 @@ module Plum if config[:tls] ctx = @config[:ssl_context] || new_ssl_ctx sock = OpenSSL::SSL::SSLSocket.new(sock, ctx) + if sock.respond_to?(:hostname=) + sock.hostname = @config[:hostname] || @host + end sock.sync_close = true sock.connect end @@ -228,9 +231,6 @@ module Plum ctx = OpenSSL::SSL::SSLContext.new ctx.ssl_version = :TLSv1_2 ctx.verify_mode = @config[:verify_mode] - if ctx.respond_to?(:hostname=) - ctx.hostname = @config[:hostname] || @host - end if ctx.respond_to?(:alpn_protocols) ctx.alpn_protocols = ["h2", "http/1.1"] end -- cgit v1.2.3