Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Codec c short support edits #775

Closed
wants to merge 112 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
112 commits
Select commit Hold shift + click to select a range
5df39a0
added support for 'U' and 'u' to codec
Apr 23, 2021
afca47a
Drop support for node.js engines below v10
xamgore Apr 3, 2021
50dac25
Remove the upper bound of node engines
xamgore Apr 22, 2021
60aa02d
Alter supported nodejs versions in readme
xamgore May 14, 2021
fd8d115
Fix broken links in readme
jonaskello May 17, 2021
6f99086
set SNI hostname for TLS connections
carlhoerberg Mar 31, 2020
dcce9ef
Drop safe-buffer dependency
kibertoad May 18, 2021
4ab7885
Drop CI for unsupported versions
kibertoad May 18, 2021
f8cfb78
Update package version and changelog for v0.8.0
squaremo May 19, 2021
ce33b1e
Remove old NodeJS versions from CI matrix
squaremo May 19, 2021
5fe1a1b
modernize bitset to use class/const/let
jimmywarting Jun 29, 2021
f2da96c
added jsDoc
jimmywarting Jun 29, 2021
d2e1d4b
auto format
jimmywarting Jun 29, 2021
6311821
destruct
jimmywarting Jun 29, 2021
2b3e669
mv import to top
jimmywarting Jun 29, 2021
edaaa49
GitHub Actions workflow for tests
squaremo Oct 15, 2021
38ba1ce
update url-parse package
giorgioatanasov Oct 15, 2021
f331657
Bring package-lock.json up to date
squaremo Oct 18, 2021
85260e8
auto format code
jimmywarting Jun 29, 2021
df67c97
rm inherit
jimmywarting Jun 29, 2021
66467fe
rm circular ref
jimmywarting Jun 29, 2021
82b722c
destruct imports
jimmywarting Jun 29, 2021
e66acff
sort on node, npm own packages
jimmywarting Jun 29, 2021
71f649b
rm some self variable
jimmywarting Jun 29, 2021
a57a353
rm unnecessary constructor
jimmywarting Jun 29, 2021
2484993
mv exports to bottom
jimmywarting Jun 29, 2021
8e6129e
inspect was undefined and used
jimmywarting Jun 29, 2021
85bb5ad
start using async where it may fit
jimmywarting Jun 29, 2021
0d3ec99
revert some failing test
jimmywarting Jul 6, 2021
99a9058
Close connection to server on connect errors (#647)
luddd3 Dec 28, 2021
11d4706
fix: done called twice on invalid options (#667)
luddd3 Dec 28, 2021
eb93c8a
chore: :lock: amqplib will use the security patched version of urlpar…
suhail-n Mar 20, 2022
e2dc08f
Update README.md
cressie176 May 4, 2022
6f9cd7f
Replace the deprecated istanbul with nyc
cressie176 May 5, 2022
4279549
Update mocha to latest version still compatible with node 10
cressie176 May 5, 2022
c71b89d
Update CHANGELOG
cressie176 May 9, 2022
fb042cf
0.9.0
cressie176 May 9, 2022
c41a09c
Update README references
cressie176 May 15, 2022
ad39bc8
Retire travis as per #684
cressie176 May 15, 2022
644ebd2
Test against recent node versions
cressie176 May 15, 2022
68b1534
Add readme badges
cressie176 May 15, 2022
153a40e
Add troubleshooting link to the readme
cressie176 May 15, 2022
f6bfc55
Update README promise example
renarsvilnis Oct 31, 2018
375560c
Fix readme example unneeded async-await and convert more examples to …
renarsvilnis Feb 28, 2019
8228062
Make README examples more consistent
cressie176 May 15, 2022
21a31ac
Update links in package.json
cressie176 May 15, 2022
8da6d4a
Update README with more recent node version
cressie176 May 15, 2022
f4c3189
use .push.apply instead of concat in Mux _readIncoming
Uzlopak Nov 4, 2021
d5e1a10
fix wrong implementation of push.apply
Uzlopak Nov 4, 2021
b1dec78
Update changelog
cressie176 May 15, 2022
899affe
transform throws string into throw Error
Uzlopak Nov 5, 2021
d99c305
Revert "Merge pull request #661 from Uzlopak/code-smells-throw-errors"
cressie176 May 15, 2022
fd9525a
Use Map instead of Object for BaseChannel.consumers
Uzlopak Nov 4, 2021
cc4add5
update changelog
cressie176 May 15, 2022
8c498e9
call unregisterConsumer in handleCancel
Uzlopak Nov 4, 2021
9eeefff
update changelog
cressie176 May 15, 2022
0924cf0
Add version to changelog
cressie176 May 21, 2022
ef94852
0.9.1
cressie176 May 21, 2022
476cf9d
Use native promises
mohd-akram May 19, 2022
0201e89
Address review comments
mohd-akram May 23, 2022
1230f14
Update CHANGELOG
cressie176 Jun 2, 2022
876ddc8
0.10.0
cressie176 Jun 2, 2022
d02216d
Allow servername to be specified via socket options
cressie176 Jul 26, 2022
54460ea
Fix changelog
cressie176 Jul 26, 2022
ebd125d
0.10.1
cressie176 Jul 26, 2022
a98ad81
Use Buffer.allocUnsafe to reduce allocations
chkimes Jul 13, 2022
2b32550
Update connection.js
chkimes Aug 4, 2022
85e9051
Link to PR from allocUnsafe comment
cressie176 Aug 7, 2022
27b1e8e
Update CHANGELOG
cressie176 Aug 7, 2022
2d324b7
0.10.2
cressie176 Aug 7, 2022
c160cce
Experiment with issue templates
cressie176 Aug 10, 2022
038524b
Update bug_report.md
cressie176 Aug 10, 2022
267fe5a
Update bug_report.md
cressie176 Aug 10, 2022
0f83f30
Use @acuminous/bitsytnax fork
cressie176 Sep 1, 2022
6cb0ea6
Update bitsyntax
cressie176 Sep 1, 2022
996eac6
0.10.3
cressie176 Sep 1, 2022
55851b4
Update bug_report.md
cressie176 Sep 1, 2022
72c1ac7
Update bug_report.md
cressie176 Sep 2, 2022
1599248
Update CHANGELOG.md
cressie176 Sep 3, 2022
a9a41e5
fix(docs): typo
CaioAugustoo Oct 31, 2022
c5699ff
Update examples
cressie176 Dec 9, 2022
dd1c9fb
Update callback examples
cressie176 Dec 10, 2022
3f53f97
Update other examples
cressie176 Dec 10, 2022
8aab456
Update other examples
cressie176 Dec 10, 2022
5ff264a
Add direct reply to example
cressie176 Dec 10, 2022
b9ed9c9
Update bug_report.md
cressie176 Dec 31, 2022
222ee77
Update bug_report.md
cressie176 Dec 31, 2022
c7b6b1d
classify callback model (#691)
jimmywarting Jan 16, 2023
3abcf0d
Add example for RabbitMQ stream queues (#668)
Gsantomaggio Jan 16, 2023
678b9df
Improve stream example
cressie176 Jun 12, 2023
d819bcf
Improve stream example
cressie176 Jun 12, 2023
2288abc
Update README.md
cressie176 Jun 12, 2023
2886ca7
refactor to es-class (#712)
jimmywarting Jun 25, 2023
a87f240
chore: classify mux (#731)
jimmywarting Jun 25, 2023
ad2af44
Make CI more robust
cressie176 Nov 28, 2023
c89c0e3
chore: remove circular ref (#732)
jimmywarting Nov 28, 2023
85be2ec
chore: slice -> subarray (#730)
jimmywarting Nov 28, 2023
312e3f7
Test using Node 20
cressie176 Nov 28, 2023
a5f1f17
Add connection-update-secret
cressie176 Feb 22, 2024
cb8d2db
Automatically remove update-secret-ok event handler
cressie176 Feb 22, 2024
d76a142
Make quotes in updateSecret consistent with other tests
cressie176 Feb 22, 2024
676cb24
Update changelog in preparation for release
cressie176 Apr 11, 2024
48552ed
0.10.4
cressie176 Apr 11, 2024
b2d80ab
Touch readme
cressie176 Apr 11, 2024
38c4d59
Update repo url
cressie176 Apr 11, 2024
03b4240
Add publish workflow
cressie176 Apr 11, 2024
115e52a
Commit defs
cressie176 Apr 11, 2024
89abcb8
Nolonger need prepare
cressie176 Apr 11, 2024
22e948a
Add encode and decode support for unsigned short
Jul 8, 2024
0b43ba9
Add support for 'B" as unsigned byte and 'i' as unsigned int
Jul 8, 2024
16a7d33
Complete support for unsigned integers
cressie176 Nov 18, 2024
89fdcd0
Remove duplicate type tag
cressie176 Nov 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Close connection to server on connect errors (#647)
luddd3 authored and cressie176 committed Nov 24, 2024
commit 99a9058ad119e9118aef1ca3b3c6053d25744e65
6 changes: 5 additions & 1 deletion lib/connect.js
Original file line number Diff line number Diff line change
@@ -152,8 +152,12 @@ function connect(url, socketOptions, openCallback) {
if (timeout) sock.setTimeout(0);
if (err === null) {
openCallback(null, c);
} else {
// The connection isn't closed by the server on e.g. wrong password
sock.end();
sock.destroy();
openCallback(err);
}
else openCallback(err);
});
}

48 changes: 47 additions & 1 deletion test/connect.js
Original file line number Diff line number Diff line change
@@ -2,10 +2,11 @@

var connect = require('../lib/connect').connect;
var credentialsFromUrl = require('../lib/connect').credentialsFromUrl;
var defs = require('../lib/defs');
var assert = require('assert');
var util = require('./util');
var net = require('net');
var fail = util.fail, succeed = util.succeed,
var fail = util.fail, succeed = util.succeed, latch = util.latch,
kCallback = util.kCallback,
succeedIfAttributeEquals = util.succeedIfAttributeEquals;
var format = require('util').format;
@@ -147,5 +148,50 @@ suite("Connect API", function() {
else done();
});
});
});

suite('Errors on connect', function() {
var server
afterEach(function() {
if (server) {
server.close();
}
})

test("closes underlying connection on authentication error", function(done) {
var bothDone = latch(2, done);
server = net.createServer(function(socket) {
socket.once('data', function(protocolHeader) {
assert.deepStrictEqual(
protocolHeader,
Buffer.from("AMQP" + String.fromCharCode(0,0,9,1))
);
util.runServer(socket, function(send, wait) {
send(defs.ConnectionStart,
{versionMajor: 0,
versionMinor: 9,
serverProperties: {},
mechanisms: Buffer.from('PLAIN'),
locales: Buffer.from('en_US')});
wait(defs.ConnectionStartOk)().then(function() {
send(defs.ConnectionClose,
{replyCode: 403,
replyText: 'ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN',
classId: 0,
methodId: 0});
});
});
});

// Wait for the connection to be closed after the authentication error
socket.once('end', function() {
bothDone();
});
}).listen(0);

connect('amqp://localhost:' + server.address().port, {}, function(err) {
if (!err) bothDone(new Error('Expected authentication error'));
bothDone();
});
});
});