aboutsummaryrefslogtreecommitdiffstats
path: root/lib/plum/client.rb
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2016-05-08 01:10:22 +0900
committerKazuki Yamaguchi <k@rhe.jp>2016-05-08 15:17:15 +0900
commit2e0428a50a1190a06fded9dc52fce70c6e59e8a4 (patch)
tree60e587d9594b924d88b2bb6bffc902076986775e /lib/plum/client.rb
parent9f0fbeb833bb8929946abe34a751e21a7ead9886 (diff)
downloadplum-2e0428a50a1190a06fded9dc52fce70c6e59e8a4.tar.gz
client: replace 'scheme' option with 'https' option
The scheme is always 'http' or 'https', so boolean is sufficient.
Diffstat (limited to 'lib/plum/client.rb')
-rw-r--r--lib/plum/client.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/plum/client.rb b/lib/plum/client.rb
index fbddd63..bf288c9 100644
--- a/lib/plum/client.rb
+++ b/lib/plum/client.rb
@@ -2,7 +2,7 @@
module Plum
class Client
DEFAULT_CONFIG = {
- scheme: "https",
+ https: true,
hostname: nil,
verify_mode: OpenSSL::SSL::VERIFY_PEER,
ssl_context: nil,
@@ -31,7 +31,7 @@ module Plum
else
@socket = nil
@host = host
- @port = port || (config[:scheme] == "https" ? 443 : 80)
+ @port = port || (config[:https] ? 443 : 80)
end
@config = DEFAULT_CONFIG.merge(hostname: host).merge(config)
@started = false
@@ -135,7 +135,7 @@ module Plum
def _connect
@socket = TCPSocket.open(@host, @port)
- if @config[:scheme] == "https"
+ 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=)
@@ -151,7 +151,7 @@ module Plum
@started = true
nego = @socket || _connect
- if @config[:scheme] == "https"
+ if @config[:https]
klass = nego ? ClientSession : LegacyClientSession
else
klass = UpgradeClientSession