aboutsummaryrefslogtreecommitdiffstats
path: root/lib/plum
diff options
context:
space:
mode:
Diffstat (limited to 'lib/plum')
-rw-r--r--lib/plum/client.rb8
-rw-r--r--lib/plum/client/client_session.rb2
2 files changed, 5 insertions, 5 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
diff --git a/lib/plum/client/client_session.rb b/lib/plum/client/client_session.rb
index 09539aa..cdc3e7b 100644
--- a/lib/plum/client/client_session.rb
+++ b/lib/plum/client/client_session.rb
@@ -39,7 +39,7 @@ module Plum
headers = { ":method" => nil,
":path" => nil,
":authority" => @config[:hostname],
- ":scheme" => @config[:scheme]
+ ":scheme" => @config[:https] ? "https" : "http",
}.merge(headers)
response = Response.new(**options)