mirror of https://github.com/lukechilds/node.git
Browse Source
Add more information to the "ECONNRESET" errors generated when the socket hang ups before establishing the secure connection. These kind of errors are really hard to troubleshoot without this info. PR-URL: https://github.com/nodejs/node/pull/7476 Reviewed-By: Trevor Norris <trevnorris@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Yazhong Liu <yorkiefixer@gmail.com>v6
José F. Romaniello
9 years ago
committed by
Tobias Nießen
5 changed files with 99 additions and 0 deletions
@ -0,0 +1,25 @@ |
|||
'use strict'; |
|||
|
|||
const common = require('../common'); |
|||
const assert = require('assert'); |
|||
const net = require('net'); |
|||
const tls = require('tls'); |
|||
|
|||
const server = net.createServer((c) => { |
|||
c.end(); |
|||
}).listen(common.mustCall(() => { |
|||
const port = server.address().port; |
|||
|
|||
tls.connect({ |
|||
port: port, |
|||
localAddress: common.localhostIPv4 |
|||
}, common.localhostIPv4) |
|||
.once('error', common.mustCall((e) => { |
|||
assert.strictEqual(e.code, 'ECONNRESET'); |
|||
assert.strictEqual(e.path, undefined); |
|||
assert.strictEqual(e.host, undefined); |
|||
assert.strictEqual(e.port, port); |
|||
assert.strictEqual(e.localAddress, common.localhostIPv4); |
|||
server.close(); |
|||
})); |
|||
})); |
@ -0,0 +1,22 @@ |
|||
'use strict'; |
|||
|
|||
const common = require('../common'); |
|||
const assert = require('assert'); |
|||
const tls = require('tls'); |
|||
const net = require('net'); |
|||
|
|||
common.refreshTmpDir(); |
|||
|
|||
const server = net.createServer((c) => { |
|||
c.end(); |
|||
}).listen(common.PIPE, common.mustCall(() => { |
|||
tls.connect({ path: common.PIPE }) |
|||
.once('error', common.mustCall((e) => { |
|||
assert.strictEqual(e.code, 'ECONNRESET'); |
|||
assert.strictEqual(e.path, common.PIPE); |
|||
assert.strictEqual(e.port, undefined); |
|||
assert.strictEqual(e.host, undefined); |
|||
assert.strictEqual(e.localAddress, undefined); |
|||
server.close(); |
|||
})); |
|||
})); |
@ -0,0 +1,26 @@ |
|||
'use strict'; |
|||
|
|||
const common = require('../common'); |
|||
const assert = require('assert'); |
|||
const net = require('net'); |
|||
const tls = require('tls'); |
|||
|
|||
const server = net.createServer((c) => { |
|||
c.end(); |
|||
}).listen(common.mustCall(() => { |
|||
const port = server.address().port; |
|||
|
|||
const socket = new net.Socket(); |
|||
|
|||
tls.connect({ socket }) |
|||
.once('error', common.mustCall((e) => { |
|||
assert.strictEqual(e.code, 'ECONNRESET'); |
|||
assert.strictEqual(e.path, undefined); |
|||
assert.strictEqual(e.host, undefined); |
|||
assert.strictEqual(e.port, undefined); |
|||
assert.strictEqual(e.localAddress, undefined); |
|||
server.close(); |
|||
})); |
|||
|
|||
socket.connect(port); |
|||
})); |
@ -0,0 +1,22 @@ |
|||
'use strict'; |
|||
|
|||
const common = require('../common'); |
|||
const assert = require('assert'); |
|||
const net = require('net'); |
|||
const tls = require('tls'); |
|||
|
|||
const server = net.createServer((c) => { |
|||
c.end(); |
|||
}).listen(common.mustCall(() => { |
|||
const port = server.address().port; |
|||
|
|||
tls.connect(port, common.localhostIPv4) |
|||
.once('error', common.mustCall((e) => { |
|||
assert.strictEqual(e.code, 'ECONNRESET'); |
|||
assert.strictEqual(e.path, undefined); |
|||
assert.strictEqual(e.host, common.localhostIPv4); |
|||
assert.strictEqual(e.port, port); |
|||
assert.strictEqual(e.localAddress, undefined); |
|||
server.close(); |
|||
})); |
|||
})); |
Loading…
Reference in new issue