amqplib 0.10.0 → 0.10.3

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.
@@ -0,0 +1,38 @@
1
+ ---
2
+ name: Bug report / Support request
3
+ about: Report a bug or ask for help
4
+ title: ''
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ Before reporting a bug or requesting support please...
11
+
12
+ 1. Read the troubleshooting guide
13
+
14
+ - https://amqp-node.github.io/amqplib/#troubleshooting
15
+
16
+ 2. Search for existing open and closed issues
17
+
18
+ - https://github.com/amqp-node/amqplib/issues?q=is%3Aissue+TYPE+YOUR+KEYWORDS+HERE
19
+
20
+ 3. Ensure you are familiar with the amqplib Channel API and RabbitMQ basics
21
+
22
+ - https://amqp-node.github.io/amqplib/channel_api.html
23
+ - https://www.cloudamqp.com/blog/part1-rabbitmq-for-beginners-what-is-rabbitmq.html
24
+ - https://www.rabbitmq.com/tutorials/amqp-concepts.html
25
+
26
+ If the above does not help, please provide the following information...
27
+
28
+ - A clear and concise description of what the bug is.
29
+ - RabbitMQ version
30
+ - amqplib version
31
+
32
+ If you include code snippets, please format them so they are easier to read
33
+
34
+ - https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks
35
+
36
+ Thank you
37
+
38
+
package/CHANGELOG.md CHANGED
@@ -1,6 +1,30 @@
1
1
  # Change log for amqplib
2
2
 
3
- ## Chagnes in v0.10.0
3
+ ## Changes in v0.10.3
4
+
5
+ git log v0.10.2..v0.10.3
6
+
7
+ - Use @acuminous/bitsyntax fork. See https://github.com/amqp-node/amqplib/issues/453
8
+
9
+ ## Changes in v0.10.2
10
+
11
+ git log v0.10.1..v0.10.2
12
+
13
+ - Use Buffer.allocUnsafe when sending messages to improve performance ([PR
14
+ 695](https://github.com/amqp-node/amqplib/pull/695), thank you
15
+ @chkimes and @Uzlopak)
16
+
17
+ ## Changes in v0.10.1
18
+
19
+ git log v0.10.0..v0.10.1
20
+
21
+ * Allow servername to be specified via socket options as discussed in as discussed in
22
+ [issue 697](https://github.com/squaremo/amqp.node/issues/697)
23
+
24
+ ## Changes in v0.10.0
25
+
26
+ git log v0.9.1..v0.10.0
27
+
4
28
  * Use Native promises ([PR
5
29
  689](https://github.com/amqp-node/amqplib/pull/689), thank you
6
30
  @mohd-akram and @kibertoad)
package/lib/connect.js CHANGED
@@ -106,7 +106,7 @@ function connect(url, socketOptions, openCallback) {
106
106
  if (typeof url === 'object') {
107
107
  protocol = (url.protocol || 'amqp') + ':';
108
108
  sockopts.host = url.hostname;
109
- sockopts.servername = url.hostname;
109
+ sockopts.servername = sockopts.servername || url.hostname;
110
110
  sockopts.port = url.port || ((protocol === 'amqp:') ? 5672 : 5671);
111
111
 
112
112
  var user, pass;
@@ -131,7 +131,7 @@ function connect(url, socketOptions, openCallback) {
131
131
  var parts = URL(url, true); // yes, parse the query string
132
132
  protocol = parts.protocol;
133
133
  sockopts.host = parts.hostname;
134
- sockopts.servername = parts.hostname;
134
+ sockopts.servername = sockopts.servername || parts.hostname;
135
135
  sockopts.port = parseInt(parts.port) || ((protocol === 'amqp:') ? 5672 : 5671);
136
136
  var vhost = parts.pathname ? parts.pathname.substr(1) : null;
137
137
  fields = openFrames(vhost, parts.query, sockopts.credentials || credentialsFromUrl(parts), extraClientProperties);
package/lib/connection.js CHANGED
@@ -560,7 +560,11 @@ C.sendMessage = function(channel,
560
560
  var allLen = methodHeaderLen + bodyLen;
561
561
 
562
562
  if (allLen < SINGLE_CHUNK_THRESHOLD) {
563
- var all = Buffer.alloc(allLen);
563
+ // Use `allocUnsafe` to avoid excessive allocations and CPU usage
564
+ // from zeroing. The returned Buffer is not zeroed and so must be
565
+ // completely filled to be used safely.
566
+ // See https://github.com/amqp-node/amqplib/pull/695
567
+ var all = Buffer.allocUnsafe(allLen);
564
568
  var offset = mframe.copy(all, 0);
565
569
  offset += pframe.copy(all, offset);
566
570
 
@@ -570,7 +574,11 @@ C.sendMessage = function(channel,
570
574
  }
571
575
  else {
572
576
  if (methodHeaderLen < SINGLE_CHUNK_THRESHOLD) {
573
- var both = Buffer.alloc(methodHeaderLen);
577
+ // Use `allocUnsafe` to avoid excessive allocations and CPU usage
578
+ // from zeroing. The returned Buffer is not zeroed and so must be
579
+ // completely filled to be used safely.
580
+ // See https://github.com/amqp-node/amqplib/pull/695
581
+ var both = Buffer.allocUnsafe(methodHeaderLen);
574
582
  var offset = mframe.copy(both, 0);
575
583
  pframe.copy(both, offset);
576
584
  buffer.write(both);
package/lib/frame.js CHANGED
@@ -8,7 +8,7 @@ var defs = require('./defs');
8
8
  var constants = defs.constants;
9
9
  var decode = defs.decode;
10
10
 
11
- var Bits = require('bitsyntax');
11
+ var Bits = require('@acuminous/bitsyntax');
12
12
 
13
13
  module.exports.PROTOCOL_HEADER = "AMQP" + String.fromCharCode(0, 0, 9, 1);
14
14
 
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "amqplib",
3
3
  "homepage": "http://amqp-node.github.io/amqplib/",
4
4
  "main": "./channel_api.js",
5
- "version": "0.10.0",
5
+ "version": "0.10.3",
6
6
  "description": "An AMQP 0-9-1 (e.g., RabbitMQ) library and client.",
7
7
  "repository": {
8
8
  "type": "git",
@@ -12,7 +12,7 @@
12
12
  "node": ">=10"
13
13
  },
14
14
  "dependencies": {
15
- "bitsyntax": "~0.1.0",
15
+ "@acuminous/bitsyntax": "^0.1.2",
16
16
  "buffer-more-ints": "~1.0.0",
17
17
  "readable-stream": "1.x >=1.1.9",
18
18
  "url-parse": "~1.5.10"