amq-protocol 2.3.2 → 2.3.4

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: c3952d1aea112b833a87bc1dc5f4a48b30b3203cc6916ea94e6489a233e4f07e
4
- data.tar.gz: a9c2c60ac42dfbf18fcfc9c91ab146c5db2501c51ab96047129f0d3e17c6d51d
3
+ metadata.gz: 90852fae30dd15d9f1f6ee5f9c0d98e856c3efcbd4c11e7e824caf63a01360f7
4
+ data.tar.gz: a000c7b2f435fc08f2d9c90a765f81e0414ca1c3038fcab1915ff7bcd4bdb929
5
5
  SHA512:
6
- metadata.gz: 2e20cc9579e2fd2d6750d0ca1201786ab73635a21d5783ef2f14a115dbcfe524b3561abd7a835c0f925c638c5164f72139a717b0c43b1303470295d3fa06494c
7
- data.tar.gz: da6ecba234868b2a2bd5035cb1df2f5687e8b58e886f64bd1b99530419767ce53f30c6f89ec11395e91d163fbe5ee2e1a54dd3686735d6a51bf936b85f93bda0
6
+ metadata.gz: 718a613e5a2355791ef4d07bd38676b005cb00cd54969183a31eeba96cc3439ba223a8d9636050aa9aaf2ac5ca63150d3e3c53ce3e4638b53191097183b47ba3
7
+ data.tar.gz: 598de750f0c0ba6c838f4d1f34b4fb24f05b0a580c6b8beb7804d4edae437c628c18ac56d8ef87afc78ad56876ca4baafcf051f90f1eea9bb0cf3d48e993ea66
@@ -0,0 +1,18 @@
1
+ ## Does This Really Belong to GitHub issues?
2
+
3
+ If you find a bug you understand well, poor default, incorrect or unclear piece of documentation,
4
+ or missing feature, please [file an
5
+ issue](http://github.com/ruby-amqp/bunny/issues) on GitHub.
6
+
7
+ Please use [Bunny's mailing list](http://groups.google.com/group/ruby-amqp) for questions,
8
+ investigations, and discussions. GitHub issues should be used for specific, well understood, actionable
9
+ maintainers and contributors can work on.
10
+
11
+ When filing an issue, please specify
12
+
13
+ * Which Bunny and RabbitMQ versions are used
14
+ * Recent RabbitMQ log file contents
15
+ * Full exception stack traces
16
+ * Steps to reproduce or a failing test case
17
+
18
+ This would greatly help the maintainers help you.
@@ -0,0 +1,31 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - "main"
7
+ pull_request:
8
+ branches:
9
+ - "main"
10
+
11
+ jobs:
12
+ test:
13
+ runs-on: ubuntu-latest
14
+
15
+ strategy:
16
+ matrix:
17
+ ruby-version:
18
+ - "3.4.2"
19
+ - "3.3.7"
20
+ - "3.2.7"
21
+
22
+ steps:
23
+ - uses: actions/checkout@v4
24
+ - name: Set up Ruby ${{ matrix.ruby-version }}
25
+ uses: ruby/setup-ruby@v1
26
+ with:
27
+ ruby-version: ${{ matrix.ruby-version }}
28
+ - name: Install dependencies
29
+ run: bundle install
30
+ - name: Run tests
31
+ run: bundle exec rspec -c
data/ChangeLog.md CHANGED
@@ -1,7 +1,32 @@
1
- ## Changes between 2.3.2 and 2.3.3 (unreleased)
1
+ ## Changes between 2.3.4 and 2.3.5 (in development)
2
2
 
3
3
  No changes yet.
4
4
 
5
+
6
+ ## Changes between 2.3.3 and 2.3.4 (May 12, 2025)
7
+
8
+ ### (Forward) Compatibility with Ruby 3.5
9
+
10
+ Contributed by @Earlopain.
11
+
12
+ GitHub issue: [#80](https://github.com/ruby-amqp/amq-protocol/pull/80)
13
+
14
+
15
+ ## Changes between 2.3.2 and 2.3.3 (February 17, 2025)
16
+
17
+ ### Improved Compatibility with Ruby 3.4
18
+
19
+ Contribiuted by @BenTalagan.
20
+
21
+ GitHub issue: [#79](https://github.com/ruby-amqp/amq-protocol/pull/79)
22
+
23
+ ### Support Binary-Encoded Frozen Strings for Payloads
24
+
25
+ Contribiuted by @djrodgerspryor.
26
+
27
+ GitHub issue: [#78](https://github.com/ruby-amqp/amq-protocol/pull/78)
28
+
29
+
5
30
  ## Changes between 2.3.1 and 2.3.2 (July 10th, 2020)
6
31
 
7
32
  ### Safer Encoding Handling When Serialising Message Properties and Headers
data/Gemfile CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
+
5
6
  group :development do
6
7
  # excludes Windows, Rubinius and JRuby
7
8
  gem "ruby-prof", :platforms => [:mri_19, :mri_20, :mri_21]
@@ -13,6 +14,7 @@ group :test do
13
14
  gem "rspec", ">= 3.8.0"
14
15
  gem "rspec-its"
15
16
  gem "simplecov"
17
+ gem 'bigdecimal'
16
18
  end
17
19
 
18
20
  group :development, :test do
@@ -1,5 +1,6 @@
1
1
  # encoding: utf-8
2
2
  # encoding: binary
3
+ # frozen_string_literal: true
3
4
 
4
5
  # THIS IS AN AUTOGENERATED FILE, DO NOT MODIFY
5
6
  # IT DIRECTLY ! FOR CHANGES, PLEASE UPDATE FILES
@@ -142,7 +143,7 @@ module AMQ
142
143
  % for f in klass.fields:
143
144
  # <% i = klass.fields.index(f) %>1 << ${15 - i}
144
145
  def self.encode_${f.ruby_name}(value)
145
- buffer = ''
146
+ buffer = +''
146
147
  % for line in helpers.genSingleEncode(spec, "value", f.domain):
147
148
  ${line}
148
149
  % endfor
@@ -1,4 +1,5 @@
1
1
  # encoding: binary
2
+ # frozen_string_literal: true
2
3
 
3
4
  # THIS IS AN AUTOGENERATED FILE, DO NOT MODIFY
4
5
  # IT DIRECTLY ! FOR CHANGES, PLEASE UPDATE FILES
@@ -174,7 +175,7 @@ module AMQ
174
175
 
175
176
  # Otherwise String#slice on 1.9 will operate with code points,
176
177
  # and we need bytes. MK.
177
- body.force_encoding("ASCII-8BIT") if RUBY_VERSION.to_f >= 1.9
178
+ body.force_encoding("ASCII-8BIT") if RUBY_VERSION.to_f >= 1.9 && body.encoding != Encoding::BINARY
178
179
 
179
180
  array = Array.new
180
181
  while body && !body.empty?
@@ -1389,7 +1390,7 @@ module AMQ
1389
1390
 
1390
1391
  # 1 << 15
1391
1392
  def self.encode_content_type(value)
1392
- buffer = ''
1393
+ buffer = +''
1393
1394
  buffer << value.to_s.bytesize.chr
1394
1395
  buffer << value.to_s
1395
1396
  [0, 0x8000, buffer]
@@ -1397,7 +1398,7 @@ module AMQ
1397
1398
 
1398
1399
  # 1 << 14
1399
1400
  def self.encode_content_encoding(value)
1400
- buffer = ''
1401
+ buffer = +''
1401
1402
  buffer << value.to_s.bytesize.chr
1402
1403
  buffer << value.to_s
1403
1404
  [1, 0x4000, buffer]
@@ -1405,28 +1406,28 @@ module AMQ
1405
1406
 
1406
1407
  # 1 << 13
1407
1408
  def self.encode_headers(value)
1408
- buffer = ''
1409
+ buffer = +''
1409
1410
  buffer << AMQ::Protocol::Table.encode(value)
1410
1411
  [2, 0x2000, buffer]
1411
1412
  end
1412
1413
 
1413
1414
  # 1 << 12
1414
1415
  def self.encode_delivery_mode(value)
1415
- buffer = ''
1416
+ buffer = +''
1416
1417
  buffer << [value].pack(PACK_CHAR)
1417
1418
  [3, 0x1000, buffer]
1418
1419
  end
1419
1420
 
1420
1421
  # 1 << 11
1421
1422
  def self.encode_priority(value)
1422
- buffer = ''
1423
+ buffer = +''
1423
1424
  buffer << [value].pack(PACK_CHAR)
1424
1425
  [4, 0x0800, buffer]
1425
1426
  end
1426
1427
 
1427
1428
  # 1 << 10
1428
1429
  def self.encode_correlation_id(value)
1429
- buffer = ''
1430
+ buffer = +''
1430
1431
  buffer << value.to_s.bytesize.chr
1431
1432
  buffer << value.to_s
1432
1433
  [5, 0x0400, buffer]
@@ -1434,7 +1435,7 @@ module AMQ
1434
1435
 
1435
1436
  # 1 << 9
1436
1437
  def self.encode_reply_to(value)
1437
- buffer = ''
1438
+ buffer = +''
1438
1439
  buffer << value.to_s.bytesize.chr
1439
1440
  buffer << value.to_s
1440
1441
  [6, 0x0200, buffer]
@@ -1442,7 +1443,7 @@ module AMQ
1442
1443
 
1443
1444
  # 1 << 8
1444
1445
  def self.encode_expiration(value)
1445
- buffer = ''
1446
+ buffer = +''
1446
1447
  buffer << value.to_s.bytesize.chr
1447
1448
  buffer << value.to_s
1448
1449
  [7, 0x0100, buffer]
@@ -1450,7 +1451,7 @@ module AMQ
1450
1451
 
1451
1452
  # 1 << 7
1452
1453
  def self.encode_message_id(value)
1453
- buffer = ''
1454
+ buffer = +''
1454
1455
  buffer << value.to_s.bytesize.chr
1455
1456
  buffer << value.to_s
1456
1457
  [8, 0x0080, buffer]
@@ -1458,14 +1459,14 @@ module AMQ
1458
1459
 
1459
1460
  # 1 << 6
1460
1461
  def self.encode_timestamp(value)
1461
- buffer = ''
1462
+ buffer = +''
1462
1463
  buffer << AMQ::Pack.pack_uint64_big_endian(value)
1463
1464
  [9, 0x0040, buffer]
1464
1465
  end
1465
1466
 
1466
1467
  # 1 << 5
1467
1468
  def self.encode_type(value)
1468
- buffer = ''
1469
+ buffer = +''
1469
1470
  buffer << value.to_s.bytesize.chr
1470
1471
  buffer << value.to_s
1471
1472
  [10, 0x0020, buffer]
@@ -1473,7 +1474,7 @@ module AMQ
1473
1474
 
1474
1475
  # 1 << 4
1475
1476
  def self.encode_user_id(value)
1476
- buffer = ''
1477
+ buffer = +''
1477
1478
  buffer << value.to_s.bytesize.chr
1478
1479
  buffer << value.to_s
1479
1480
  [11, 0x0010, buffer]
@@ -1481,7 +1482,7 @@ module AMQ
1481
1482
 
1482
1483
  # 1 << 3
1483
1484
  def self.encode_app_id(value)
1484
- buffer = ''
1485
+ buffer = +''
1485
1486
  buffer << value.to_s.bytesize.chr
1486
1487
  buffer << value.to_s
1487
1488
  [12, 0x0008, buffer]
@@ -1489,7 +1490,7 @@ module AMQ
1489
1490
 
1490
1491
  # 1 << 2
1491
1492
  def self.encode_cluster_id(value)
1492
- buffer = ''
1493
+ buffer = +''
1493
1494
  buffer << value.to_s.bytesize.chr
1494
1495
  buffer << value.to_s
1495
1496
  [13, 0x0004, buffer]
@@ -1,5 +1,5 @@
1
1
  module AMQ
2
2
  module Protocol
3
- VERSION = "2.3.2"
3
+ VERSION = "2.3.4"
4
4
  end # Protocol
5
5
  end # AMQ
data/lib/amq/uri.rb CHANGED
@@ -1,6 +1,10 @@
1
1
  # encoding: utf-8
2
2
 
3
- require "cgi"
3
+ if RUBY_VERSION < "3.5"
4
+ require "cgi/util"
5
+ else
6
+ require "cgi/escape"
7
+ end
4
8
  require "uri"
5
9
 
6
10
  module AMQ
@@ -34,7 +38,7 @@ module AMQ
34
38
  opts[:scheme] = uri.scheme
35
39
  opts[:user] = ::CGI::unescape(uri.user) if uri.user
36
40
  opts[:pass] = ::CGI::unescape(uri.password) if uri.password
37
- opts[:host] = uri.host if uri.host
41
+ opts[:host] = uri.host if uri.host and uri.host != ""
38
42
  opts[:port] = uri.port || AMQP_DEFAULT_PORTS[uri.scheme]
39
43
  opts[:ssl] = uri.scheme.to_s.downcase =~ /amqps/i # TODO: rename to tls
40
44
  if uri.path =~ %r{^/(.*)}
@@ -43,28 +47,33 @@ module AMQ
43
47
  end
44
48
 
45
49
  if uri.query
46
- query_params = CGI::parse(uri.query)
47
-
48
- normalized_query_params = Hash[query_params.map { |param, value| [param, value.one? ? value.first : value] }]
50
+ query_params = Hash.new { |hash, key| hash[key] = [] }
51
+ ::URI.decode_www_form(uri.query).each do |key, value|
52
+ query_params[key] << value
53
+ end
54
+ query_params.each do |key, value|
55
+ query_params[key] = value.one? ? value.first : value
56
+ end
57
+ query_params.default = nil
49
58
 
50
- opts[:heartbeat] = normalized_query_params["heartbeat"].to_i
51
- opts[:connection_timeout] = normalized_query_params["connection_timeout"].to_i
52
- opts[:channel_max] = normalized_query_params["channel_max"].to_i
53
- opts[:auth_mechanism] = normalized_query_params["auth_mechanism"]
59
+ opts[:heartbeat] = query_params["heartbeat"].to_i
60
+ opts[:connection_timeout] = query_params["connection_timeout"].to_i
61
+ opts[:channel_max] = query_params["channel_max"].to_i
62
+ opts[:auth_mechanism] = query_params["auth_mechanism"]
54
63
 
55
64
  %w(cacertfile certfile keyfile).each do |tls_option|
56
- if normalized_query_params[tls_option] && uri.scheme == "amqp"
65
+ if query_params[tls_option] && uri.scheme == "amqp"
57
66
  raise ArgumentError.new("The option '#{tls_option}' can only be used in URIs that use amqps schema")
58
67
  else
59
- opts[tls_option.to_sym] = normalized_query_params[tls_option]
68
+ opts[tls_option.to_sym] = query_params[tls_option]
60
69
  end
61
70
  end
62
71
 
63
72
  %w(verify fail_if_no_peer_cert).each do |tls_option|
64
- if normalized_query_params[tls_option] && uri.scheme == "amqp"
73
+ if query_params[tls_option] && uri.scheme == "amqp"
65
74
  raise ArgumentError.new("The option '#{tls_option}' can only be used in URIs that use amqps schema")
66
75
  else
67
- opts[tls_option.to_sym] = as_boolean(normalized_query_params[tls_option])
76
+ opts[tls_option.to_sym] = as_boolean(query_params[tls_option])
68
77
  end
69
78
  end
70
79
  end
@@ -80,7 +89,7 @@ module AMQ
80
89
  # Implementation
81
90
  #
82
91
 
83
- # Normalizes values returned by CGI.parse.
92
+ # Normalizes values returned by URI.decode_www_form.
84
93
  # @private
85
94
  def self.as_boolean(val)
86
95
  case val
@@ -1,4 +1,3 @@
1
- require 'bigdecimal'
2
1
  require 'time'
3
2
 
4
3
  module AMQ
@@ -30,7 +30,7 @@ RSpec.describe AMQ::URI do
30
30
  let(:uri) { "amqp://" }
31
31
 
32
32
  # Note that according to the ABNF, the host component may not be absent, but it may be zero-length.
33
- it "falls back to default nil host" do
33
+ it "falls back to a blank value" do
34
34
  expect(subject[:host]).to be_nil
35
35
  end
36
36
  end
metadata CHANGED
@@ -1,17 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: amq-protocol
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.2
4
+ version: 2.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jakub Stastny
8
8
  - Michael S. Klishin
9
9
  - Theo Hultberg
10
10
  - Mark Abramov
11
- autorequire:
12
11
  bindir: bin
13
12
  cert_chain: []
14
- date: 2020-07-10 00:00:00.000000000 Z
13
+ date: 2025-05-12 00:00:00.000000000 Z
15
14
  dependencies: []
16
15
  description: |2
17
16
  amq-protocol is an AMQP 0.9.1 serialization library for Ruby. It is not a
@@ -23,6 +22,8 @@ extensions: []
23
22
  extra_rdoc_files:
24
23
  - README.md
25
24
  files:
25
+ - ".github/ISSUE_TEMPLATE.md"
26
+ - ".github/workflows/ci.yml"
26
27
  - ".gitignore"
27
28
  - ".gitmodules"
28
29
  - ".rspec"
@@ -86,7 +87,6 @@ homepage: http://github.com/ruby-amqp/amq-protocol
86
87
  licenses:
87
88
  - MIT
88
89
  metadata: {}
89
- post_install_message:
90
90
  rdoc_options: []
91
91
  require_paths:
92
92
  - lib
@@ -101,8 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
101
101
  - !ruby/object:Gem::Version
102
102
  version: '0'
103
103
  requirements: []
104
- rubygems_version: 3.1.2
105
- signing_key:
104
+ rubygems_version: 3.6.2
106
105
  specification_version: 4
107
106
  summary: AMQP 0.9.1 encoding & decoding library.
108
107
  test_files: []