websocket-client-simple 0.5.0 → 0.6.0

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
  SHA256:
3
- metadata.gz: 9419913b098ff41396cbc11f0d3c2495f9cccb03471c79800f929079b1355537
4
- data.tar.gz: 24de10f74455a26bdd20921975f031df322f5c744c5d12b95a071e0f7be48cb8
3
+ metadata.gz: 2de6863ed3ec4f702c28cb4143bb949facf6fd18efda61eb236410131cb4dfa7
4
+ data.tar.gz: a5ebee3d4e74eb177ad70ea111497b2c4aa515ed6ddff523ff0840f7bd0355ac
5
5
  SHA512:
6
- metadata.gz: 31b267d997fdfd90d93a6477984614d5a6235bea3400a2c4b22008e1303ae2e801be15c647f50a9b1149bd87564ec4311e378e58d80d6cc1933b558f19d95469
7
- data.tar.gz: 6ea95642df78c178290c1451645aa61ad916b59d8b00767dfefe8e552245eae1b96903e458107506760b0cf3f17c1d1e935f16615c6039b40572767fdb8b7fa7
6
+ metadata.gz: 25239fc6f496ff3838112f1b6360a52d6be6d651fc3354ae7e61cdae3712cfe491d870c5af6874583e42fead682420f9757dee1483391f9df31b5c25b4a921c2
7
+ data.tar.gz: 3fc6b6f1abbb20157f58a80d9fb47bb65ace236620ca786bb7eaae3fd51b134be15bd4e2b34ecbc5a7f2fa94cfd9c392b583f29bc335c359eb749bcccf607d72
data/History.txt CHANGED
@@ -1,5 +1,15 @@
1
1
  === Not yet released
2
2
 
3
+ == 0.6.0 2022-09-22
4
+
5
+ * Add option `cert_store` for passing cert store to SSLSocket context #12 by @DerekStride
6
+ * Set `OpenSSL::SSL::SSLSocket#sync_close` to `true` #12 by @DerekStride
7
+
8
+ === 0.5.1 2022-01-01
9
+
10
+ * Add `closed?` method to `WebSocket::Client::Simple` #8 by @fuyuton
11
+ * rescue when `OpenSSL::SSL::SSLError` raised #10 by @fuyuton
12
+
3
13
  === 0.5.0 2021-12-31
4
14
 
5
15
  * Change TLS context defaults to system's default. The previous defaults were ssl_version=SSLv23 and verify_mode=VERIFY_NONE, which are insecure nowadays. #5
data/README.md CHANGED
@@ -16,7 +16,6 @@ Installation
16
16
  Usage
17
17
  -----
18
18
  ```ruby
19
- require 'rubygems'
20
19
  require 'websocket-client-simple'
21
20
 
22
21
  ws = WebSocket::Client::Simple.connect 'ws://example.com:8888'
@@ -60,7 +59,7 @@ end
60
59
 
61
60
  Sample
62
61
  ------
63
- [websocket chat](https://github.com/shokai/websocket-client-simple/tree/master/sample)
62
+ [websocket chat](https://github.com/ruby-jp/websocket-client-simple/tree/master/sample)
64
63
 
65
64
 
66
65
  Test
@@ -23,10 +23,11 @@ module WebSocket
23
23
  ctx = OpenSSL::SSL::SSLContext.new
24
24
  ctx.ssl_version = options[:ssl_version] if options[:ssl_version]
25
25
  ctx.verify_mode = options[:verify_mode] if options[:verify_mode]
26
- cert_store = OpenSSL::X509::Store.new
26
+ cert_store = options[:cert_store] || OpenSSL::X509::Store.new
27
27
  cert_store.set_default_paths
28
28
  ctx.cert_store = cert_store
29
29
  @socket = ::OpenSSL::SSL::SSLSocket.new(@socket, ctx)
30
+ @socket.sync_close = true
30
31
  @socket.hostname = uri.host
31
32
  @socket.connect
32
33
  end
@@ -77,6 +78,9 @@ module WebSocket
77
78
  rescue Errno::EPIPE => e
78
79
  @pipe_broken = true
79
80
  emit :__close, e
81
+ rescue OpenSSL::SSL::SSLError => e
82
+ @pipe_broken = true
83
+ emit :__close, e
80
84
  end
81
85
  end
82
86
 
@@ -96,6 +100,10 @@ module WebSocket
96
100
  @handshake.finished? and !@closed
97
101
  end
98
102
 
103
+ def closed?
104
+ @closed
105
+ end
106
+
99
107
  end
100
108
 
101
109
  end
@@ -1,7 +1,7 @@
1
1
  module WebSocket
2
2
  module Client
3
3
  module Simple
4
- VERSION = "0.5.0"
4
+ VERSION = "0.6.0"
5
5
  end
6
6
  end
7
7
  end
data/sample/client.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
  $:.unshift File.expand_path '../lib', File.dirname(__FILE__)
3
- require 'rubygems'
4
3
  require 'websocket-client-simple'
5
4
 
6
5
  puts "websocket-client-simple v#{WebSocket::Client::Simple::VERSION}"
@@ -16,7 +16,7 @@
16
16
  <ul id="chat"></ul>
17
17
  <div id="footer">
18
18
  <hr>
19
- <a href="https://github.com/shokai/websocket-client-simple">https://github.com/shokai/websocket-client-simple</a>
19
+ <a href="https://github.com/ruby-jp/websocket-client-simple">https://github.com/ruby-jp/websocket-client-simple</a>
20
20
  </div>
21
21
  </body>
22
22
  </html>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: websocket-client-simple
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sho Hashimoto
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-12-31 00:00:00.000000000 Z
12
+ date: 2022-09-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler