stomp 1.2.2 → 1.2.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,16 @@
1
- == 1.2.2 2012-24-03
1
+ == 1.2.3 20120616
2
+
3
+ * Fix UnsupportedProtocol on connect to a 1.0 broker
4
+ * Add Client#poll method
5
+ * Add help to stompcat and catstomp
6
+ * Allow password to be set for private SSL key
7
+ * Update comments to reflect new repository URL
8
+ * Reformat changelog dates to ISO8601
9
+ * Fix SSL connection failures using JRuby
10
+ * Use symbols, not strings for all header keys
11
+ * Add IPV6 to IPV4 failover for dual homed systems when requested
12
+
13
+ == 1.2.2 20120324
2
14
 
3
15
  * Major performance improvement for read of messages without content-length header
4
16
  * Correct Stomp 1.1 failing test
@@ -8,16 +20,16 @@
8
20
  * Allow SSL file checks before connect using SSLParams.new(:fsck => true, ...)
9
21
  * Correct a test for Windows compatibility
10
22
 
11
- == 1.2.1 2012-13-03
23
+ == 1.2.1 20120313
12
24
 
13
- * Robust SSL certificate support. See examples and: https://github.com/morellon/stomp/wiki/extended-ssl-overview
25
+ * Robust SSL certificate support. See examples and: https://github.com/stompgem/stomp/wiki/extended-ssl-overview
14
26
  * Really remove the deprecated #send methods
15
27
  * Fix exception in Stomp 1.1 code when headers are frozen
16
28
  * Revert 245e734a0. See ce8335fb2f for details. Fixes broken Connection#poll.
17
29
  * Add reconnection attempts to callback logging.
18
30
  * Add SSL specific connection information to callback logging.
19
31
 
20
- == 1.2.0 2011-14-12
32
+ == 1.2.0 20111214
21
33
 
22
34
  * Stomp 1.1 protocol support. A significant change. Please test existing 1.0 code well. See the examples directory for 1.1 examples.
23
35
  * Accept :reliable in a Stomp::Client connection hash
@@ -27,14 +39,14 @@
27
39
  * Fix subscription id in find_listener
28
40
  * Start to bootstrap STOMP 1.1 support
29
41
 
30
- == 1.1.10 2011-07-11
42
+ == 1.1.10 20111107
31
43
 
32
44
  * Fixes for JRuby support
33
45
  * Fix EOF error on disconnect
34
46
  * Refactoring and additional test
35
47
  * Set up tests for use of RabbitMQ
36
48
 
37
- == 1.1.9 2011-15-06
49
+ == 1.1.9 20110615
38
50
 
39
51
  * Support wildcard destinations
40
52
  * Handle subscribe with string or symbol ID
@@ -45,7 +57,7 @@
45
57
  * Add optional callback logging. See the examples install directory, files logexamp.rb and slogger.rb
46
58
  * Correct date stamps in this file
47
59
 
48
- == 1.1.8 2011-16-03
60
+ == 1.1.8 20110316
49
61
 
50
62
  * Set KEEPALIVE on connection socket options
51
63
  * Attempt to support JRuby more robustly (poll remains broken)
@@ -56,23 +68,23 @@
56
68
  * Allow connection to hosts with a - (dash) in the host name
57
69
  * Add limit parameter to thread joins
58
70
 
59
- == 1.1.7 2011-09-01
71
+ == 1.1.7 20110109
60
72
 
61
73
  * Binary parse of raw STOMP frame
62
74
  * Fix broken tests on Ruby 1.9.2
63
75
 
64
- == 1.1.6 2010-10-06
76
+ == 1.1.6 20100610
65
77
 
66
78
  * Fixed multi-thread app hanging
67
79
 
68
- == 1.1.5 2010-17-03
80
+ == 1.1.5 20100317
69
81
 
70
82
  * Added publish method (send is now deprecated)
71
83
  * Changes on Rake File
72
84
  * Added original_destination header to unreceive
73
85
  * suppress content length header is send on the message for future handling (like unreceive)
74
86
 
75
- == 1.1.4 2010-21-01
87
+ == 1.1.4 20100121
76
88
 
77
89
  * Added unreceive message method that sends the message back to its queue or to the
78
90
  dead letter queue, depending on the :max_redeliveries option, similar to a13m one.
@@ -87,13 +99,13 @@
87
99
  * Added connection_frame accessor
88
100
  * Added disconnect receipt
89
101
 
90
- == 1.1.3 2009-24-11
102
+ == 1.1.3 20091124
91
103
 
92
104
  * Failover support
93
105
  * SSL support
94
106
  * Stomp::Connection and Stomp::Client accept a hash on their constructor
95
107
 
96
- == 1.1 2009-27-02
108
+ == 1.1 20090227
97
109
 
98
110
  * Ruby 1.9 Support
99
111
  * Add support for connect_headers, to control the CONNECT command.
@@ -101,7 +113,7 @@
101
113
  * Better test coverage
102
114
  * General code cleanup.
103
115
 
104
- == 1.0.6 2008-05-08
116
+ == 1.0.6 20080805
105
117
 
106
118
  * Whitespace cleanup
107
119
  * Refactored Rakefile and added stomp.gemspec for GitHub friendliness.
@@ -113,8 +125,33 @@
113
125
  * Created initial RSpec specs which stub/mock objects and should not require a running
114
126
  Stomp server instance.
115
127
 
116
- == v1.0.5
128
+ == v1.0.5 20070201
129
+
130
+ * better url parsing
131
+ * git-svn-id: http://svn.codehaus.org/stomp/ruby/trunk@48 fd4e7336-3dff-0310-b68a-b6615a75f13b
132
+
133
+ == v1.0.4 20070115
134
+
135
+ * Allow URL style connections descriptors
136
+ * git-svn-id: http://svn.codehaus.org/stomp/ruby/trunk@44 fd4e7336-3dff-0310-b68a-b6615a75f13b
137
+
138
+ == v1.0.3 20070114
139
+
140
+ * Additional fixes for reliable by Andrew Kuklewicz
141
+ * git-svn-id: http://svn.codehaus.org/stomp/ruby/trunk@42 fd4e7336-3dff-0310-b68a-b6615a75f13b
142
+
143
+ == v1.0.2 20060922
144
+
145
+ * Moving ruby so we can tag it ;-)
146
+ * git-svn-id: http://svn.codehaus.org/stomp/ruby/trunk@37 fd4e7336-3dff-0310-b68a-b6615a75f13b
147
+
148
+ == v1.0.1 20051217
149
+
150
+ * Increment version
151
+ * git-svn-id: http://svn.codehaus.org/stomp/trunk/ruby@24 fd4e7336-3dff-0310-b68a-b6615a75f13b
152
+
153
+ == v1.0.0 20051015
117
154
 
