async-io 1.15.3 → 1.15.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/async/io/ssl_endpoint.rb +16 -12
- data/lib/async/io/version.rb +1 -1
- data/spec/async/io/shared_endpoint/server_spec.rb +4 -4
- data/spec/async/io/ssl_server_spec.rb +5 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aaa9086327397becd3411c9461ebee4b97c6cc9761df7fa77f244a3097c1089c
|
4
|
+
data.tar.gz: d4f414eed9c90a1b42bb6cfffe366c54c7c27dafe72b4109d3bcb03e8b49b90b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a1b63883e34dbbbdc8bd257a8a3180012c060a1353b11aa1a4495109778e0a2c18bf93811af1ae8d56b767f7823f6b380eb306ce33185cd2c54150b03c802d5
|
7
|
+
data.tar.gz: 94c1ea7ecc884f4940c760e03d4736da7eea7340a6b68516ec426a95b086ce9fce29503a883a43f0b1ef75a571b2f5f18b2764b6e5deb27fa0d214457ca296de
|
@@ -28,6 +28,12 @@ module Async
|
|
28
28
|
super(**options)
|
29
29
|
|
30
30
|
@endpoint = endpoint
|
31
|
+
|
32
|
+
if ssl_context = options[:ssl_context]
|
33
|
+
@context = build_context(ssl_context)
|
34
|
+
else
|
35
|
+
@context = nil
|
36
|
+
end
|
31
37
|
end
|
32
38
|
|
33
39
|
def to_s
|
@@ -45,23 +51,21 @@ module Async
|
|
45
51
|
@options[:ssl_params]
|
46
52
|
end
|
47
53
|
|
48
|
-
def context
|
49
|
-
if
|
50
|
-
|
51
|
-
context = context.dup
|
52
|
-
context.set_params(params)
|
53
|
-
end
|
54
|
-
else
|
55
|
-
context = ::OpenSSL::SSL::SSLContext.new
|
56
|
-
|
57
|
-
if params = self.params
|
58
|
-
context.set_params(params)
|
59
|
-
end
|
54
|
+
def build_context(context = ::OpenSSL::SSL::SSLContext.new)
|
55
|
+
if params = self.params
|
56
|
+
context.set_params(params)
|
60
57
|
end
|
61
58
|
|
59
|
+
context.setup
|
60
|
+
context.freeze
|
61
|
+
|
62
62
|
return context
|
63
63
|
end
|
64
64
|
|
65
|
+
def context
|
66
|
+
@context ||= build_context
|
67
|
+
end
|
68
|
+
|
65
69
|
# Connect to the underlying endpoint and establish a SSL connection.
|
66
70
|
# @yield [Socket] the socket which is being connected
|
67
71
|
# @return [Socket] the connected socket
|
data/lib/async/io/version.rb
CHANGED
@@ -32,8 +32,8 @@ RSpec.shared_examples_for Async::IO::SharedEndpoint do |container_class|
|
|
32
32
|
include_context Async::RSpec::SSL::ValidCertificate
|
33
33
|
|
34
34
|
let(:endpoint) {Async::IO::Endpoint.tcp("127.0.0.1", 6781, reuse_port: true)}
|
35
|
-
let(:server_endpoint) {Async::IO::
|
36
|
-
let(:client_endpoint) {Async::IO::
|
35
|
+
let(:server_endpoint) {Async::IO::SSLEndpoint.new(endpoint, ssl_context: server_context)}
|
36
|
+
let(:client_endpoint) {Async::IO::SSLEndpoint.new(endpoint, ssl_context: client_context)}
|
37
37
|
|
38
38
|
let!(:bound_endpoint) do
|
39
39
|
Async::Reactor.run do
|
@@ -42,7 +42,7 @@ RSpec.shared_examples_for Async::IO::SharedEndpoint do |container_class|
|
|
42
42
|
end
|
43
43
|
|
44
44
|
it "can use bound endpoint in container" do
|
45
|
-
container = container_class.new(concurrency:
|
45
|
+
container = container_class.new(concurrency: 1) do
|
46
46
|
bound_endpoint.accept do |peer|
|
47
47
|
peer.write "Hello World"
|
48
48
|
peer.close
|
@@ -64,6 +64,6 @@ RSpec.describe Async::Container::Forked do
|
|
64
64
|
it_behaves_like Async::IO::SharedEndpoint, described_class
|
65
65
|
end
|
66
66
|
|
67
|
-
RSpec.describe Async::Container::Threaded do
|
67
|
+
RSpec.describe Async::Container::Threaded, if: RUBY_PLATFORM !~ /darwin/ do
|
68
68
|
it_behaves_like Async::IO::SharedEndpoint, described_class
|
69
69
|
end
|
@@ -31,8 +31,8 @@ RSpec.describe Async::IO::SSLServer do
|
|
31
31
|
include_context Async::RSpec::SSL::ValidCertificate
|
32
32
|
|
33
33
|
let(:endpoint) {Async::IO::Endpoint.tcp("127.0.0.1", 6780, reuse_port: true)}
|
34
|
-
let(:server_endpoint) {Async::IO::
|
35
|
-
let(:client_endpoint) {Async::IO::
|
34
|
+
let(:server_endpoint) {Async::IO::SSLEndpoint.new(endpoint, ssl_context: server_context)}
|
35
|
+
let(:client_endpoint) {Async::IO::SSLEndpoint.new(endpoint, ssl_context: client_context)}
|
36
36
|
|
37
37
|
let(:data) {"What one programmer can do in one month, two programmers can do in two months."}
|
38
38
|
|
@@ -67,9 +67,9 @@ RSpec.describe Async::IO::SSLServer do
|
|
67
67
|
include_context Async::RSpec::SSL::HostCertificates
|
68
68
|
|
69
69
|
let(:endpoint) {Async::IO::Endpoint.tcp("127.0.0.1", 6782, reuse_port: true)}
|
70
|
-
let(:server_endpoint) {Async::IO::
|
71
|
-
let(:valid_client_endpoint) {Async::IO::
|
72
|
-
let(:invalid_client_endpoint) {Async::IO::
|
70
|
+
let(:server_endpoint) {Async::IO::SSLEndpoint.new(endpoint, ssl_context: server_context)}
|
71
|
+
let(:valid_client_endpoint) {Async::IO::SSLEndpoint.new(endpoint, hostname: 'example.com', ssl_context: client_context)}
|
72
|
+
let(:invalid_client_endpoint) {Async::IO::SSLEndpoint.new(endpoint, hostname: 'fleeb.com', ssl_context: client_context)}
|
73
73
|
|
74
74
|
let(:data) {"What one programmer can do in one month, two programmers can do in two months."}
|
75
75
|
|