aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2015-12-18 11:04:33 +0900
committerKazuki Yamaguchi <k@rhe.jp>2015-12-18 11:06:23 +0900
commit6becc12ef4e7235e749a92e3115b1155b39fc9e4 (patch)
tree32667184a70e9af1ccb5537092cf9a3ba24aac8a
parentdcff9005d8c3a99b1d820f7f5891bc500b5e9bc6 (diff)
downloadplum-6becc12ef4e7235e749a92e3115b1155b39fc9e4.tar.gz
client: remove NPN support (Ruby 2.3.0 will be released soon)
-rw-r--r--.gitignore1
-rw-r--r--README.md2
-rw-r--r--lib/plum/client.rb12
3 files changed, 4 insertions, 11 deletions
diff --git a/.gitignore b/.gitignore
index 6c58a7a..a456d3f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,6 @@
/.bundle/
/.yardoc
+/.ruby-version
/Gemfile.lock
/_yardoc/
/coverage/
diff --git a/README.md b/README.md
index bbf7575..b05e22d 100644
--- a/README.md
+++ b/README.md
@@ -63,7 +63,7 @@ If the server does't support HTTP/2, `Plum::Client` tries to use HTTP/1.x instea
+-----------------+
v "https"
+-----------------+
- | ALPN(/NPN) | failed
+ | ALPN | failed
| negotiation |-------> HTTP/1.x
+-----------------+
| "h2"
diff --git a/lib/plum/client.rb b/lib/plum/client.rb
index 103d938..020b372 100644
--- a/lib/plum/client.rb
+++ b/lib/plum/client.rb
@@ -143,8 +143,7 @@ module Plum
@socket.connect
@socket.post_connection_check(@config[:hostname]) if ctx.verify_mode != OpenSSL::SSL::VERIFY_NONE
- @socket.respond_to?(:alpn_protocol) && @socket.alpn_protocol == "h2" ||
- @socket.respond_to?(:npn_protocol) && @socket.npn_protocol == "h2"
+ @socket.alpn_protocol == "h2"
end
end
@@ -176,14 +175,7 @@ module Plum
ctx.cert_store = cert_store
if @config[:http2]
ctx.ciphers = "ALL:!" + SSLSocketServerConnection::CIPHER_BLACKLIST.join(":!")
- if ctx.respond_to?(:alpn_protocols)
- ctx.alpn_protocols = ["h2", "http/1.1"]
- end
- if ctx.respond_to?(:npn_select_cb) # TODO: RFC 7540 does not define protocol negotiation with NPN
- ctx.npn_select_cb = -> protocols {
- protocols.include?("h2") ? "h2" : protocols.first
- }
- end
+ ctx.alpn_protocols = ["h2", "http/1.1"]
end
ctx
end