118
- SVN rev 86 clone from http://svn.codehaus.org/stomp/ruby/trunk
155
+ * works in repl, getting messages in weird order or dupes in test, but unable to isolate so far =(
156
+ * git-svn-id: http://svn.codehaus.org/stomp/trunk/ruby@20 fd4e7336-3dff-0310-b68a-b6615a75f13b
119
157
 
120
- git-svn-id: http://svn.codehaus.org/stomp/ruby/trunk@86 fd4e7336-3dff-0310-b68a-b6615a75f13b
@@ -1,7 +1,6 @@
1
1
  ==README
2
2
 
3
- * (https://github.com/morellon/stomp/)
4
- * (http://gitorious.org/projects/stomp/)
3
+ * (https://github.com/stompgem/stomp/)
5
4
 
6
5
  ===Overview
7
6
 
@@ -11,6 +10,7 @@ An implementation of the Stomp protocol for Ruby. See:
11
10
 
12
11
  ===New
13
12
 
13
+ * Gem version 1.2.3. Miscellaneous fixes, see changelog for details.
14
14
  * Gem version 1.2.2. Performance and more SSL enhancements.
15
15
  * Full support of SSL certificates is announced as of gem version 1.2.1.
16
16
  * Support of Stomp protocol level 1.1 is announced as of gem version 1.2.0.
@@ -46,6 +46,7 @@ See the change log for details.
46
46
 
47
47
  ],
48
48
  # These are the default parameters, don't need to be set
49
+ :reliable => true, # true for hash login
49
50
  :initial_reconnect_delay => 0.01,
50
51
  :max_reconnect_delay => 30.0,
51
52
  :use_exponential_back_off => true,
@@ -72,8 +73,7 @@ Up until March 2009 the project was maintained and primarily developed by Brian
72
73
 
73
74
  ===Source Code and Project URLs
74
75
 
75
- https://github.com/morellon/stomp/
76
- http://gitorious.org/projects/stomp/
76
+ https://github.com/stompgem/stomp/
77
77
 
78
78
  ===Stomp Protocol Information :
79
79
 
@@ -83,12 +83,12 @@ Up until March 2009 the project was maintained and primarily developed by Brian
83
83
 
84
84
  The following people have contributed to Stomp:
85
85
 
86
- * Brian McCaliister
86
+ * Brian McCallister
87
87
  * Glenn Rempe <glenn@rempe.us>
88
88
  * jstrachan
89
89
  * Marius Mathiesen <marius.mathiesen@gmail.com>
90
90
  * Johan S√∏rensen <johan@johansorensen.com>
91
- * Thiago Morello <morellon@gmail.com>
91
+ * Thiago Morello <stompgem@gmail.com>
92
92
  * Guy M. Allard
93
93
  * kookster
94
94
  * Tony Garnock-Jones <tonyg@lshift.net>
@@ -104,15 +104,6 @@ The following people have contributed to Stomp:
104
104
  * R.I. Pienaar
105
105
  * tworker
106
106
  * James Pearson
107
-
108
- = Announcements
109
-
110
- In the next version of the gem, the dates in CHANGELOG.rdoc will be changed from:
111
-
112
- * yyyy-dd-mm
113
-
114
- to:
115
-
116
- * ISO8601 format (yyyymmdd)
117
-
107
+ * Craig
108
+ * Tommy Bishop
118
109
 
data/Rakefile CHANGED
@@ -33,7 +33,7 @@ begin
33
33
  gem.description = %Q{Ruby client for the Stomp messaging protocol. Note that this gem is no longer supported on rubyforge.}
34
34
  gem.email = ["brianm@apache.org", 'marius@stones.com', 'morellon@gmail.com',
35
35
  'allard.guy.m@gmail.com' ]
36
- gem.homepage = "https://github.com/morellon/stomp"
36
+ gem.homepage = "https://github.com/stompgem/stomp"
37
37
  gem.authors = ["Brian McCallister", 'Marius Mathiesen', 'Thiago Morello',
38
38
  'Guy M. Allard']
39
39
  gem.add_development_dependency "rspec", '>= 2.3'
@@ -28,6 +28,25 @@ require 'stomp'
28
28
  #
29
29
  begin
30
30
 
31
+ if ARGV[0] == '-h' || ARGV[0] == '--help'
32
+ $stdout.puts
33
+ $stdout.puts 'Usage: catstomp DESTINATION'
34
+ $stdout.puts
35
+ $stdout.puts 'Publishes STDIN to the desired stomp destination'
36
+ $stdout.puts
37
+ $stdout.puts 'Example: ls | catstomp /topic/foo'
38
+ $stdout.puts
39
+ $stdout.puts 'Defaults:'
40
+ $stdout.puts "DESTINATION\t/topic/default"
41
+ $stdout.puts "STOMP_HOST\tlocalhost"
42
+ $stdout.puts "STOMP_PORT\t61613"
43
+ $stdout.puts "STOMP_USER"
44
+ $stdout.puts "STOMP_PASSWORD"
45
+ $stdout.puts
46
+ $stdout.puts 'You can override the stomp host, port, user, or password through environment variables'
47
+ exit 0
48
+ end
49
+
31
50
  @port = 61613
32
51
  @host = "localhost"
33
52
  @user = ENV["STOMP_USER"];
@@ -28,6 +28,25 @@ require 'stomp'
28
28
  #
29
29
  begin
30
30
 
31
+ if ARGV[0] == '-h' || ARGV[0] == '--help'
32
+ $stdout.puts
33
+ $stdout.puts 'Usage: stompcat DESTINATION'
34
+ $stdout.puts
35
+ $stdout.puts 'Receives data from a stomp destination and outputs it to STDOUT'
36
+ $stdout.puts
37
+ $stdout.puts 'Example: stompcat /topic/foo'
38
+ $stdout.puts
39
+ $stdout.puts 'Defaults:'
40
+ $stdout.puts "DESTINATION\t/topic/default"
41
+ $stdout.puts "STOMP_HOST\tlocalhost"
42
+ $stdout.puts "STOMP_PORT\t61613"
43
+ $stdout.puts "STOMP_USER\t"
44
+ $stdout.puts "STOMP_PASSWORD\t"
45
+ $stdout.puts
46
+ $stdout.puts 'You can override the host, port, user, or password through environment variables'
47
+ exit 0
48
+ end
49
+
31
50
  @port = 61613
32
51
  @host = "localhost"
33
52
  @user = ENV["STOMP_USER"];
@@ -175,7 +175,7 @@ class Slogger
175
175
  def on_ssl_connectfail(parms)
176
176
  begin
177
177
  @log.debug "SSL Connect Fail Parms #{info(parms)}"
178
- @log.debug "SSL Connect Fail Excception #{parms[:ssl_exception]}, #{parms[:ssl_exception].message}"
178
+ @log.debug "SSL Connect Fail Exception #{parms[:ssl_exception]}, #{parms[:ssl_exception].message}"
179
179
  rescue
180
180
  @log.debug "SSL Connect Fail oops"
181
181
  end
@@ -1,19 +1,33 @@
1
1
  #
2
- # Reference: https://github.com/morellon/stomp/wiki/extended-ssl-overview
2
+ # Reference: https://github.com/stompgem/stomp/wiki/extended-ssl-overview
3
3
  #
4
4
  require "rubygems"
5
5
  require "stomp"
6
6
  #
7
- # SSL Use Case 1
7
+ # SSL Use Case 1 - server does *not* authenticate client, client does *not* authenticate server
8
8
  #
9
+ # Subcase 1.A - Message broker configuration does *not* require client authentication
10
+ #
11
+ # - Expect connection success
12
+ # - Expect a verify result of 20 becuase the client did not authenticate the
13
+ # server's certificate.
14
+ #
15
+ # Subcase 1.B - Message broker configuration *does* require client authentication
16
+ #
17
+ # - Expect connection failure (broker must be sent a valid client certificate)
18
+ #
19
+ ssl_opts = Stomp::SSLParams.new
9
20
  hash = { :hosts => [
10
- {:login => 'guest', :passcode => 'guest', :host => 'localhost', :port => 61612, :ssl => true},
11
- ]
21
+ {:login => 'guest', :passcode => 'guest', :host => 'localhost', :port => 61612, :ssl => ssl_opts},
22
+ ],
23
+ :reliable => false, # YMMV, to test this in a sane manner
12
24
  }
13
25
  #
14
26
  puts "Connect starts, SSL Use Case 1"
15
27
  c = Stomp::Connection.new(hash)
16
28
  puts "Connect completed"
29
+ puts "SSL Verify Result: #{ssl_opts.verify_result}"
30
+ # puts "SSL Peer Certificate:\n#{ssl_opts.peer_cert}"
17
31
  #
18
32
  c.disconnect
19
33
 
@@ -1,12 +1,12 @@
1
1
  #
2
- # Reference: https://github.com/morellon/stomp/wiki/extended-ssl-overview
2
+ # Reference: https://github.com/stompgem/stomp/wiki/extended-ssl-overview
3
3
  #
4
4
  require "rubygems"
5
5
  require "stomp"
6
6
  #
7
7
  # If you need your own ciphers list, this is how.
8
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
9
+ # will know it because SSL connect will fail. In that case, determining
10
10
  # _what_ should be in the list is your responsibility.
11
11
  #
12
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],
@@ -25,6 +25,7 @@ hash = { :hosts => [
25
25
  puts "Connect starts, SSL Use Case 1"
26
26
  c = Stomp::Connection.new(hash)
27
27
  puts "Connect completed"
28
+ puts "SSL Verify Result: #{ssl_opts.verify_result}"
28
29
  #
29
30
  c.disconnect
30
31
 
@@ -1,30 +1,36 @@
1
1
  #
2
- # Reference: https://github.com/morellon/stomp/wiki/extended-ssl-overview
2
+ # Reference: https://github.com/stompgem/stomp/wiki/extended-ssl-overview
3
3
  #
4
4
  require "rubygems"
5
5
  require "stomp"
6
6
  #
7
- # SSL Use Case 2
7
+ # SSL Use Case 2 - server does *not* authenticate client, client *does* authenticate server
8
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
-
9
+ # Subcase 2.A - Message broker configuration does *not* require client authentication
10
+ #
11
+ # - Expect connection success
12
+ # - Expect a verify result of 0 becuase the client did authenticate the
13
+ # server's certificate.
14
+ #
15
+ # Subcase 2.B - Message broker configuration *does* require client authentication
16
+ #
17
+ # - Expect connection failure (broker must be sent a valid client certificate)
18
+ #
19
+ ts_flist = []
20
+ ts_flist << "/home/gmallard/sslwork/twocas_tj/serverCA/ServerTJCA.crt"
21
+ ssl_opts = Stomp::SSLParams.new(:ts_files => ts_flist.join(","))
12
22
  #
13
23
  hash = { :hosts => [
14
24
  {:login => 'guest', :passcode => 'guest', :host => 'localhost', :port => 61612, :ssl => ssl_opts},
15
- ]
25
+ ],
26
+ :reliable => false, # YMMV, to test this in a sane manner
16
27
  }
17
28
  #
18
29
  puts "Connect starts, SSL Use Case 2"
19
30
  c = Stomp::Connection.new(hash)
20
31
  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
32
  puts "SSL Verify Result: #{ssl_opts.verify_result}"
28
- puts "SSL Peer Certificate:\n#{ssl_opts.peer_cert}"
33
+ # puts "SSL Peer Certificate:\n#{ssl_opts.peer_cert}"
29
34
  c.disconnect
30
35
 
36
+
@@ -1,12 +1,12 @@
1
1
  #
2
- # Reference: https://github.com/morellon/stomp/wiki/extended-ssl-overview
2
+ # Reference: https://github.com/stompgem/stomp/wiki/extended-ssl-overview
3
3
  #
4
4
  require "rubygems"
5
5
  require "stomp"
6
6
  #
7
7
  # If you need your own ciphers list, this is how.
8
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
9
+ # will know it because SSL connect will fail. In that case, determining
10
10
  # _what_ should be in the list is your responsibility.
11
11
  #
12
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],
@@ -26,13 +26,7 @@ hash = { :hosts => [
26
26
  puts "Connect starts, SSL Use Case 2"
27
27
  c = Stomp::Connection.new(hash)
28
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
29
  puts "SSL Verify Result: #{ssl_opts.verify_result}"
36
- puts "SSL Peer Certificate:\n#{ssl_opts.peer_cert}"
30
+ # puts "SSL Peer Certificate:\n#{ssl_opts.peer_cert}"
37
31
  c.disconnect
38
32
 
@@ -1,29 +1,37 @@
1
1
  #
2
- # Reference: https://github.com/morellon/stomp/wiki/extended-ssl-overview
2
+ # Reference: https://github.com/stompgem/stomp/wiki/extended-ssl-overview
3
3
  #
4
4
  require "rubygems"
5
5
  require "stomp"
6
6
  #
7
- # SSL Use Case 3
7
+ # SSL Use Case 3 - server *does* authenticate client, client does *not* authenticate server
8
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(","))
9
+ # Subcase 3.A - Message broker configuration does *not* require client authentication
10
+ #
11
+ # - Expect connection success
12
+ # - Expect a verify result of 20 becuase the client did not authenticate the
13
+ # server's certificate.
14
+ #
15
+ # Subcase 3.B - Message broker configuration *does* require client authentication
16
+ #
17
+ # - Expect connection success if the server can authenticate the client certificate
18
+ # - Expect a verify result of 20 because the client did not authenticate the
19
+ # server's certificate.
20
+ #
21
+ ssl_opts = Stomp::SSLParams.new(:key_file => "/home/gmallard/sslwork/twocas_tj/clientCA/ClientTJ.key",
22
+ :cert_file => "/home/gmallard/sslwork/twocas_tj/clientCA/ClientTJ.crt")
23
+
12
24
  #
13
25
  hash = { :hosts => [
14
26
  {:login => 'guest', :passcode => 'guest', :host => 'localhost', :port => 61612, :ssl => ssl_opts},
15
- ]
27
+ ],
28
+ :reliable => false, # YMMV, to test this in a sane manner
16
29
  }
17
30
  #
18
31
  puts "Connect starts, SSL Use Case 3"
19
32
  c = Stomp::Connection.new(hash)
20
33
  puts "Connect completed"
21
- #
22
- # Expect a verify_result == 0
23
- #
24
- # This means: the client successfully verified the peer's certificate.
25
- #
26
34
  puts "SSL Verify Result: #{ssl_opts.verify_result}"
27
- puts "SSL Peer Certificate:\n#{ssl_opts.peer_cert}"
35
+ # puts "SSL Peer Certificate:\n#{ssl_opts.peer_cert}"
28
36
  c.disconnect
29
37
 
@@ -1,12 +1,12 @@
1
1
  #
2
- # Reference: https://github.com/morellon/stomp/wiki/extended-ssl-overview
2
+ # Reference: https://github.com/stompgem/stomp/wiki/extended-ssl-overview
3
3
  #
4
4
  require "rubygems"
5
5
  require "stomp"
6
6
  #
7
7
  # If you need your own ciphers list, this is how.
8
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
9
+ # will know it because SSL connect will fail. In that case, determining
10
10
  # _what_ should be in the list is your responsibility.
11
11
  #
12
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],
@@ -26,12 +26,7 @@ hash = { :hosts => [
26
26
  puts "Connect starts, SSL Use Case 3"
27
27
  c = Stomp::Connection.new(hash)
28
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
29
  puts "SSL Verify Result: #{ssl_opts.verify_result}"
35
- puts "SSL Peer Certificate:\n#{ssl_opts.peer_cert}"
30
+ # puts "SSL Peer Certificate:\n#{ssl_opts.peer_cert}"
36
31
  c.disconnect
37
32
 
@@ -1,10 +1,22 @@
1
1
  #
2
- # Reference: https://github.com/morellon/stomp/wiki/extended-ssl-overview
2
+ # Reference: https://github.com/stompgem/stomp/wiki/extended-ssl-overview
3
3
  #
4
4
  require "rubygems"
5
5
  require "stomp"
6
6
  #
7
- # SSL Use Case 4
7
+ # SSL Use Case 4 - server *does* authenticate client, client *does* authenticate server
8
+ #
9
+ # Subcase 4.A - Message broker configuration does *not* require client authentication
10
+ #
11
+ # - Expect connection success
12
+ # - Expect a verify result of 0 becuase the client did authenticate the
13
+ # server's certificate.
14
+ #
15
+ # Subcase 4.B - Message broker configuration *does* require client authentication
16
+ #
17
+ # - Expect connection success if the server can authenticate the client certificate
18
+ # - Expect a verify result of 0 because the client did authenticate the
19
+ # server's certificate.
8
20
  #
9
21
  ssl_opts = Stomp::SSLParams.new(:key_file => "/home/gmallard/sslwork/twocas_tj/clientCA/ClientTJ.key",
10
22
  :cert_file => "/home/gmallard/sslwork/twocas_tj/clientCA/ClientTJ.crt",
@@ -12,18 +24,14 @@ ssl_opts = Stomp::SSLParams.new(:key_file => "/home/gmallard/sslwork/twocas_tj/c
12
24
  #
13
25
  hash = { :hosts => [
14
26
  {:login => 'guest', :passcode => 'guest', :host => 'localhost', :port => 61612, :ssl => ssl_opts},
15
- ]
27
+ ],
28
+ :reliable => false, # YMMV, to test this in a sane manner
16
29
  }
17
30
  #
18
31
  puts "Connect starts, SSL Use Case 4"
19
32
  c = Stomp::Connection.new(hash)
20
33
  puts "Connect completed"
21
- #
22
- # Expect a verify_result == 0
23
- #
24
- # This means: the client successfully verified the peer's certificate.
25
- #
26
34
  puts "SSL Verify Result: #{ssl_opts.verify_result}"
27
- puts "SSL Peer Certificate:\n#{ssl_opts.peer_cert}"
35
+ # puts "SSL Peer Certificate:\n#{ssl_opts.peer_cert}"
28
36
  c.disconnect
29
37
 
@@ -1,12 +1,12 @@
1
1
  #
2
- # Reference: https://github.com/morellon/stomp/wiki/extended-ssl-overview
2
+ # Reference: https://github.com/stompgem/stomp/wiki/extended-ssl-overview
3
3
  #
4
4
  require "rubygems"
5
5
  require "stomp"
6
6
  #
7
7
  # If you need your own ciphers list, this is how.
8
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
9
+ # will know it because SSL connect will fail. In that case, determining
10
10
  # _what_ should be in the list is your responsibility.
11
11
  #
12
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],
@@ -27,12 +27,7 @@ hash = { :hosts => [
27
27
  puts "Connect starts, SSL Use Case 4"
28
28
  c = Stomp::Connection.new(hash)
29
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
30
  puts "SSL Verify Result: #{ssl_opts.verify_result}"
36
- puts "SSL Peer Certificate:\n#{ssl_opts.peer_cert}"
31
+ # puts "SSL Peer Certificate:\n#{ssl_opts.peer_cert}"
37
32
  c.disconnect
38
33
 
@@ -1,13 +1,14 @@
1
1
  #
2
- # Reference: https://github.com/morellon/stomp/wiki/extended-ssl-overview
2
+ # Reference: https://github.com/stompgem/stomp/wiki/extended-ssl-overview
3
3
  #
4
4
  require "rubygems"
5
5
  require "stomp"
6
-
7
6
  #
8
- # If you use SSLParams, and need the _default_ Ruby ciphers, this is how.
7
+ # If you use SSLParams, and need the _default_ Ruby ciphers, this is how.
8
+ #
9
+ # NOTE: JRuby users may find that this is a *required* action. YMMV.
9
10
  #
10
- ssl_opts = Stomp::SSLParams.new(:use_ruby_ciphers => true)
11
+ ssl_opts = Stomp::SSLParams.new(:use_ruby_ciphers => true) # Plus other parameters as needed
11
12
  #
12
13
  # SSL Use Case: Using default Stomp ciphers
13
14
  #
@@ -17,7 +18,7 @@ hash = { :hosts => [
17
18
  ]
18
19
  }
19
20
  #
20
- puts "Connect starts, SSL Use Case X"
21
+ puts "Connect starts, SSL , Use Default Ruby Ciphers"
21
22
  c = Stomp::Connection.new(hash)
22
23
  puts "Connect completed"
23
24
  #
@@ -265,6 +265,12 @@ module Stomp
265
265
  @connection.uuid()
266
266
  end
267
267
 
268
+ # Poll for asynchronous messages issued by broker.
269
+ # Return nil of no message available, else the message
270
+ def poll
271
+ @connection.poll
272
+ end
273
+
268
274
  private
269
275
  # Set a subscription id in the headers hash if one does not already exist.
270
276
  # For simplicities sake, all subscriptions have a subscription ID.
@@ -170,7 +170,6 @@ module Stomp
170
170
 
171
171
  def refine_params(params)
172
172
  params = params.uncamelize_and_symbolize_keys
173
-
174
173
  default_params = {
175
174
  :connect_headers => {},
176
175
  :reliable => true,
@@ -184,11 +183,15 @@ module Stomp
184
183
  :backup => false,
185
184
  :connect_timeout => 0,
186
185
  # Parse Timeout
187
- :parse_timeout => 5
186
+ :parse_timeout => 5,
187
+ :dmh => false,
188
188
  }
189
189
 
190
- default_params.merge(params)
191
-
190
+ res_params = default_params.merge(params)
191
+ if res_params[:dmh]
192
+ res_params = _expand_hosts(res_params)
193
+ end
194
+ return res_params
192
195
  end
193
196
 
194
197
  def change_host
@@ -487,6 +490,30 @@ module Stomp
487
490
 
488
491
  private
489
492
 
493
+ def _expand_hosts(hash)
494
+ new_hash = hash.clone
495
+ new_hash[:hosts_cloned] = hash[:hosts].clone
496
+ new_hash[:hosts] = []
497
+ #
498
+ hash[:hosts].each do |host_parms|
499
+ ai = Socket.getaddrinfo(host_parms[:host], nil, nil, Socket::SOCK_STREAM)
500
+ next if ai.nil? || ai.size == 0
501
+ info6 = ai.detect {|info| info[4] == Socket::AF_INET6}
502
+ info4 = ai.detect {|info| info[4] == Socket::AF_INET}
503
+ if info6
504
+ new_hostp = host_parms.clone
505
+ new_hostp[:host] = info6[3]
506
+ new_hash[:hosts] << new_hostp
507
+ end
508
+ if info4
509
+ new_hostp = host_parms.clone
510
+ new_hostp[:host] = info4[3]
511
+ new_hash[:hosts] << new_hostp
512
+ end
513
+ end
514
+ return new_hash
515
+ end
516
+
490
517
  def _receive( read_socket )
491
518
  @read_semaphore.synchronize do
492
519
  line = read_socket.gets
@@ -596,8 +623,8 @@ module Stomp
596
623
  # and ActiveMQ will interpret the message as a TextMessage.
597
624
  # For more information refer to http://juretta.com/log/2009/05/24/activemq-jms-stomp/
598
625
  # Lets send this header in the message, so it can maintain state when using unreceive
599
- headers['content-length'] = "#{body_length_bytes}" unless headers[:suppress_content_length]
600
- headers['content-type'] = "text/plain; charset=UTF-8" unless headers['content-type']
626
+ headers[:'content-length'] = "#{body_length_bytes}" unless headers[:suppress_content_length]
627
+ headers[:'content-type'] = "text/plain; charset=UTF-8" unless headers[:'content-type']
601
628
  used_socket.puts command
602
629
  headers.each do |k,v|
603
630
  if v.is_a?(Array)
@@ -684,10 +711,10 @@ module Stomp
684
711
  if @ssl.cert_file # Any check will do here
685
712
  raise Stomp::Error::SSLNoCertFileError if !File::exists?(@ssl.cert_file)
686
713
  raise Stomp::Error::SSLUnreadableCertFileError if !File::readable?(@ssl.cert_file)
687
- ctx.cert = OpenSSL::X509::Certificate.new(File.open(@ssl.cert_file))
714
+ ctx.cert = OpenSSL::X509::Certificate.new(File.read(@ssl.cert_file))
688
715
  raise Stomp::Error::SSLNoKeyFileError if !File::exists?(@ssl.key_file)
689
716
  raise Stomp::Error::SSLUnreadableKeyFileError if !File::readable?(@ssl.key_file)
690
- ctx.key = OpenSSL::PKey::RSA.new(File.open(@ssl.key_file))
717
+ ctx.key = OpenSSL::PKey::RSA.new(File.read(@ssl.key_file), @ssl.key_password)
691
718
  end
692
719
 
693
720
  # Cipher list
@@ -815,10 +842,16 @@ module Stomp
815
842
  def _post_connect
816
843
  return unless (@connect_headers[:"accept-version"] && @connect_headers[:host])
817
844
  return if @connection_frame.command == Stomp::CMD_ERROR
845
+ # We are CONNECTed
818
846
  cfh = @connection_frame.headers.symbolize_keys
819
847
  @protocol = cfh[:version]
820
- # Should not happen, but check anyway
821
- raise Stomp::Error::UnsupportedProtocolError unless Stomp::SUPPORTED.index(@protocol)
848
+ if @protocol
849
+ # Should not happen, but check anyway
850
+ raise Stomp::Error::UnsupportedProtocolError unless Stomp::SUPPORTED.index(@protocol)
851
+ else # CONNECTed to a 1.0 server that does not return *any* 1.1 type headers
852
+ @protocol = Stomp::SPL_10 # reset
853
+ return
854
+ end
822
855
  # Heartbeats
823
856
  return unless @connect_headers[:"heart-beat"]
824
857
  _init_heartbeats()
@@ -41,7 +41,7 @@ module Stomp
41
41
  end
42
42
  self.command = work_command
43
43
  work_headers.split("\n").map do |value|
44
- parsed_value = value.match /^([\w|-]*):(.*)$/
44
+ parsed_value = value.match /^([\r|\w|-]*):(.*)$/
45
45
  raise Stomp::Error::InvalidFormat, 'parsed header value' unless parsed_value
46
46
  #
47
47
  pk = parsed_value[1]
@@ -14,6 +14,8 @@ module Stomp
14
14
  attr_accessor :cert_file
15
15
  # The client private key file.
16
16
  attr_accessor :key_file
17
+ # The client private key password.
18
+ attr_accessor :key_password
17
19
  # SSL Connect Verify Result. The result of the handshake.
18
20
  attr_accessor :verify_result
19
21
  # The certificate of the connection peer (the server), received during
@@ -38,6 +40,7 @@ module Stomp
38
40
  # Client authentication parameters
39
41
  @cert_file = opts[:cert_file] # Client cert
40
42
  @key_file = opts[:key_file] # Client key
43
+ @key_password = opts[:key_password] # Client key password
41
44
  #
42
45
  raise Stomp::Error::SSLClientParamsError if @cert_file.nil? && !@key_file.nil?
43
46
  raise Stomp::Error::SSLClientParamsError if !@cert_file.nil? && @key_file.nil?
@@ -4,7 +4,7 @@ module Stomp
4
4
  module Version #:nodoc: all
5
5
  MAJOR = 1
6
6
  MINOR = 2
7
- PATCH = 2
7
+ PATCH = 3
8
8
  STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
9
9
  end
10
10
  end
@@ -20,7 +20,8 @@ describe Stomp::Connection do
20
20
  :backup => false,
21
21
  :connect_timeout => 0,
22
22
  :parse_timeout => 5,
23
- :connect_headers => {}
23
+ :connect_headers => {},
24
+ :dmh => false,
24
25
  }
25
26
 
26
27
  #POG:
@@ -298,7 +299,8 @@ describe Stomp::Connection do
298
299
  :backup => false,
299
300
  :connect_timeout => 0,
300
301
  :parse_timeout => 5,
301
- :connect_headers => {}
302
+ :connect_headers => {},
303
+ :dmh => false,
302
304
  }
303
305
 
304
306
  used_hash = {
@@ -330,7 +332,8 @@ describe Stomp::Connection do
330
332
  :parse_timeout => 20,
331
333
  :connect_headers => {:lerolero => "ronaldo"},
332
334
  :dead_letter_queue => "queue/Error",
333
- :max_redeliveries => 10
335
+ :max_redeliveries => 10,
336
+ :dmh => false,
334
337
  }
335
338
 
336
339
  @connection = Stomp::Connection.new(used_hash)
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{stomp}
8
- s.version = "1.2.2"
8
+ s.version = "1.2.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Brian McCallister", "Marius Mathiesen", "Thiago Morello", "Guy M. Allard"]
12
- s.date = %q{2012-03-24}
12
+ s.date = %q{2012-06-16}
13
13
  s.description = %q{Ruby client for the Stomp messaging protocol. Note that this gem is no longer supported on rubyforge.}
14
14
  s.email = ["brianm@apache.org", "marius@stones.com", "morellon@gmail.com", "allard.guy.m@gmail.com"]
15
15
  s.executables = ["catstomp", "stompcat"]
@@ -75,7 +75,7 @@ Gem::Specification.new do |s|
75
75
  "test/test_ssl.rb",
76
76
  "test/tlogger.rb"
77
77
  ]
