From 9f0fbeb833bb8929946abe34a751e21a7ead9886 Mon Sep 17 00:00:00 2001 From: Kazuki Yamaguchi Date: Sun, 8 May 2016 01:07:57 +0900 Subject: client: remove http2 (enable or disable HTTP/2) option --- lib/plum/client.rb | 19 +++++-------------- test/plum/client/test_client.rb | 10 ++-------- 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 -- cgit v1.2.3