aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2016-05-08 01:07:57 +0900
committerKazuki Yamaguchi <k@rhe.jp>2016-05-08 01:07:57 +0900
commit9f0fbeb833bb8929946abe34a751e21a7ead9886 (patch)
tree05680327b1869367bc7c872671a5b8d0a30a0410
parentef45ef464bf769b3a57bbe574555874e562b4e5f (diff)
downloadplum-9f0fbeb833bb8929946abe34a751e21a7ead9886.tar.gz
client: remove http2 (enable or disable HTTP/2) option
-rw-r--r--lib/plum/client.rb19
-rw-r--r--test/plum/client/test_client.rb10
2 files changed, 7 insertions, 22 deletions
diff --git a/lib/plum/client.rb b/lib/plum/client.rb
index 6c3b16d..fbddd63 100644
--- a/lib/plum/client.rb
+++ b/lib/plum/client.rb
@@ -2,7 +2,6 @@
module Plum
class Client
DEFAULT_CONFIG = {
- http2: true,
scheme: "https",
hostname: nil,
verify_mode: OpenSSL::SSL::VERIFY_PEER,
@@ -150,18 +149,12 @@ module Plum
def _start
@started = true
-
- klass = @config[:http2] ? ClientSession : LegacyClientSession
nego = @socket || _connect
- if @config[:http2]
- if @config[:scheme] == "https"
- klass = nego ? ClientSession : LegacyClientSession
- else
- klass = UpgradeClientSession
- end
+ if @config[:scheme] == "https"
+ klass = nego ? ClientSession : LegacyClientSession
else
- klass = LegacyClientSession
+ klass = UpgradeClientSession
end
@session = klass.new(@socket, @config)
@@ -174,10 +167,8 @@ module Plum
cert_store = OpenSSL::X509::Store.new
cert_store.set_default_paths
ctx.cert_store = cert_store
- if @config[:http2]
- ctx.ciphers = "ALL:!" + SSLSocketServerConnection::CIPHER_BLACKLIST.join(":!")
- ctx.alpn_protocols = ["h2", "http/1.1"]
- end
+ ctx.ciphers = "ALL:!" + SSLSocketServerConnection::CIPHER_BLACKLIST.join(":!")
+ ctx.alpn_protocols = ["h2", "http/1.1"]
ctx
end
diff --git a/test/plum/client/test_client.rb b/test/plum/client/test_client.rb
index 2926f82..29f5b2d 100644
--- a/test/plum/client/test_client.rb
+++ b/test/plum/client/test_client.rb
@@ -82,22 +82,16 @@ class ClientTest < Minitest::Test
def test_session_socket_http2_https
sock = StringSocket.new
- client = Client.start(sock, nil, http2: true, scheme: "https")
+ client = Client.start(sock, nil, scheme: "https")
assert(client.session.class == ClientSession)
end
def test_session_socket_http2_http
sock = StringSocket.new("HTTP/1.1 100\r\n\r\n")
- client = Client.start(sock, nil, http2: true, scheme: "http")
+ client = Client.start(sock, nil, scheme: "http")
assert(client.session.class == UpgradeClientSession)
end
- def test_session_socket_http1
- sock = StringSocket.new
- client = Client.start(sock, nil, http2: false)
- assert(client.session.class == LegacyClientSession)
- end
-
private
def start_tls_server(&block)
ctx = OpenSSL::SSL::SSLContext.new