stomp 1.4.4 → 1.4.5

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.
Files changed (74) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +13 -0
  3. data/README.md +96 -100
  4. data/examples/EXAMPLES.md +251 -0
  5. data/examples/amqdurasub.rb +14 -17
  6. data/examples/artemis/cliwaiter_not_reliable.rb +12 -5
  7. data/examples/artemis/{cliwaiter_reliable.rb → cliwaiter_reliable_hb.rb} +24 -23
  8. data/examples/client_conndisc.rb +66 -0
  9. data/examples/client_putget.rb +94 -0
  10. data/examples/conn_conndisc.rb +102 -0
  11. data/examples/conn_putget.rb +124 -0
  12. data/examples/contrib.sh +2 -3
  13. data/examples/contributors.rb +26 -14
  14. data/examples/examplogger.rb +1 -1
  15. data/examples/{consumer.rb → historical/consumer.rb} +0 -0
  16. data/examples/{publisher.rb → historical/publisher.rb} +0 -0
  17. data/examples/{topic_consumer.rb → historical/topic_consumer.rb} +0 -0
  18. data/examples/{topic_publisher.rb → historical/topic_publisher.rb} +0 -0
  19. data/examples/logexamp.rb +23 -14
  20. data/examples/putget_file.rb +79 -0
  21. data/examples/{putget11_rh1.rb → putget_rephdrs.rb} +16 -15
  22. data/examples/ssl/SSL.md +189 -0
  23. data/examples/{ssl_ctxoptions.rb → ssl/misc/ssl_ctxoptions.rb} +23 -14
  24. data/examples/ssl/misc/ssl_newparm.rb +53 -0
  25. data/examples/ssl/misc/ssl_ucx_default_ciphers.rb +54 -0
  26. data/examples/ssl/ssl_common.rb +96 -0
  27. data/examples/ssl/sslexall.sh +17 -0
  28. data/examples/{ssl_uc1.rb → ssl/uc1/ssl_uc1.rb} +15 -11
  29. data/examples/ssl/uc1/ssl_uc1_ciphers.rb +60 -0
  30. data/examples/{ssl_uc2.rb → ssl/uc2/ssl_uc2.rb} +17 -10
  31. data/examples/ssl/uc2/ssl_uc2_ciphers.rb +67 -0
  32. data/examples/{ssl_uc3.rb → ssl/uc3/ssl_uc3.rb} +15 -16
  33. data/examples/ssl/uc3/ssl_uc3_ciphers.rb +65 -0
  34. data/examples/{ssl_uc4.rb → ssl/uc4/ssl_uc4.rb} +15 -15
  35. data/examples/ssl/uc4/ssl_uc4_ciphers.rb +66 -0
  36. data/examples/stomp_common.rb +97 -0
  37. data/lib/connection/netio.rb +83 -37
  38. data/lib/connection/utf8.rb +0 -7
  39. data/lib/connection/utils.rb +4 -1
  40. data/lib/stomp/client.rb +5 -1
  41. data/lib/stomp/connection.rb +25 -15
  42. data/lib/stomp/constants.rb +109 -0
  43. data/lib/stomp/errors.rb +11 -0
  44. data/lib/stomp/sslparams.rb +3 -4
  45. data/lib/stomp/version.rb +2 -2
  46. data/stomp.gemspec +31 -37
  47. data/test/test_anonymous.rb +4 -0
  48. data/test/test_client.rb +2 -0
  49. data/test/test_connection.rb +4 -0
  50. data/test/test_connection1p.rb +2 -4
  51. data/test/test_helper.rb +11 -0
  52. metadata +30 -36
  53. data/examples/artemis/artlogger.rb +0 -41
  54. data/examples/client11_ex1.rb +0 -89
  55. data/examples/client11_putget1.rb +0 -71
  56. data/examples/conn11_ex1.rb +0 -112
  57. data/examples/conn11_ex2.rb +0 -87
  58. data/examples/conn11_hb1.rb +0 -57
  59. data/examples/consume_file.rb +0 -63
  60. data/examples/get11conn_ex1.rb +0 -117
  61. data/examples/get11conn_ex2.rb +0 -77
  62. data/examples/lflogger.rb +0 -316
  63. data/examples/logexamp_ssl.rb +0 -81
  64. data/examples/publish_file.rb +0 -76
  65. data/examples/publish_file_conn.rb +0 -75
  66. data/examples/put11conn_ex1.rb +0 -56
  67. data/examples/ssl_common.rb +0 -73
  68. data/examples/ssl_newparm.rb +0 -43
  69. data/examples/ssl_uc1_ciphers.rb +0 -53
  70. data/examples/ssl_uc2_ciphers.rb +0 -60
  71. data/examples/ssl_uc3_ciphers.rb +0 -64
  72. data/examples/ssl_uc4_ciphers.rb +0 -65
  73. data/examples/ssl_ucx_default_ciphers.rb +0 -41
  74. data/examples/stomp11_common.rb +0 -54
@@ -1,60 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
- #
4
- # Reference: https://github.com/stompgem/stomp/wiki/extended-ssl-overview
5
- #
6
- if Kernel.respond_to?(:require_relative)
7
- require_relative("./ssl_common")
8
- else
9
- $LOAD_PATH << File.dirname(__FILE__)
10
- require "ssl_common"
11
- end
12
- include SSLCommon
13
- #
14
- # == SSL Use Case 2 - User Supplied Ciphers
15
- #
16
- # If you need your own ciphers list, this is how.
17
- # Stomp's default list will work in many cases. If you need to use this, you
18
- # will know it because SSL connect will fail. In that case, determining
19
- # _what_ should be in the list is your responsibility.
20
- #
21
- class ExampleSSL2C
22
- # Initialize.
23
- def initialize # Change the following as needed.
24
- @host = ENV['STOMP_HOST'] ? ENV['STOMP_HOST'] : "localhost"
25
- @port = ENV['STOMP_PORT'] ? ENV['STOMP_PORT'].to_i : 61612
26
- end
27
- # Run example.
28
- def run
29
- 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], ["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]]
30
- #
31
- # SSL Use Case 2
32
- #
33
- ts_flist = []
34
-
35
- # Possibly change/override the cert data here.
36
- ts_flist << "#{ca_loc()}/#{ca_cert()}"
37
-
38
- ssl_opts = Stomp::SSLParams.new(:ts_files => ts_flist.join(","),
39
- :ciphers => ciphers_list,
40
- :fsck => true
41
- )
42
- #
43
- hash = { :hosts => [
44
- {:login => 'guest', :passcode => 'guest', :host => @host, :port => @port, :ssl => ssl_opts},
45
- ],
46
- :reliable => false, # YMMV, to test this in a sane manner
47
- }
48
- #
49
- puts "Connect starts, SSL Use Case 2"
50
- c = Stomp::Connection.new(hash)
51
- puts "Connect completed"
52
- puts "SSL Verify Result: #{ssl_opts.verify_result}"
53
- # puts "SSL Peer Certificate:\n#{ssl_opts.peer_cert}"
54
- c.disconnect
55
- end
56
- end
57
- #
58
- e = ExampleSSL2C.new
59
- e.run
60
-
@@ -1,64 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
- #
4
- # Reference: https://github.com/stompgem/stomp/wiki/extended-ssl-overview
5
- #
6
- if Kernel.respond_to?(:require_relative)
7
- require_relative("./ssl_common")
8
- else
9
- $LOAD_PATH << File.dirname(__FILE__)
10
- require "ssl_common"
11
- end
12
- include SSLCommon
13
- #
14
- # == SSL Use Case 3 - User Supplied Ciphers
15
- #
16
- # If you need your own ciphers list, this is how.
17
- # Stomp's default list will work in many cases. If you need to use this, you
18
- # will know it because SSL connect will fail. In that case, determining
19
- # _what_ should be in the list is your responsibility.
20
- #
21
- class ExampleSSL3C
22
- # Initialize.
23
- def initialize # Change the following as needed.
24
- @host = ENV['STOMP_HOST'] ? ENV['STOMP_HOST'] : "localhost"
25
- @port = ENV['STOMP_PORT'] ? ENV['STOMP_PORT'].to_i : 61612
26
- end
27
- # Run example.
28
- def run
29
- 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], ["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]]
30
- #
31
- # SSL Use Case 3
32
- #
33
- # Possibly change the cert file(s) name(s) here.
34
- ssl_opts = Stomp::SSLParams.new(
35
- :key_file => "#{cli_loc()}/#{pck()}", # the client's private key, private data
36
- :cert_file => "#{cli_loc()}/#{cli_cert()}", # the client's signed certificate
37
- :fsck => true # Check that the files exist first
38
- )
39
- #
40
- hash = { :hosts => [
41
- {:login => 'guest', :passcode => 'guest', :host => @host, :port => @port, :ssl => ssl_opts},
42
- ],
43
- :reliable => false, # YMMV, to test this in a sane manner
44
- }
45
- #
46
- puts "Connect starts, SSL Use Case 3"
47
- c = Stomp::Connection.new(hash)
48
- puts "Connect completed"
49
- puts "SSL Verify Result: #{ssl_opts.verify_result}"
50
- # puts "SSL Peer Certificate:\n#{ssl_opts.peer_cert}"
51
- c.disconnect
52
- end
53
-
54
- private
55
-
56
- def pck()
57
- "client.key"
58
- end
59
-
60
- end
61
- #
62
- e = ExampleSSL3C.new
63
- e.run
64
-
@@ -1,65 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
- #
4
- # Reference: https://github.com/stompgem/stomp/wiki/extended-ssl-overview
5
- #
6
- if Kernel.respond_to?(:require_relative)
7
- require_relative("./ssl_common")
8
- else
9
- $LOAD_PATH << File.dirname(__FILE__)
10
- require "ssl_common"
11
- end
12
- include SSLCommon
13
- #
14
- # == SSL Use Case 4 - User Supplied Ciphers
15
- #
16
- # If you need your own ciphers list, this is how.
17
- # Stomp's default list will work in many cases. If you need to use this, you
18
- # will know it because SSL connect will fail. In that case, determining
19
- # _what_ should be in the list is your responsibility.
20
- #
21
- class ExampleSSL4C
22
- # Initialize.
23
- def initialize # Change the following as needed.
24
- @host = ENV['STOMP_HOST'] ? ENV['STOMP_HOST'] : "localhost"
25
- @port = ENV['STOMP_PORT'] ? ENV['STOMP_PORT'].to_i : 61612
26
- end
27
- # Run example.
28
- def run
29
- 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], ["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]]
30
- #
31
- # SSL Use Case 4
32
- #
33
- # Possibly change the cert file(s) name(s) here.
34
- ssl_opts = Stomp::SSLParams.new(
35
- :key_file => "#{cli_loc()}/#{pck()}", # the client's private key, private data
36
- :cert_file => "#{cli_loc()}/#{cli_cert()}", # the client's signed certificate
37
- :ts_files => "#{ca_loc()}/#{ca_cert()}", # The CA's signed sertificate
38
- :fsck => true # Check that files exist first
39
- )
40
- #
41
- hash = { :hosts => [
42
- {:login => 'guest', :passcode => 'guest', :host => @host, :port => @port, :ssl => ssl_opts},
43
- ],
44
- :reliable => false, # YMMV, to test this in a sane manner
45
- }
46
- #
47
- puts "Connect starts, SSL Use Case 4"
48
- c = Stomp::Connection.new(hash)
49
- puts "Connect completed"
50
- puts "SSL Verify Result: #{ssl_opts.verify_result}"
51
- # puts "SSL Peer Certificate:\n#{ssl_opts.peer_cert}"
52
- c.disconnect
53
- end
54
-
55
- private
56
-
57
- def pck()
58
- "client.key"
59
- end
60
-
61
- end
62
- #
63
- e = ExampleSSL4C.new
64
- e.run
65
-
@@ -1,41 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
- #
4
- # Reference: https://github.com/stompgem/stomp/wiki/extended-ssl-overview
5
- #
6
- require "rubygems"
7
- require "stomp"
8
- #
9
- # == Example: Use Ruby Supplied Ciphers
10
- #
11
- # If you use SSLParams, and need the _default_ Ruby ciphers, this is how.
12
- #
13
- # NOTE: JRuby users may find that this is a *required* action. YMMV.
14
- #
15
- class ExampleRubyCiphers
16
- # Initialize.
17
- def initialize
18
- end
19
- # Run example.
20
- def run
21
- ssl_opts = Stomp::SSLParams.new(:use_ruby_ciphers => true) # Plus other parameters as needed
22
- #
23
- # SSL Use Case: Using default Stomp ciphers
24
- #
25
- hash = { :hosts => [
26
- {:login => 'guest', :passcode => 'guest', :host => 'localhost',
27
- :port => 61612, :ssl => ssl_opts},
28
- ]
29
- }
30
- #
31
- puts "Connect starts, SSL , Use Default Ruby Ciphers"
32
- c = Stomp::Connection.new(hash)
33
- puts "Connect completed"
34
- #
35
- c.disconnect
36
- end
37
- end
38
- #
39
- e = ExampleRubyCiphers.new
40
- e.run
41
-
@@ -1,54 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
- #
4
- # Common Stomp 1.1 code.
5
- #
6
- require "rubygems" if RUBY_VERSION < "1.9"
7
- require "stomp"
8
- #
9
- module Stomp11Common
10
- # User id
11
- def login()
12
- ENV['STOMP_USER'] || 'guest'
13
- end
14
- # Password
15
- def passcode()
16
- ENV['STOMP_PASSCODE'] || 'guest'
17
- end
18
- # Server host
19
- def host()
20
- ENV['STOMP_HOST'] || "localhost" # The connect host name
21
- end
22
- # Server port
23
- def port()
24
- (ENV['STOMP_PORT'] || 61613).to_i # !! The author runs AMQ listening here
25
- end
26
- # Required vhost name
27
- def virt_host()
28
- ENV['STOMP_VHOST'] || "localhost" # The 1.1 virtual host name
29
- end
30
- # Create a 1.1 commection
31
- def get_connection()
32
- conn_hdrs = {"accept-version" => "1.1", # 1.1 only
33
- "host" => virt_host, # the vhost
34
- }
35
- conn_hash = { :hosts => [
36
- {:login => login, :passcode => passcode, :host => host, :port => port},
37
- ],
38
- :connect_headers => conn_hdrs,
39
- }
40
- conn = Stomp::Connection.new(conn_hash)
41
- end
42
-
43
- # Number of messages
44
- def nmsgs()
45
- (ENV['STOMP_NMSGS'] || 1).to_i # Number of messages
46
- end
47
-
48
- # Include "suppress-content-length' header
49
- def suppresscl()
50
- ENV['STOMP_SUPPRESS_CL']
51
- end
52
-
53
- end
54
-