libuv 3.1.3 → 3.1.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4190660edd229aa2b65482254894ec253deb7dd6
4
- data.tar.gz: 668f6bec567de8bf6ce856b8be5c9b8bde67cf88
3
+ metadata.gz: bc7d4515dcefccae48d6784b05544ea06f19f714
4
+ data.tar.gz: 75398d606d64641fb9d332275393eafa94d6746e
5
5
  SHA512:
6
- metadata.gz: 258baedb42f399f62f863d3e40836a6867131c72f740a7eecb34b7985f41cd8245234328cbdf96b84901915e242f1a0c79bd052a061c6014f50c94e1a94cf328
7
- data.tar.gz: f90552d250222e95e866c9ec5d79bda3ad8ae224e64a2a6f2d197175da3be88f0ef11cd3c6efa4ee43661c463659bcdc936eafb6816eb0d26db1cb2aa1538845
6
+ metadata.gz: 1b05b553383f145dac5bbe773d11a4019175d0e844c27f7b94ae7da79f18310ee9d31e459a1d4b416fee8becf5300536c6b73f3339879d615376abc53d0b4e19
7
+ data.tar.gz: 499c11534e2a896357f22358a84b9d14402da7590c108ea16e0120d66e99ab1a697c90a73f5fc344ff7adfa4c36a720ce51d69df532ff0d1667b3121c8e1ed4c
data/lib/libuv/tcp.rb CHANGED
@@ -17,14 +17,16 @@ module Libuv
17
17
 
18
18
  attr_reader :connected
19
19
  attr_reader :protocol
20
+ attr_reader :tls
20
21
 
21
22
  # Check if tls active on the socket
22
23
  def tls?; !@tls.nil?; end
23
24
 
24
25
 
25
- def initialize(reactor, acceptor = nil, progress: nil, flags: nil)
26
+ def initialize(reactor, acceptor = nil, progress: nil, flags: nil, **tls_options)
26
27
  @reactor = reactor
27
28
  @progress = progress
29
+ @tls_options = tls_options
28
30
 
29
31
  tcp_ptr = ::Libuv::Ext.allocate_handle_tcp
30
32
  error = if flags
@@ -55,7 +57,18 @@ module Libuv
55
57
 
56
58
  @handshake = false
57
59
  @pending_writes = []
58
- @tls = ::RubyTls::SSL::Box.new(args[:server], self, args)
60
+ @tls_options.merge!(args)
61
+
62
+ hosts = @tls_options[:hosts]
63
+ if hosts && hosts[0]
64
+ opts = @tls_options.merge(hosts[0])
65
+ @tls = ::RubyTls::SSL::Box.new(opts[:server], self, opts)
66
+ hosts[1..-1].each do |host_opts|
67
+ @tls.add_host(**host_opts)
68
+ end
69
+ else
70
+ @tls = ::RubyTls::SSL::Box.new(@tls_options[:server], self, @tls_options)
71
+ end
59
72
  @tls.start
60
73
  self
61
74
  end
@@ -192,12 +205,30 @@ module Libuv
192
205
  end
193
206
  self
194
207
  end
208
+
209
+ def add_host(**host_opts)
210
+ @tls_options[:hosts] ||= []
211
+ @tls_options[:hosts] << host_opts
212
+ end
213
+
214
+ def remove_host(name)
215
+ if @tls_options[:hosts]
216
+ found = nil
217
+ @tls_options[:hosts].each do |host|
218
+ if host[:host_name] == name
219
+ found = host
220
+ break
221
+ end
222
+ end
223
+ @tls_options[:hosts].delete(found) if found
224
+ end
225
+ end
195
226
  #
196
227
  # END TLS Abstraction ------------------
197
228
  # --------------------------------------
198
229
  #
199
230
 
200
- def bind(ip, port, callback = nil, &blk)
231
+ def bind(ip, port, callback = nil, **tls_options, &blk)
201
232
  return self if @closed
202
233
 
203
234
  @on_accept = callback || blk
@@ -209,6 +240,8 @@ module Libuv
209
240
  begin
210
241
  @tcp_socket = create_socket(IPAddr.new(ip), port)
211
242
  @tcp_socket.bind
243
+ @tls_options.merge!(tls_options)
244
+ @tls_options[:server] = true
212
245
  rescue Exception => e
213
246
  reject(e)
214
247
  end
@@ -348,7 +381,7 @@ module Libuv
348
381
  def accept(_)
349
382
  begin
350
383
  raise RuntimeError, CLOSED_HANDLE_ERROR if @closed
351
- tcp = TCP.new(reactor, handle)
384
+ tcp = TCP.new(reactor, handle, **@tls_options)
352
385
 
353
386
  ::Fiber.new {
354
387
  begin
data/lib/libuv/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Libuv
4
- VERSION = '3.1.3'
4
+ VERSION = '3.1.4'
5
5
  end
data/spec/tcp_spec.rb CHANGED
@@ -274,7 +274,7 @@ describe Libuv::TCP do
274
274
  it "should send a ping and return a pong", :network => true do
275
275
  @reactor.run { |reactor|
276
276
  @server.bind('127.0.0.1', 56789) do |client|
277
- client.start_tls(server: true)
277
+ client.start_tls
278
278
  client.progress do |data|
279
279
  @log << data
280
280
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libuv
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.3
4
+ version: 3.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen von Takach
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-30 00:00:00.000000000 Z
11
+ date: 2017-02-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -240,6 +240,8 @@ files:
240
240
  - ext/libuv/src/unix/loop.c
241
241
  - ext/libuv/src/unix/netbsd.c
242
242
  - ext/libuv/src/unix/openbsd.c
243
+ - ext/libuv/src/unix/os390-syscalls.c
244
+ - ext/libuv/src/unix/os390-syscalls.h
243
245
  - ext/libuv/src/unix/os390.c
244
246
  - ext/libuv/src/unix/pipe.c
245
247
  - ext/libuv/src/unix/poll.c