aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2015-11-03 21:02:06 +0900
committerKazuki Yamaguchi <k@rhe.jp>2015-11-03 21:02:06 +0900
commite910b2e92536ead6adebb4f338abfa3da058550b (patch)
treea3462925390f1be18ff5f907d7b21b4b9b4cdc4c /lib
parenta7fddee76f78a97059d798d76c2d8d85c643c7aa (diff)
downloadplum-e910b2e92536ead6adebb4f338abfa3da058550b.tar.gz
client: set SSLContext#verify_mode
Diffstat (limited to 'lib')
-rw-r--r--lib/plum/client.rb11
1 files changed, 3 insertions, 8 deletions
diff --git a/lib/plum/client.rb b/lib/plum/client.rb
index d30b0a2..b366791 100644
--- a/lib/plum/client.rb
+++ b/lib/plum/client.rb
@@ -2,7 +2,8 @@
module Plum
class Client
DEFAULT_CONFIG = {
- https: true
+ https: true,
+ verify_mode: OpenSSL::SSL::VERIFY_NONE,
}.freeze
attr_reader :host, :port, :config
@@ -101,10 +102,6 @@ module Plum
response
end
- def get(path, headers = {})
- request({ ":method" => "GET", ":path" => path }.merge(headers))
- end
-
# @!method get
# @!method head
# @!method delete
@@ -159,9 +156,6 @@ module Plum
sock = OpenSSL::SSL::SSLSocket.new(sock, ctx)
sock.sync_close = true
sock.connect
- if ctx.verify_mode != OpenSSL::SSL::VERIFY_NONE
- sock.post_connection_check(@config[:hostname] || @host)
- end
end
@socket = sock
@@ -201,6 +195,7 @@ module Plum
def new_ssl_ctx
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