h2 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/CHANGELOG.md +5 -0
- data/lib/h2/client.rb +17 -4
- data/lib/h2/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dfd3251c0bd00b269688a2e87b54e009be339aff
|
4
|
+
data.tar.gz: ec1799dd72604f8e089bd7be923f1f5083ec8c2d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e99a4e6d24b280b3ca9b60189e067c4382f585723a8aae28185e5e85423d0f2ad11cb5d8758082bc323f51a9fcffbdbaa522c12552d1777d27c37c93994ddb62
|
7
|
+
data.tar.gz: cb8952f4b441870ee7b8fc3d1dd839c74fd653ce8a7b41eaf1d0c4b0a84fb4eab687c995f2505b1fe3ccaa5fb6134f8739ba8fbad8fbd419f838ef9e0c0ca16b
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
h2 changelog
|
2
2
|
============
|
3
3
|
|
4
|
+
### 0.3.1 13 may 2017
|
5
|
+
|
6
|
+
* `servername` should not be set on client socket when IP address (#1)
|
7
|
+
* add ALPN/NPN checks for minimum version of underlying OpenSSL library
|
8
|
+
|
4
9
|
### 0.3.0 10 may 2017
|
5
10
|
|
6
11
|
* update http-2 gem version >= 0.8.4 for window update state fix
|
data/lib/h2/client.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'openssl'
|
2
|
+
require 'resolv'
|
2
3
|
require 'h2/client/tcp_socket'
|
3
4
|
|
4
5
|
module H2
|
@@ -13,8 +14,10 @@ module H2
|
|
13
14
|
:promise
|
14
15
|
]
|
15
16
|
|
16
|
-
|
17
|
-
|
17
|
+
ALPN_OPENSSL_MIN_VERSION = 0x10002001
|
18
|
+
ALPN_PROTOCOLS = ['h2']
|
19
|
+
DEFAULT_MAXLEN = 4096
|
20
|
+
RE_IP_ADDR = Regexp.union Resolv::IPv4::Regex, Resolv::IPv6::Regex
|
18
21
|
|
19
22
|
attr_accessor :last_stream
|
20
23
|
attr_reader :client, :reader, :scheme, :socket, :streams
|
@@ -221,7 +224,7 @@ module H2
|
|
221
224
|
def tls_socket socket
|
222
225
|
socket = OpenSSL::SSL::SSLSocket.new socket, create_ssl_context
|
223
226
|
socket.sync_close = true
|
224
|
-
socket.hostname = @addr
|
227
|
+
socket.hostname = @addr unless RE_IP_ADDR.match(@addr)
|
225
228
|
socket.connect
|
226
229
|
socket
|
227
230
|
end
|
@@ -230,7 +233,6 @@ module H2
|
|
230
233
|
#
|
231
234
|
def create_ssl_context
|
232
235
|
ctx = OpenSSL::SSL::SSLContext.new
|
233
|
-
ctx.alpn_protocols = ALPN_PROTOCOLS
|
234
236
|
ctx.ca_file = @tls[:ca_file] if @tls[:ca_file]
|
235
237
|
ctx.ca_path = @tls[:ca_path] if @tls[:ca_path]
|
236
238
|
ctx.ciphers = @tls[:ciphers] || OpenSSL::SSL::SSLContext::DEFAULT_PARAMS[:ciphers]
|
@@ -238,8 +240,19 @@ module H2
|
|
238
240
|
ctx.ssl_version = :TLSv1_2
|
239
241
|
ctx.verify_mode = @tls[:verify_mode] || ( OpenSSL::SSL::VERIFY_PEER |
|
240
242
|
OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT )
|
243
|
+
set_ssl_context_protocols ctx
|
241
244
|
ctx
|
242
245
|
end
|
243
246
|
|
247
|
+
if OpenSSL::OPENSSL_VERSION_NUMBER >= ALPN_OPENSSL_MIN_VERSION
|
248
|
+
def set_ssl_context_protocols ctx
|
249
|
+
ctx.alpn_protocols = ALPN_PROTOCOLS
|
250
|
+
end
|
251
|
+
else
|
252
|
+
def set_ssl_context_protocols ctx
|
253
|
+
ctx.npn_protocols = ALPN_PROTOCOLS
|
254
|
+
end
|
255
|
+
end
|
256
|
+
|
244
257
|
end
|
245
258
|
end
|
data/lib/h2/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: h2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kenichi Nakamura
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-05-
|
11
|
+
date: 2017-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http-2
|
@@ -132,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
132
132
|
version: '0'
|
133
133
|
requirements: []
|
134
134
|
rubyforge_project:
|
135
|
-
rubygems_version: 2.6.
|
135
|
+
rubygems_version: 2.6.12
|
136
136
|
signing_key:
|
137
137
|
specification_version: 4
|
138
138
|
summary: an http/2 client based on http-2 and modern ruby
|