aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2015-11-07 16:42:36 +0900
committerKazuki Yamaguchi <k@rhe.jp>2015-11-07 16:42:36 +0900
commit6418b22ff8fcaf7c3b7b1c3a81d2b98c23f66ea3 (patch)
tree041a5c01d10b655b9a2ddcfb51ecb6446447d4b8
parent7d4afee71eee8f1c242d400affb278e3bd4fd276 (diff)
downloadplum-6418b22ff8fcaf7c3b7b1c3a81d2b98c23f66ea3.tar.gz
client: hostname is set in SSLSocket, not in SSLContext
-rw-r--r--lib/plum/client.rb6
1 files 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