78
- s.homepage = %q{https://github.com/morellon/stomp}
78
+ s.homepage = %q{https://github.com/stompgem/stomp}
79
79
  s.require_paths = ["lib"]
80
80
  s.rubygems_version = %q{1.3.7}
81
81
  s.summary = %q{Ruby client for the Stomp messaging protocol}
@@ -18,6 +18,12 @@ class TestClient < Test::Unit::TestCase
18
18
  @client.close if @client.open? # allow tests to close
19
19
  end
20
20
 
21
+ def test_poll_async
22
+ # If the test 'hangs' here, Connection#poll is broken.
23
+ m = @client.poll
24
+ assert m.nil?
25
+ end
26
+
21
27
  def test_ack_api_works
22
28
  @client.publish make_destination, message_text, {:suppress_content_length => true}
23
29
 
@@ -384,5 +384,35 @@ class TestConnection < Test::Unit::TestCase
384
384
  end
385
385
  end
386
386
 
387
+ # Test to illustrate Issue #44. Prior to a fix for #44, these tests would
388
+ # fail only when connecting to a pure STOMP 1.0 server that does not
389
+ # return a 'version' header at all.
390
+ def test_conn10_simple
391
+ @conn.disconnect
392
+ #
393
+ hash = { :hosts => [
394
+ {:login => user, :passcode => passcode, :host => host, :port => port, :ssl => false},
395
+ ],
396
+ :connect_headers => {"accept-version" => "1.0", "host" => host},
397
+ :reliable => false,
398
+ }
399
+ c = nil
400
+ assert_nothing_raised {
401
+ c = Stomp::Connection.new(hash)
402
+ }
403
+ c.disconnect if c
404
+ #
405
+ hash = { :hosts => [
406
+ {:login => user, :passcode => passcode, :host => host, :port => port, :ssl => false},
407
+ ],
408
+ :connect_headers => {"accept-version" => "3.14159,1.0,12.0", "host" => host},
409
+ :reliable => false,
410
+ }
411
+ c = nil
412
+ assert_nothing_raised {
413
+ c = Stomp::Connection.new(hash)
414
+ }
415
+ c.disconnect if c
416
+ end
387
417
  end
388
418
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stomp
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 2
9
- - 2
10
- version: 1.2.2
9
+ - 3
10
+ version: 1.2.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Brian McCallister
@@ -18,7 +18,7 @@ autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
20
 
21
- date: 2012-03-24 00:00:00 -04:00
21
+ date: 2012-06-16 00:00:00 -04:00
22
22
  default_executable:
23
23
  dependencies:
24
24
  - !ruby/object:Gem::Dependency
@@ -108,7 +108,7 @@ files:
108
108
  - test/test_ssl.rb
109
109
  - test/tlogger.rb
110
110
  has_rdoc: true
111
- homepage: https://github.com/morellon/stomp
111
+ homepage: https://github.com/stompgem/stomp
112
112
  licenses: []
113
113
 
114
114
  post_install_message: