bunny 3.2.0 → 3.4.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 712a18cac951945d52173bb1222fc7f31db91caa07b38ab70939f0d82ba16716
4
- data.tar.gz: 545adc41e89744dcf9b28737e174f3006f61f5d174e157a74441e60d34bbeb62
3
+ metadata.gz: ca20b85fa97e5dfdf990bf45cbf000331d413a9aff294c121a788d7883a053bd
4
+ data.tar.gz: 69f78dded2ac65e651ba70baab933119b9cd80663a1bc0d5dae52767d01dae5c
5
5
  SHA512:
6
- metadata.gz: 15b48abb0e61c6dd1d19bfa3e1c9135315106bf1e9da78ce619c7fcab665b2d462747abe3f1bd8b2a3cc16530c58b10cf882c6c547b1cf0cc03a235c700f8087
7
- data.tar.gz: fcdaef2f5bda1df881f7c6ba27ded1c591fd7c0b77ec816ce45b8554220062183918af19224d216cd50e0bc613bfae6add49b976232ba05d7d672a0dc92d509c
6
+ metadata.gz: 2b6bb72790ce461357e9934be10ae6a1b1d07744d835bed51c1add5502bbf4710ff9cc16e87e4b685b0fe31a9a8bd932dc00c6d9795cfc3f03ca6b03df6b0e40
7
+ data.tar.gz: 53978c476c2e712a4e624765fcd66ce5d4dd8cc99eeb364a244f26990d303ea3600d394db130db949040f0a76c59fc76657f6c2a714bb26bc45f84229c1cc5bb
data/ChangeLog.md CHANGED
@@ -1,3 +1,57 @@
1
+ ## Changes between Bunny 3.3.0 and 3.4.0 (Sep 18, 2026)
2
+
3
+ ### Ruby 3.2 or Later Is Now Required
4
+
5
+ `required_ruby_version` was raised from `3.0` to `3.2`.
6
+
7
+ Ruby `3.0` and `3.1` have reached end of life and are no longer tested against.
8
+
9
+
10
+ ### Client Certificate Chains
11
+
12
+ If `tls_cert` points at a certificate bundle (chain), the entire chain will now be sent.
13
+
14
+ Previously only the first (leaf) certificate was sent, unintentionally.
15
+
16
+ Contributed by @eglitobias.
17
+
18
+ GitHub issues: [#749](https://github.com/ruby-amqp/bunny/issues/749), [#750](https://github.com/ruby-amqp/bunny/pull/750)
19
+
20
+
21
+ ### TLS Handshake Now Respects `connect_timeout`
22
+
23
+ A peer that accepted the TCP connection but never completed the TLS handshake
24
+ could block `Bunny::Session#start` indefinitely. The handshake now gives up after
25
+ `connect_timeout` and the connection fails over to the next endpoint.
26
+
27
+ This requires the `openssl` gem `3.3.0` or later.
28
+
29
+
30
+ ## Changes between Bunny 3.2.0 and 3.3.0 (Aug 29, 2026)
31
+
32
+ ### Passive Declarations No Longer Affect Topology Recovery
33
+
34
+ `Bunny::Channel#queue` and `Bunny::Channel#exchange` recorded passively declared
35
+ queues and exchanges for topology recovery by mistake. Passive declares are just
36
+ existence checks and should not be replayed by topology recovery.
37
+
38
+ `Bunny::Session#queue_exists?` and `Bunny::Session#exchange_exists?` were affected
39
+ in the same way, since both are implemented using passive declarations.
40
+
41
+ ### Queue Recovery Recorded `exclusive` and `auto_delete` in Reverse
42
+
43
+ `Bunny::Channel#queue_declare` passed the `exclusive` and `auto_delete` properties
44
+ to the topology registry in the wrong order, so a queue that used one but not the
45
+ other was recovered with both properties flipped.
46
+
47
+
48
+ ### `amq-protocol` Bump to `2.9.0`
49
+
50
+ [`2.9.0` release notes](https://github.com/ruby-amqp/amq-protocol/releases/tag/v2.9.0).
51
+
52
+ This version requires Ruby `3.2.0` or later.
53
+
54
+
1
55
  ## Changes between Bunny 3.1.0 and 3.2.0 (Aug 19, 2026)
2
56
 
3
57
  ### Modernization for Ruby 3.x
data/lib/bunny/channel.rb CHANGED
@@ -523,7 +523,7 @@ module Bunny
523
523
 
524
524
  q = find_queue(name) || Bunny::Queue.new(self, name, opts)
525
525
 
526
- record_queue(q)
526
+ record_queue(q) unless opts[:passive]
527
527
  register_queue(q)
528
528
  end
529
529
 
@@ -1352,7 +1352,7 @@ module Bunny
1352
1352
  args = opts[:arguments]
1353
1353
 
1354
1354
  result = self.queue_declare_without_recording_topology(name, opts)
1355
- self.record_queue_with(self, result.queue, is_server_named, durable, exclusive, auto_delete, args) unless passive
1355
+ self.record_queue_with(self, result.queue, is_server_named, durable, auto_delete, exclusive, args) unless passive
1356
1356
 
1357
1357
  result
1358
1358
  end
@@ -108,8 +108,9 @@ module Bunny
108
108
 
109
109
  # for basic.return dispatch and such
110
110
  @channel.register_exchange(self)
111
- # for topology recovery
112
- @channel.record_exchange(self)
111
+ # for topology recovery. A passive declaration does not own the exchange,
112
+ # so it must not overwrite what was recorded for it earlier
113
+ @channel.record_exchange(self) unless @options[:passive]
113
114
  end
114
115
 
115
116
  # @return [Boolean] true if this exchange was declared as durable (will survive broker restart).
data/lib/bunny/queue.rb CHANGED
@@ -91,8 +91,9 @@ module Bunny
91
91
 
92
92
  # for basic.deliver dispatch and such
93
93
  @channel.register_queue(self)
94
- # for topology recovery
95
- @channel.record_queue(self)
94
+ # for topology recovery. A passive declaration does not own the queue,
95
+ # so it must not overwrite what was recorded for it earlier
96
+ @channel.record_queue(self) unless @options[:passive]
96
97
  end
97
98
 
98
99
  # @return [Boolean] true if this queue was declared as durable (will survive broker restart).
@@ -108,7 +108,12 @@ module Bunny
108
108
  def connect
109
109
  if uses_tls?
110
110
  begin
111
- @socket.connect
111
+ tls_handshake
112
+ rescue ClientTimeout => e
113
+ @logger.error { "TLS connection failed: #{e.message}" }
114
+ close
115
+ @status = :not_connected
116
+ raise Bunny::TCPConnectionFailed.new(e, self.hostname, self.port)
112
117
  rescue OpenSSL::SSL::SSLError => e
113
118
  @logger.error { "TLS connection failed: #{e.message}" }
114
119
  raise e
@@ -335,6 +340,17 @@ module Bunny
335
340
  @socket
336
341
  end
337
342
 
343
+ # Needs the openssl gem >= 3.3, which added SSLSocket#timeout= and made #connect honour it
344
+ def tls_handshake
345
+ previous_timeout = @socket.timeout
346
+ @socket.timeout = @connect_timeout if @connect_timeout
347
+ @socket.connect
348
+ rescue IO::TimeoutError
349
+ raise ClientTimeout, "TLS handshake timed out after #{@connect_timeout} seconds"
350
+ ensure
351
+ @socket.timeout = previous_timeout
352
+ end
353
+
338
354
  def maybe_initialize_socket
339
355
  initialize_socket if !@socket || closed?
340
356
  end
@@ -481,7 +497,12 @@ module Bunny
481
497
  end
482
498
 
483
499
  def initialize_tls_context(ctx, opts = {})
484
- ctx.cert = OpenSSL::X509::Certificate.new(@tls_certificate) if @tls_certificate
500
+ if @tls_certificate
501
+ leaf, *chain = OpenSSL::X509::Certificate.load(@tls_certificate)
502
+
503
+ ctx.cert = leaf
504
+ ctx.extra_chain_cert = chain unless chain.empty?
505
+ end
485
506
  ctx.key = OpenSSL::PKey.read(@tls_key) if @tls_key
486
507
  ctx.cert_store = if @tls_certificate_store
487
508
  @tls_certificate_store
data/lib/bunny/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Bunny
4
4
  # @return [String] Version of the library
5
- VERSION = "3.2.0"
5
+ VERSION = "3.4.0"
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bunny
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.0
4
+ version: 3.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Duncan
@@ -19,14 +19,14 @@ dependencies:
19
19
  requirements:
20
20
  - - "~>"
21
21
  - !ruby/object:Gem::Version
22
- version: '2.8'
22
+ version: '2.9'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - "~>"
28
28
  - !ruby/object:Gem::Version
29
- version: '2.8'
29
+ version: '2.9'
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: logger
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -47,6 +47,20 @@ dependencies:
47
47
  - - ">="
48
48
  - !ruby/object:Gem::Version
49
49
  version: '1.7'
50
+ - !ruby/object:Gem::Dependency
51
+ name: openssl
52
+ requirement: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: '3.3'
57
+ type: :runtime
58
+ prerelease: false
59
+ version_requirements: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: '3.3'
50
64
  - !ruby/object:Gem::Dependency
51
65
  name: sorted_set
52
66
  requirement: !ruby/object:Gem::Requirement
@@ -129,14 +143,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
129
143
  requirements:
130
144
  - - ">="
131
145
  - !ruby/object:Gem::Version
132
- version: '3.0'
146
+ version: '3.2'
133
147
  required_rubygems_version: !ruby/object:Gem::Requirement
134
148
  requirements:
135
149
  - - ">="
136
150
  - !ruby/object:Gem::Version
137
151
  version: '0'
138
152
  requirements: []
139
- rubygems_version: 3.6.9
153
+ rubygems_version: 4.0.16
140
154
  specification_version: 4
141
155
  summary: Popular easy to use Ruby client for RabbitMQ
142
156
  test_files: []