amq-protocol 2.3.1 → 2.3.2

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: a7af862c42e7a7b3219c0f4eb107905aeeb8d88482c9b2463cfa40ee60aaffd5
4
- data.tar.gz: d8e09e77cf744c2ee8975882b2bb624834abc58f48b91f6be9e65eecb1f148a5
3
+ metadata.gz: c3952d1aea112b833a87bc1dc5f4a48b30b3203cc6916ea94e6489a233e4f07e
4
+ data.tar.gz: a9c2c60ac42dfbf18fcfc9c91ab146c5db2501c51ab96047129f0d3e17c6d51d
5
5
  SHA512:
6
- metadata.gz: 6d3bdfaaaa6f26bc1bbc222f2a69a3ef23fbcbd8bbba097e70bbcbf6c25156c8dc2dea83f689c68e18f065691034c8e6d06d2a11fa2ebc9f5b12340a0b43c747
7
- data.tar.gz: bd5f3501992a8aae522d160581b276e4f87df77613a13bafc5de13c9e5b229d79b41054b1f060ac91d9dc9fac72a8512453f3ce3d5cb7a2b56dc3a73209cb818
6
+ metadata.gz: 2e20cc9579e2fd2d6750d0ca1201786ab73635a21d5783ef2f14a115dbcfe524b3561abd7a835c0f925c638c5164f72139a717b0c43b1303470295d3fa06494c
7
+ data.tar.gz: da6ecba234868b2a2bd5035cb1df2f5687e8b58e886f64bd1b99530419767ce53f30c6f89ec11395e91d163fbe5ee2e1a54dd3686735d6a51bf936b85f93bda0
@@ -1,7 +1,15 @@
1
- ## Changes between 2.3.1 and 2.3.2 (unreleased)
1
+ ## Changes between 2.3.2 and 2.3.3 (unreleased)
2
2
 
3
3
  No changes yet.
4
4
 
5
+ ## Changes between 2.3.1 and 2.3.2 (July 10th, 2020)
6
+
7
+ ### Safer Encoding Handling When Serialising Message Properties and Headers
8
+
9
+ Contributed by @bbascarevic-tti.
10
+
11
+ GitHub issue: [ruby-amqp/amq-protocol#76](https://github.com/ruby-amqp/amq-protocol/issues/76)
12
+
5
13
 
6
14
  ## Changes between 2.3.0 and 2.3.1 (April 8th, 2020)
7
15
 
@@ -27,12 +27,12 @@ module AMQ
27
27
  when String then
28
28
  accumulator << TYPE_STRING
29
29
  accumulator << [value.bytesize].pack(PACK_UINT32)
30
- accumulator << value
30
+ accumulator << value.dup.force_encoding(accumulator.encoding)
31
31
  when Symbol then
32
32
  str = value.to_s
33
33
  accumulator << TYPE_STRING
34
34
  accumulator << [str.bytesize].pack(PACK_UINT32)
35
- accumulator << str
35
+ accumulator << str.force_encoding(accumulator.encoding)
36
36
  when Integer then
37
37
  accumulator << TYPE_SIGNED_64BIT
38
38
  accumulator << [value].pack(PACK_INT64_BE)
@@ -1,5 +1,5 @@
1
1
  module AMQ
2
2
  module Protocol
3
- VERSION = "2.3.1"
3
+ VERSION = "2.3.2"
4
4
  end # Protocol
5
5
  end # AMQ
@@ -46,6 +46,16 @@ module AMQ
46
46
  to eql("\x00\x00\x00$\vcoordinatesF\x00\x00\x00\x13\tlongituded@2\x11\x11\x16\xA8\xB8\xF1".force_encoding(Encoding::ASCII_8BIT))
47
47
  end
48
48
 
49
+ it "should serialize long UTF-8 strings and symbols" do
50
+ long_utf8 = "à" * 192
51
+ long_ascii8 = long_utf8.dup.force_encoding(::Encoding::ASCII_8BIT)
52
+
53
+ input = { "utf8_string" => long_utf8, "utf8_symbol" => long_utf8.to_sym }
54
+ output = { "utf8_string" => long_ascii8, "utf8_symbol" => long_ascii8 }
55
+
56
+ expect(Table.decode(Table.encode(input))).to eq(output)
57
+ end
58
+
49
59
  DATA.each do |data, encoded|
50
60
  it "should return #{encoded.inspect} for #{data.inspect}" do
51
61
  expect(Table.encode(data)).to eql(encoded.force_encoding(Encoding::ASCII_8BIT))
@@ -204,7 +214,7 @@ module AMQ
204
214
  "rev" => 1.0,
205
215
  "spec" => {
206
216
  "url" => "http://bit.ly/hw2ELX",
207
- "utf8" => "à bientôt".force_encoding(::Encoding::ASCII_8BIT)
217
+ "utf8" => "à bientôt"
208
218
  }
209
219
  },
210
220
  "true" => true,
@@ -212,7 +222,7 @@ module AMQ
212
222
  "nil" => nil
213
223
  }
214
224
  }
215
- expect(Table.decode(Table.encode(input))).to eq(input)
225
+ expect(Table.decode(Table.encode(input))).to eq(input.tap { |r| r["hashval"]["protocol"]["spec"]["utf8"].force_encoding(::Encoding::ASCII_8BIT) })
216
226
  end
217
227
 
218
228
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: amq-protocol
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.1
4
+ version: 2.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jakub Stastny
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2020-04-08 00:00:00.000000000 Z
14
+ date: 2020-07-10 00:00:00.000000000 Z
15
15
  dependencies: []
16
16
  description: |2
17
17
  amq-protocol is an AMQP 0.9.1 serialization library for Ruby. It is not a
@@ -101,7 +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.0.3
104
+ rubygems_version: 3.1.2
105
105
  signing_key:
106
106
  specification_version: 4
107
107
  summary: AMQP 0.9.1 encoding & decoding library.