stomp 1.2.0 → 1.2.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.
- data/CHANGELOG.rdoc +9 -0
- data/examples/logexamp_ssl.rb +66 -0
- data/examples/slogger.rb +17 -1
- data/examples/ssl_uc1.rb +19 -0
- data/examples/ssl_uc1_ciphers.rb +30 -0
- data/examples/ssl_uc2.rb +30 -0
- data/examples/ssl_uc2_ciphers.rb +38 -0
- data/examples/ssl_uc3.rb +29 -0
- data/examples/ssl_uc3_ciphers.rb +37 -0
- data/examples/ssl_uc4.rb +29 -0
- data/examples/ssl_uc4_ciphers.rb +38 -0
- data/examples/ssl_ucx_default_ciphers.rb +25 -0
- data/lib/stomp/client.rb +2 -7
- data/lib/stomp/connection.rb +157 -87
- data/lib/stomp/constants.rb +3 -0
- data/lib/stomp/errors.rb +30 -0
- data/lib/stomp/message.rb +1 -1
- data/lib/stomp/sslparams.rb +50 -0
- data/lib/stomp/version.rb +1 -1
- data/lib/stomp.rb +2 -1
- data/stomp.gemspec +20 -7
- data/test/test_connection.rb +7 -0
- data/test/test_connection1p.rb +8 -0
- data/test/test_helper.rb +15 -0
- data/test/test_ssl.rb +51 -0
- metadata +67 -33
data/CHANGELOG.rdoc
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
== 1.2.1 2012-13-03
|
2
|
+
|
3
|
+
* Robust SSL certificate support. See examples and: https://github.com/morellon/stomp/wiki/extended-ssl-overview
|
4
|
+
* Really remove the deprecated #send methods
|
5
|
+
* Fix exception in Stomp 1.1 code when headers are frozen
|
6
|
+
* Revert 245e734a0. See ce8335fb2f for details. Fixes broken Connection#poll.
|
7
|
+
* Add reconnection attempts to callback logging.
|
8
|
+
* Add SSL specific connection information to callback logging.
|
9
|
+
|
1
10
|
== 1.2.0 2011-14-12
|
2
11
|
|
3
12
|
* Stomp 1.1 protocol support. A significant change. Please test existing 1.0 code well. See the examples directory for 1.1 examples.
|
@@ -0,0 +1,66 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'stomp'
|
3
|
+
require 'logger' # for the 'local' logger
|
4
|
+
#
|
5
|
+
$:.unshift(File.dirname(__FILE__))
|
6
|
+
#
|
7
|
+
require 'slogger'
|
8
|
+
#
|
9
|
+
# A STOMP client program which uses the callback logging facility.
|
10
|
+
#
|
11
|
+
llog = Logger::new(STDOUT)
|
12
|
+
llog.level = Logger::DEBUG
|
13
|
+
llog.debug "LESSL Starting"
|
14
|
+
|
15
|
+
# //////////////////////////////////////////////////////////////////////////////
|
16
|
+
mylog = Slogger::new # The client provided STOMP callback logger
|
17
|
+
# -*- encoding: utf-8 -*-
|
18
|
+
|
19
|
+
# //////////////////////////////////////////////////////////////////////////////
|
20
|
+
user = ENV['STOMP_USER'] ? ENV['STOMP_USER'] : 'guest'
|
21
|
+
password = ENV['STOMP_PASSWORD'] ? ENV['STOMP_PASSWORD'] : 'guest'
|
22
|
+
host = ENV['STOMP_HOST'] ? ENV['STOMP_HOST'] : 'localhost'
|
23
|
+
port = ENV['STOMP_PORT'] ? ENV['STOMP_PORT'].to_i : 61612
|
24
|
+
# //////////////////////////////////////////////////////////////////////////////
|
25
|
+
# A hash type connect *MUST* be used to enable callback logging.
|
26
|
+
# //////////////////////////////////////////////////////////////////////////////
|
27
|
+
hash = { :hosts => [
|
28
|
+
{:login => user, :passcode => password, :host => host, :port => port,
|
29
|
+
:ssl => true}, # Or provide your insance of SSLParams instead
|
30
|
+
],
|
31
|
+
:logger => mylog, # This enables callback logging!
|
32
|
+
:max_reconnect_attempts => 2,
|
33
|
+
}
|
34
|
+
|
35
|
+
# //////////////////////////////////////////////////////////////////////////////
|
36
|
+
# For a Connection:
|
37
|
+
llog.debug "LESSL Connection processing starts"
|
38
|
+
conn = Stomp::Connection.new(hash)
|
39
|
+
conn.disconnect
|
40
|
+
# //////////////////////////////////////////////////////////////////////////////
|
41
|
+
llog.debug "LESSL Connection processing complete"
|
42
|
+
|
43
|
+
# //////////////////////////////////////////////////////////////////////////////
|
44
|
+
# For a Client:
|
45
|
+
llog.debug "LESSL Client processing starts"
|
46
|
+
conn = Stomp::Client.new(hash)
|
47
|
+
conn.close
|
48
|
+
# //////////////////////////////////////////////////////////////////////////////
|
49
|
+
llog.debug "LESSL Client processing complete"
|
50
|
+
|
51
|
+
# //////////////////////////////////////////////////////////////////////////////
|
52
|
+
# For a Connection with other calls:
|
53
|
+
llog.debug "LESSL Connection Enhanced processing starts"
|
54
|
+
conn = Stomp::Connection.new(hash)
|
55
|
+
#
|
56
|
+
dest = "/queue/loggerq1"
|
57
|
+
conn.publish dest, "a logger message"
|
58
|
+
conn.subscribe dest
|
59
|
+
msg = conn.receive
|
60
|
+
conn.disconnect
|
61
|
+
# //////////////////////////////////////////////////////////////////////////////
|
62
|
+
llog.debug "LESSL Connection Enhanced processing complete"
|
63
|
+
|
64
|
+
# //////////////////////////////////////////////////////////////////////////////
|
65
|
+
llog.debug "LESSL Ending"
|
66
|
+
|
data/examples/slogger.rb
CHANGED
@@ -158,6 +158,22 @@ class Slogger
|
|
158
158
|
end
|
159
159
|
end
|
160
160
|
|
161
|
+
def on_ssl_connecting(parms)
|
162
|
+
begin
|
163
|
+
@log.debug "SSL Connecting Parms #{info(parms)}"
|
164
|
+
rescue
|
165
|
+
@log.debug "SSL Connecting oops"
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
def on_ssl_connected(parms)
|
170
|
+
begin
|
171
|
+
@log.debug "SSL Connected Parms #{info(parms)}"
|
172
|
+
rescue
|
173
|
+
@log.debug "SSL Connected oops"
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
161
177
|
private
|
162
178
|
|
163
179
|
def info(parms)
|
@@ -172,7 +188,7 @@ class Slogger
|
|
172
188
|
# parms[:cur_parseto]
|
173
189
|
# parms[:cur_conattempts]
|
174
190
|
#
|
175
|
-
"Host: #{parms[:cur_host]}, Port: #{parms[:cur_port]}, Login: Port: #{parms[:cur_login]}, Passcode: #{parms[:cur_passcode]}"
|
191
|
+
"Host: #{parms[:cur_host]}, Port: #{parms[:cur_port]}, Login: Port: #{parms[:cur_login]}, Passcode: #{parms[:cur_passcode]}, ssl: #{parms[:cur_ssl]}"
|
176
192
|
end
|
177
193
|
end # of class
|
178
194
|
|
data/examples/ssl_uc1.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
#
|
2
|
+
# Reference: https://github.com/morellon/stomp/wiki/extended-ssl-overview
|
3
|
+
#
|
4
|
+
require "rubygems"
|
5
|
+
require "stomp"
|
6
|
+
#
|
7
|
+
# SSL Use Case 1
|
8
|
+
#
|
9
|
+
hash = { :hosts => [
|
10
|
+
{:login => 'guest', :passcode => 'guest', :host => 'localhost', :port => 61612, :ssl => true},
|
11
|
+
]
|
12
|
+
}
|
13
|
+
#
|
14
|
+
puts "Connect starts, SSL Use Case 1"
|
15
|
+
c = Stomp::Connection.new(hash)
|
16
|
+
puts "Connect completed"
|
17
|
+
#
|
18
|
+
c.disconnect
|
19
|
+
|
@@ -0,0 +1,30 @@
|
|
1
|
+
#
|
2
|
+
# Reference: https://github.com/morellon/stomp/wiki/extended-ssl-overview
|
3
|
+
#
|
4
|
+
require "rubygems"
|
5
|
+
require "stomp"
|
6
|
+
#
|
7
|
+
# If you need your own ciphers list, this is how.
|
8
|
+
# Stomp's default list will work in many cases. If you need to use this, you
|
9
|
+
# will know it because SSL connect's will fail. In that case, determining
|
10
|
+
# _what_ should be in the list is your responsibility.
|
11
|
+
#
|
12
|
+
ciphers_list = [["DHE-RSA-AES256-SHA", "TLSv1/SSLv3", 256, 256], ["DHE-DSS-AES256-SHA", "TLSv1/SSLv3", 256, 256], ["AES256-SHA", "TLSv1/SSLv3", 256, 256], ["EDH-RSA-DES-CBC3-SHA", "TLSv1/SSLv3", 168, 168], ["EDH-DSS-DES-CBC3-SHA", "TLSv1/SSLv3", 168, 168], ["DES-CBC3-SHA", "TLSv1/SSLv3", 168, 168], ["DHE-RSA-AES128-SHA", "TLSv1/SSLv3", 128, 128], ["DHE-DSS-AES128-SHA", "TLSv1/SSLv3", 128, 128], ["AES128-SHA", "TLSv1/SSLv3", 128, 128], ["RC4-SHA", "TLSv1/SSLv3", 128, 128], ["RC4-MD5", "TLSv1/SSLv3", 128, 128], ["EDH-RSA-DES-CBC-SHA", "TLSv1/SSLv3", 56, 56], ["EDH-DSS-DES-CBC-SHA", "TLSv1/SSLv3", 56, 56],
|
13
|
+
["DES-CBC-SHA", "TLSv1/SSLv3", 56, 56], ["EXP-EDH-RSA-DES-CBC-SHA", "TLSv1/SSLv3", 40, 56], ["EXP-EDH-DSS-DES-CBC-SHA", "TLSv1/SSLv3", 40, 56], ["EXP-DES-CBC-SHA", "TLSv1/SSLv3", 40, 56], ["EXP-RC2-CBC-MD5", "TLSv1/SSLv3", 40, 128], ["EXP-RC4-MD5", "TLSv1/SSLv3", 40, 128]]
|
14
|
+
|
15
|
+
ssl_opts = Stomp::SSLParams.new(:ciphers => ciphers_list)
|
16
|
+
|
17
|
+
#
|
18
|
+
# SSL Use Case 1
|
19
|
+
#
|
20
|
+
hash = { :hosts => [
|
21
|
+
{:login => 'guest', :passcode => 'guest', :host => 'localhost', :port => 61612, :ssl => ssl_opts},
|
22
|
+
]
|
23
|
+
}
|
24
|
+
#
|
25
|
+
puts "Connect starts, SSL Use Case 1"
|
26
|
+
c = Stomp::Connection.new(hash)
|
27
|
+
puts "Connect completed"
|
28
|
+
#
|
29
|
+
c.disconnect
|
30
|
+
|
data/examples/ssl_uc2.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
#
|
2
|
+
# Reference: https://github.com/morellon/stomp/wiki/extended-ssl-overview
|
3
|
+
#
|
4
|
+
require "rubygems"
|
5
|
+
require "stomp"
|
6
|
+
#
|
7
|
+
# SSL Use Case 2
|
8
|
+
#
|
9
|
+
ssl_opts = Stomp::SSLParams.new(:key_file => "/home/gmallard/sslwork/twocas_tj/clientCA/ClientTJ.key",
|
10
|
+
:cert_file => "/home/gmallard/sslwork/twocas_tj/clientCA/ClientTJ.crt")
|
11
|
+
|
12
|
+
#
|
13
|
+
hash = { :hosts => [
|
14
|
+
{:login => 'guest', :passcode => 'guest', :host => 'localhost', :port => 61612, :ssl => ssl_opts},
|
15
|
+
]
|
16
|
+
}
|
17
|
+
#
|
18
|
+
puts "Connect starts, SSL Use Case 2"
|
19
|
+
c = Stomp::Connection.new(hash)
|
20
|
+
puts "Connect completed"
|
21
|
+
#
|
22
|
+
# Expect a verify_result == 20
|
23
|
+
#
|
24
|
+
# This means: the client did not verify the peer's certificate, but the
|
25
|
+
# handshake succeeds, and the connection is allowed.
|
26
|
+
#
|
27
|
+
puts "SSL Verify Result: #{ssl_opts.verify_result}"
|
28
|
+
puts "SSL Peer Certificate:\n#{ssl_opts.peer_cert}"
|
29
|
+
c.disconnect
|
30
|
+
|
@@ -0,0 +1,38 @@
|
|
1
|
+
#
|
2
|
+
# Reference: https://github.com/morellon/stomp/wiki/extended-ssl-overview
|
3
|
+
#
|
4
|
+
require "rubygems"
|
5
|
+
require "stomp"
|
6
|
+
#
|
7
|
+
# If you need your own ciphers list, this is how.
|
8
|
+
# Stomp's default list will work in many cases. If you need to use this, you
|
9
|
+
# will know it because SSL connect's will fail. In that case, determining
|
10
|
+
# _what_ should be in the list is your responsibility.
|
11
|
+
#
|
12
|
+
ciphers_list = [["DHE-RSA-AES256-SHA", "TLSv1/SSLv3", 256, 256], ["DHE-DSS-AES256-SHA", "TLSv1/SSLv3", 256, 256], ["AES256-SHA", "TLSv1/SSLv3", 256, 256], ["EDH-RSA-DES-CBC3-SHA", "TLSv1/SSLv3", 168, 168], ["EDH-DSS-DES-CBC3-SHA", "TLSv1/SSLv3", 168, 168], ["DES-CBC3-SHA", "TLSv1/SSLv3", 168, 168], ["DHE-RSA-AES128-SHA", "TLSv1/SSLv3", 128, 128], ["DHE-DSS-AES128-SHA", "TLSv1/SSLv3", 128, 128], ["AES128-SHA", "TLSv1/SSLv3", 128, 128], ["RC4-SHA", "TLSv1/SSLv3", 128, 128], ["RC4-MD5", "TLSv1/SSLv3", 128, 128], ["EDH-RSA-DES-CBC-SHA", "TLSv1/SSLv3", 56, 56], ["EDH-DSS-DES-CBC-SHA", "TLSv1/SSLv3", 56, 56],
|
13
|
+
["DES-CBC-SHA", "TLSv1/SSLv3", 56, 56], ["EXP-EDH-RSA-DES-CBC-SHA", "TLSv1/SSLv3", 40, 56], ["EXP-EDH-DSS-DES-CBC-SHA", "TLSv1/SSLv3", 40, 56], ["EXP-DES-CBC-SHA", "TLSv1/SSLv3", 40, 56], ["EXP-RC2-CBC-MD5", "TLSv1/SSLv3", 40, 128], ["EXP-RC4-MD5", "TLSv1/SSLv3", 40, 128]]
|
14
|
+
#
|
15
|
+
# SSL Use Case 2
|
16
|
+
#
|
17
|
+
ssl_opts = Stomp::SSLParams.new(:key_file => "/home/gmallard/sslwork/twocas_tj/clientCA/ClientTJ.key",
|
18
|
+
:cert_file => "/home/gmallard/sslwork/twocas_tj/clientCA/ClientTJ.crt", :ciphers => ciphers_list)
|
19
|
+
|
20
|
+
#
|
21
|
+
hash = { :hosts => [
|
22
|
+
{:login => 'guest', :passcode => 'guest', :host => 'localhost', :port => 61612, :ssl => ssl_opts},
|
23
|
+
]
|
24
|
+
}
|
25
|
+
#
|
26
|
+
puts "Connect starts, SSL Use Case 2"
|
27
|
+
c = Stomp::Connection.new(hash)
|
28
|
+
puts "Connect completed"
|
29
|
+
#
|
30
|
+
# Expect a verify_result == 20
|
31
|
+
#
|
32
|
+
# This means: the client did not verify the peer's certificate, but the
|
33
|
+
# handshake succeeds, and the connection is allowed.
|
34
|
+
#
|
35
|
+
puts "SSL Verify Result: #{ssl_opts.verify_result}"
|
36
|
+
puts "SSL Peer Certificate:\n#{ssl_opts.peer_cert}"
|
37
|
+
c.disconnect
|
38
|
+
|
data/examples/ssl_uc3.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#
|
2
|
+
# Reference: https://github.com/morellon/stomp/wiki/extended-ssl-overview
|
3
|
+
#
|
4
|
+
require "rubygems"
|
5
|
+
require "stomp"
|
6
|
+
#
|
7
|
+
# SSL Use Case 3
|
8
|
+
#
|
9
|
+
ts_flist = []
|
10
|
+
ts_flist << "/home/gmallard/sslwork/twocas_tj/serverCA/ServerTJCA.crt"
|
11
|
+
ssl_opts = Stomp::SSLParams.new(:ts_files => ts_flist.join(","))
|
12
|
+
#
|
13
|
+
hash = { :hosts => [
|
14
|
+
{:login => 'guest', :passcode => 'guest', :host => 'localhost', :port => 61612, :ssl => ssl_opts},
|
15
|
+
]
|
16
|
+
}
|
17
|
+
#
|
18
|
+
puts "Connect starts, SSL Use Case 3"
|
19
|
+
c = Stomp::Connection.new(hash)
|
20
|
+
puts "Connect completed"
|
21
|
+
#
|
22
|
+
# Expect a verify_result == 0
|
23
|
+
#
|
24
|
+
# This means: the client successfully verified the peer's certificate.
|
25
|
+
#
|
26
|
+
puts "SSL Verify Result: #{ssl_opts.verify_result}"
|
27
|
+
puts "SSL Peer Certificate:\n#{ssl_opts.peer_cert}"
|
28
|
+
c.disconnect
|
29
|
+
|
@@ -0,0 +1,37 @@
|
|
1
|
+
#
|
2
|
+
# Reference: https://github.com/morellon/stomp/wiki/extended-ssl-overview
|
3
|
+
#
|
4
|
+
require "rubygems"
|
5
|
+
require "stomp"
|
6
|
+
#
|
7
|
+
# If you need your own ciphers list, this is how.
|
8
|
+
# Stomp's default list will work in many cases. If you need to use this, you
|
9
|
+
# will know it because SSL connect's will fail. In that case, determining
|
10
|
+
# _what_ should be in the list is your responsibility.
|
11
|
+
#
|
12
|
+
ciphers_list = [["DHE-RSA-AES256-SHA", "TLSv1/SSLv3", 256, 256], ["DHE-DSS-AES256-SHA", "TLSv1/SSLv3", 256, 256], ["AES256-SHA", "TLSv1/SSLv3", 256, 256], ["EDH-RSA-DES-CBC3-SHA", "TLSv1/SSLv3", 168, 168], ["EDH-DSS-DES-CBC3-SHA", "TLSv1/SSLv3", 168, 168], ["DES-CBC3-SHA", "TLSv1/SSLv3", 168, 168], ["DHE-RSA-AES128-SHA", "TLSv1/SSLv3", 128, 128], ["DHE-DSS-AES128-SHA", "TLSv1/SSLv3", 128, 128], ["AES128-SHA", "TLSv1/SSLv3", 128, 128], ["RC4-SHA", "TLSv1/SSLv3", 128, 128], ["RC4-MD5", "TLSv1/SSLv3", 128, 128], ["EDH-RSA-DES-CBC-SHA", "TLSv1/SSLv3", 56, 56], ["EDH-DSS-DES-CBC-SHA", "TLSv1/SSLv3", 56, 56],
|
13
|
+
["DES-CBC-SHA", "TLSv1/SSLv3", 56, 56], ["EXP-EDH-RSA-DES-CBC-SHA", "TLSv1/SSLv3", 40, 56], ["EXP-EDH-DSS-DES-CBC-SHA", "TLSv1/SSLv3", 40, 56], ["EXP-DES-CBC-SHA", "TLSv1/SSLv3", 40, 56], ["EXP-RC2-CBC-MD5", "TLSv1/SSLv3", 40, 128], ["EXP-RC4-MD5", "TLSv1/SSLv3", 40, 128]]
|
14
|
+
#
|
15
|
+
# SSL Use Case 3
|
16
|
+
#
|
17
|
+
ts_flist = []
|
18
|
+
ts_flist << "/home/gmallard/sslwork/twocas_tj/serverCA/ServerTJCA.crt"
|
19
|
+
ssl_opts = Stomp::SSLParams.new(:ts_files => ts_flist.join(","), :ciphers => ciphers_list)
|
20
|
+
#
|
21
|
+
hash = { :hosts => [
|
22
|
+
{:login => 'guest', :passcode => 'guest', :host => 'localhost', :port => 61612, :ssl => ssl_opts},
|
23
|
+
]
|
24
|
+
}
|
25
|
+
#
|
26
|
+
puts "Connect starts, SSL Use Case 3"
|
27
|
+
c = Stomp::Connection.new(hash)
|
28
|
+
puts "Connect completed"
|
29
|
+
#
|
30
|
+
# Expect a verify_result == 0
|
31
|
+
#
|
32
|
+
# This means: the client successfully verified the peer's certificate.
|
33
|
+
#
|
34
|
+
puts "SSL Verify Result: #{ssl_opts.verify_result}"
|
35
|
+
puts "SSL Peer Certificate:\n#{ssl_opts.peer_cert}"
|
36
|
+
c.disconnect
|
37
|
+
|
data/examples/ssl_uc4.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#
|
2
|
+
# Reference: https://github.com/morellon/stomp/wiki/extended-ssl-overview
|
3
|
+
#
|
4
|
+
require "rubygems"
|
5
|
+
require "stomp"
|
6
|
+
#
|
7
|
+
# SSL Use Case 4
|
8
|
+
#
|
9
|
+
ssl_opts = Stomp::SSLParams.new(:key_file => "/home/gmallard/sslwork/twocas_tj/clientCA/ClientTJ.key",
|
10
|
+
:cert_file => "/home/gmallard/sslwork/twocas_tj/clientCA/ClientTJ.crt",
|
11
|
+
:ts_files => "/home/gmallard/sslwork/twocas_tj/serverCA/ServerTJCA.crt")
|
12
|
+
#
|
13
|
+
hash = { :hosts => [
|
14
|
+
{:login => 'guest', :passcode => 'guest', :host => 'localhost', :port => 61612, :ssl => ssl_opts},
|
15
|
+
]
|
16
|
+
}
|
17
|
+
#
|
18
|
+
puts "Connect starts, SSL Use Case 4"
|
19
|
+
c = Stomp::Connection.new(hash)
|
20
|
+
puts "Connect completed"
|
21
|
+
#
|
22
|
+
# Expect a verify_result == 0
|
23
|
+
#
|
24
|
+
# This means: the client successfully verified the peer's certificate.
|
25
|
+
#
|
26
|
+
puts "SSL Verify Result: #{ssl_opts.verify_result}"
|
27
|
+
puts "SSL Peer Certificate:\n#{ssl_opts.peer_cert}"
|
28
|
+
c.disconnect
|
29
|
+
|
@@ -0,0 +1,38 @@
|
|
1
|
+
#
|
2
|
+
# Reference: https://github.com/morellon/stomp/wiki/extended-ssl-overview
|
3
|
+
#
|
4
|
+
require "rubygems"
|
5
|
+
require "stomp"
|
6
|
+
#
|
7
|
+
# If you need your own ciphers list, this is how.
|
8
|
+
# Stomp's default list will work in many cases. If you need to use this, you
|
9
|
+
# will know it because SSL connect's will fail. In that case, determining
|
10
|
+
# _what_ should be in the list is your responsibility.
|
11
|
+
#
|
12
|
+
ciphers_list = [["DHE-RSA-AES256-SHA", "TLSv1/SSLv3", 256, 256], ["DHE-DSS-AES256-SHA", "TLSv1/SSLv3", 256, 256], ["AES256-SHA", "TLSv1/SSLv3", 256, 256], ["EDH-RSA-DES-CBC3-SHA", "TLSv1/SSLv3", 168, 168], ["EDH-DSS-DES-CBC3-SHA", "TLSv1/SSLv3", 168, 168], ["DES-CBC3-SHA", "TLSv1/SSLv3", 168, 168], ["DHE-RSA-AES128-SHA", "TLSv1/SSLv3", 128, 128], ["DHE-DSS-AES128-SHA", "TLSv1/SSLv3", 128, 128], ["AES128-SHA", "TLSv1/SSLv3", 128, 128], ["RC4-SHA", "TLSv1/SSLv3", 128, 128], ["RC4-MD5", "TLSv1/SSLv3", 128, 128], ["EDH-RSA-DES-CBC-SHA", "TLSv1/SSLv3", 56, 56], ["EDH-DSS-DES-CBC-SHA", "TLSv1/SSLv3", 56, 56],
|
13
|
+
["DES-CBC-SHA", "TLSv1/SSLv3", 56, 56], ["EXP-EDH-RSA-DES-CBC-SHA", "TLSv1/SSLv3", 40, 56], ["EXP-EDH-DSS-DES-CBC-SHA", "TLSv1/SSLv3", 40, 56], ["EXP-DES-CBC-SHA", "TLSv1/SSLv3", 40, 56], ["EXP-RC2-CBC-MD5", "TLSv1/SSLv3", 40, 128], ["EXP-RC4-MD5", "TLSv1/SSLv3", 40, 128]]
|
14
|
+
#
|
15
|
+
# SSL Use Case 4
|
16
|
+
#
|
17
|
+
ssl_opts = Stomp::SSLParams.new(:key_file => "/home/gmallard/sslwork/twocas_tj/clientCA/ClientTJ.key",
|
18
|
+
:cert_file => "/home/gmallard/sslwork/twocas_tj/clientCA/ClientTJ.crt",
|
19
|
+
:ts_files => "/home/gmallard/sslwork/twocas_tj/serverCA/ServerTJCA.crt",
|
20
|
+
:ciphers => ciphers_list)
|
21
|
+
#
|
22
|
+
hash = { :hosts => [
|
23
|
+
{:login => 'guest', :passcode => 'guest', :host => 'localhost', :port => 61612, :ssl => ssl_opts},
|
24
|
+
]
|
25
|
+
}
|
26
|
+
#
|
27
|
+
puts "Connect starts, SSL Use Case 4"
|
28
|
+
c = Stomp::Connection.new(hash)
|
29
|
+
puts "Connect completed"
|
30
|
+
#
|
31
|
+
# Expect a verify_result == 0
|
32
|
+
#
|
33
|
+
# This means: the client successfully verified the peer's certificate.
|
34
|
+
#
|
35
|
+
puts "SSL Verify Result: #{ssl_opts.verify_result}"
|
36
|
+
puts "SSL Peer Certificate:\n#{ssl_opts.peer_cert}"
|
37
|
+
c.disconnect
|
38
|
+
|
@@ -0,0 +1,25 @@
|
|
1
|
+
#
|
2
|
+
# Reference: https://github.com/morellon/stomp/wiki/extended-ssl-overview
|
3
|
+
#
|
4
|
+
require "rubygems"
|
5
|
+
require "stomp"
|
6
|
+
|
7
|
+
#
|
8
|
+
# If you use SSLParams, and need the _default_ Ruby ciphers, this is how.
|
9
|
+
#
|
10
|
+
ssl_opts = Stomp::SSLParams.new(:use_ruby_ciphers => true)
|
11
|
+
#
|
12
|
+
# SSL Use Case: Using default Stomp ciphers
|
13
|
+
#
|
14
|
+
hash = { :hosts => [
|
15
|
+
{:login => 'guest', :passcode => 'guest', :host => 'localhost',
|
16
|
+
:port => 61612, :ssl => ssl_opts},
|
17
|
+
]
|
18
|
+
}
|
19
|
+
#
|
20
|
+
puts "Connect starts, SSL Use Case X"
|
21
|
+
c = Stomp::Connection.new(hash)
|
22
|
+
puts "Connect completed"
|
23
|
+
#
|
24
|
+
c.disconnect
|
25
|
+
|
data/lib/stomp/client.rb
CHANGED
@@ -211,11 +211,6 @@ module Stomp
|
|
211
211
|
__send__(*args)
|
212
212
|
end
|
213
213
|
|
214
|
-
def send(*args)
|
215
|
-
warn("This method is deprecated and will be removed on the next release. Use 'publish' instead")
|
216
|
-
publish(*args)
|
217
|
-
end
|
218
|
-
|
219
214
|
def connection_frame
|
220
215
|
@connection.connection_frame
|
221
216
|
end
|
@@ -354,11 +349,11 @@ module Stomp
|
|
354
349
|
@listener_thread = Thread.start do
|
355
350
|
while true
|
356
351
|
message = @connection.receive
|
357
|
-
if message.command ==
|
352
|
+
if message.command == Stomp::CMD_MESSAGE
|
358
353
|
if listener = find_listener(message)
|
359
354
|
listener.call(message)
|
360
355
|
end
|
361
|
-
elsif message.command ==
|
356
|
+
elsif message.command == Stomp::CMD_RECEIPT
|
362
357
|
if listener = @receipt_listeners[message.headers['receipt-id']]
|
363
358
|
listener.call(message)
|
364
359
|
end
|