eventmachine 1.2.0.1-x86-mingw32 → 1.2.1-x86-mingw32
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/CHANGELOG.md +12 -0
- data/README.md +25 -23
- data/ext/ed.cpp +40 -65
- data/ext/ed.h +23 -8
- data/ext/em.cpp +23 -12
- data/ext/em.h +1 -1
- data/ext/rubymain.cpp +19 -15
- data/java/src/com/rubyeventmachine/EmReactor.java +18 -2
- data/lib/1.9/fastfilereaderext.so +0 -0
- data/lib/1.9/rubyeventmachine.so +0 -0
- data/lib/2.0/fastfilereaderext.so +0 -0
- data/lib/2.0/rubyeventmachine.so +0 -0
- data/lib/2.1/fastfilereaderext.so +0 -0
- data/lib/2.1/rubyeventmachine.so +0 -0
- data/lib/2.2/fastfilereaderext.so +0 -0
- data/lib/2.2/rubyeventmachine.so +0 -0
- data/lib/2.3/fastfilereaderext.so +0 -0
- data/lib/2.3/rubyeventmachine.so +0 -0
- data/lib/em/pool.rb +35 -35
- data/lib/em/protocols/linetext2.rb +18 -5
- data/lib/em/pure_ruby.rb +290 -52
- data/lib/em/version.rb +1 -1
- data/lib/eventmachine.rb +6 -0
- data/lib/jeventmachine.rb +2 -0
- data/rakelib/test_pure.rake +13 -0
- data/tests/em_test_helper.rb +3 -0
- data/tests/test_basic.rb +32 -0
- data/tests/test_ltp2.rb +24 -0
- data/tests/test_pure.rb +51 -0
- data/tests/test_ssl_dhparam.rb +2 -1
- data/tests/test_ssl_ecdh_curve.rb +2 -1
- data/tests/test_ssl_extensions.rb +1 -1
- data/tests/test_ssl_protocols.rb +3 -3
- data/tests/test_ssl_verify.rb +2 -0
- metadata +3 -2
data/lib/em/version.rb
CHANGED
data/lib/eventmachine.rb
CHANGED
@@ -1521,6 +1521,12 @@ module EventMachine
|
|
1521
1521
|
elsif opcode == ConnectionCompleted
|
1522
1522
|
c = @conns[conn_binding] or raise ConnectionNotBound, "received ConnectionCompleted for unknown signature: #{conn_binding}"
|
1523
1523
|
c.connection_completed
|
1524
|
+
elsif opcode == SslHandshakeCompleted
|
1525
|
+
c = @conns[conn_binding] or raise ConnectionNotBound, "received SslHandshakeCompleted for unknown signature: #{conn_binding}"
|
1526
|
+
c.ssl_handshake_completed
|
1527
|
+
elsif opcode == SslVerify
|
1528
|
+
c = @conns[conn_binding] or raise ConnectionNotBound, "received SslVerify for unknown signature: #{conn_binding}"
|
1529
|
+
c.close_connection if c.ssl_verify_peer(data) == false
|
1524
1530
|
elsif opcode == TimerFired
|
1525
1531
|
t = @timers.delete( data )
|
1526
1532
|
return if t == false # timer cancelled
|
data/lib/jeventmachine.rb
CHANGED
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'rake/testtask'
|
2
|
+
|
3
|
+
Rake::TestTask.new(:test_pure) do |t|
|
4
|
+
t.libs << 'tests'
|
5
|
+
t.libs << 'lib'
|
6
|
+
t.test_files = Dir.glob('tests/**/test_pure*.rb') + Dir.glob('tests/**/test_ssl*.rb')
|
7
|
+
t.warning = true
|
8
|
+
end
|
9
|
+
|
10
|
+
task :test_em_pure_ruby do
|
11
|
+
ENV['EM_PURE_RUBY'] = 'true'
|
12
|
+
Rake::Task['test_pure'].execute
|
13
|
+
end
|
data/tests/em_test_helper.rb
CHANGED
data/tests/test_basic.rb
CHANGED
@@ -171,6 +171,38 @@ class TestBasic < Test::Unit::TestCase
|
|
171
171
|
assert_equal local_ip, ip
|
172
172
|
end
|
173
173
|
|
174
|
+
def test_invalid_address_bind_connect_dst
|
175
|
+
e = nil
|
176
|
+
EM.run do
|
177
|
+
begin
|
178
|
+
EM.bind_connect('localhost', nil, 'invalid.invalid', 80)
|
179
|
+
rescue Exception => e
|
180
|
+
# capture the exception
|
181
|
+
ensure
|
182
|
+
EM.stop
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
assert_kind_of(EventMachine::ConnectionError, e)
|
187
|
+
assert_match(/unable to resolve address:.*not known/, e.message)
|
188
|
+
end
|
189
|
+
|
190
|
+
def test_invalid_address_bind_connect_src
|
191
|
+
e = nil
|
192
|
+
EM.run do
|
193
|
+
begin
|
194
|
+
EM.bind_connect('invalid.invalid', nil, 'localhost', 80)
|
195
|
+
rescue Exception => e
|
196
|
+
# capture the exception
|
197
|
+
ensure
|
198
|
+
EM.stop
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
202
|
+
assert_kind_of(EventMachine::ConnectionError, e)
|
203
|
+
assert_match(/invalid bind address:.*not known/, e.message)
|
204
|
+
end
|
205
|
+
|
174
206
|
def test_reactor_thread?
|
175
207
|
assert !EM.reactor_thread?
|
176
208
|
EM.run { assert EM.reactor_thread?; EM.stop }
|
data/tests/test_ltp2.rb
CHANGED
@@ -72,6 +72,30 @@ class TestLineText2 < Test::Unit::TestCase
|
|
72
72
|
assert_equal( ["Linea", "Lineb", "Linec", "Lined"], a.lines )
|
73
73
|
end
|
74
74
|
|
75
|
+
class RegexDelimiter
|
76
|
+
include EM::Protocols::LineText2
|
77
|
+
attr_reader :lines
|
78
|
+
def initialize *args
|
79
|
+
super
|
80
|
+
@delim = /[A-D]/
|
81
|
+
set_delimiter @delim
|
82
|
+
end
|
83
|
+
def receive_line line
|
84
|
+
(@lines ||= []) << line
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
def test_regex_delimiter
|
89
|
+
testdata = %Q(LineaALinebBLinecCLinedD)
|
90
|
+
|
91
|
+
a = RegexDelimiter.new
|
92
|
+
a.receive_data testdata
|
93
|
+
assert_equal( ["Linea", "Lineb", "Linec", "Lined"], a.lines )
|
94
|
+
|
95
|
+
a = RegexDelimiter.new
|
96
|
+
testdata.length.times {|i| a.receive_data( testdata[i...i+1] ) }
|
97
|
+
assert_equal( ["Linea", "Lineb", "Linec", "Lined"], a.lines )
|
98
|
+
end
|
75
99
|
|
76
100
|
#--
|
77
101
|
# Test two lines followed by an empty line, ten bytes of binary data, then
|
data/tests/test_pure.rb
CHANGED
@@ -85,4 +85,55 @@ class TestPure < Test::Unit::TestCase
|
|
85
85
|
assert a
|
86
86
|
end
|
87
87
|
|
88
|
+
module TLSServer
|
89
|
+
def post_init
|
90
|
+
start_tls
|
91
|
+
end
|
92
|
+
|
93
|
+
def ssl_handshake_completed
|
94
|
+
$server_handshake_completed = true
|
95
|
+
end
|
96
|
+
|
97
|
+
def receive_data(data)
|
98
|
+
$server_received_data = data
|
99
|
+
send_data(data)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
module TLSClient
|
104
|
+
def post_init
|
105
|
+
start_tls
|
106
|
+
end
|
107
|
+
|
108
|
+
def ssl_handshake_completed
|
109
|
+
$client_handshake_completed = true
|
110
|
+
end
|
111
|
+
|
112
|
+
def connection_completed
|
113
|
+
send_data('Hello World!')
|
114
|
+
end
|
115
|
+
|
116
|
+
def receive_data(data)
|
117
|
+
$client_received_data = data
|
118
|
+
close_connection
|
119
|
+
end
|
120
|
+
|
121
|
+
def unbind
|
122
|
+
EM.stop_event_loop
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
def test_start_tls
|
127
|
+
$client_handshake_completed, $server_handshake_completed = false, false
|
128
|
+
$client_received_data, $server_received_data = nil, nil
|
129
|
+
EM.run do
|
130
|
+
EM.start_server("127.0.0.1", 16789, TLSServer)
|
131
|
+
EM.connect("127.0.0.1", 16789, TLSClient)
|
132
|
+
end
|
133
|
+
|
134
|
+
assert($client_handshake_completed)
|
135
|
+
assert($server_handshake_completed)
|
136
|
+
assert($client_received_data == "Hello World!")
|
137
|
+
assert($server_received_data == "Hello World!")
|
138
|
+
end
|
88
139
|
end
|
data/tests/test_ssl_dhparam.rb
CHANGED
@@ -7,7 +7,7 @@ class TestSslDhParam < Test::Unit::TestCase
|
|
7
7
|
end
|
8
8
|
|
9
9
|
module Client
|
10
|
-
def
|
10
|
+
def post_init
|
11
11
|
start_tls
|
12
12
|
end
|
13
13
|
|
@@ -46,6 +46,7 @@ class TestSslDhParam < Test::Unit::TestCase
|
|
46
46
|
|
47
47
|
def test_no_dhparam
|
48
48
|
omit_unless(EM.ssl?)
|
49
|
+
omit_if(EM.library_type == :pure_ruby) # DH will work with defaults
|
49
50
|
omit_if(rbx?)
|
50
51
|
|
51
52
|
$client_handshake_completed, $server_handshake_completed = false, false
|
@@ -2,7 +2,7 @@ require 'em_test_helper'
|
|
2
2
|
|
3
3
|
class TestSslEcdhCurve < Test::Unit::TestCase
|
4
4
|
module Client
|
5
|
-
def
|
5
|
+
def post_init
|
6
6
|
start_tls
|
7
7
|
end
|
8
8
|
|
@@ -56,6 +56,7 @@ class TestSslEcdhCurve < Test::Unit::TestCase
|
|
56
56
|
|
57
57
|
def test_ecdh_curve
|
58
58
|
omit_unless(EM.ssl?)
|
59
|
+
omit_if(EM.library_type == :pure_ruby && RUBY_VERSION < "2.3.0")
|
59
60
|
omit_if(rbx?)
|
60
61
|
|
61
62
|
$client_handshake_completed, $server_handshake_completed = false, false
|
data/tests/test_ssl_protocols.rb
CHANGED
@@ -25,21 +25,21 @@ if EM.ssl?
|
|
25
25
|
|
26
26
|
module ClientAny
|
27
27
|
include Client
|
28
|
-
def
|
28
|
+
def post_init
|
29
29
|
start_tls(:ssl_version => %w(sslv2 sslv3 tlsv1 tlsv1_1 tlsv1_2))
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
33
|
module ClientDefault
|
34
34
|
include Client
|
35
|
-
def
|
35
|
+
def post_init
|
36
36
|
start_tls
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
40
|
module ClientSSLv3
|
41
41
|
include Client
|
42
|
-
def
|
42
|
+
def post_init
|
43
43
|
start_tls(:ssl_version => %w(SSLv3))
|
44
44
|
end
|
45
45
|
end
|
data/tests/test_ssl_verify.rb
CHANGED
@@ -98,6 +98,7 @@ class TestSslVerify < Test::Unit::TestCase
|
|
98
98
|
|
99
99
|
def test_accept_server
|
100
100
|
omit_unless(EM.ssl?)
|
101
|
+
omit_if(EM.library_type == :pure_ruby) # Server has a default cert chain
|
101
102
|
omit_if(rbx?)
|
102
103
|
$client_handshake_completed, $server_handshake_completed = false, false
|
103
104
|
EM.run {
|
@@ -112,6 +113,7 @@ class TestSslVerify < Test::Unit::TestCase
|
|
112
113
|
|
113
114
|
def test_deny_server
|
114
115
|
omit_unless(EM.ssl?)
|
116
|
+
omit_if(EM.library_type == :pure_ruby) # Server has a default cert chain
|
115
117
|
omit_if(rbx?)
|
116
118
|
$client_handshake_completed, $server_handshake_completed = false, false
|
117
119
|
EM.run {
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eventmachine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: x86-mingw32
|
6
6
|
authors:
|
7
7
|
- Francis Cianfrocca
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-11-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: test-unit
|
@@ -200,6 +200,7 @@ files:
|
|
200
200
|
- lib/rubyeventmachine.rb
|
201
201
|
- rakelib/package.rake
|
202
202
|
- rakelib/test.rake
|
203
|
+
- rakelib/test_pure.rake
|
203
204
|
- tests/client.crt
|
204
205
|
- tests/client.key
|
205
206
|
- tests/dhparam.pem
|