-
Notifications
You must be signed in to change notification settings - Fork 30k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
https: add missing localPort while create socket
In `_tls_wrap.js` while calling `socket.connect` the `localPort` was missing, restore it. PR-URL: #24554 Fixes: #24543 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com>
- Loading branch information
1 parent
cb0fc65
commit b7b08d1
Showing
2 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
'use strict'; | ||
const common = require('../common'); | ||
const fixtures = require('../common/fixtures'); | ||
|
||
if (!common.hasCrypto) | ||
common.skip('missing crypto'); | ||
|
||
const https = require('https'); | ||
const assert = require('assert'); | ||
|
||
{ | ||
https.createServer({ | ||
cert: fixtures.readKey('agent1-cert.pem'), | ||
key: fixtures.readKey('agent1-key.pem'), | ||
}, common.mustCall(function(req, res) { | ||
this.close(); | ||
res.end(); | ||
})).listen(0, common.localhostIPv4, common.mustCall(function() { | ||
const port = this.address().port; | ||
const req = https.get({ | ||
host: common.localhostIPv4, | ||
pathname: '/', | ||
port, | ||
family: 4, | ||
localPort: 34567, | ||
rejectUnauthorized: false | ||
}, common.mustCall(() => { | ||
assert.strictEqual(req.socket.localPort, 34567); | ||
assert.strictEqual(req.socket.remotePort, port); | ||
})); | ||
})); | ||
} |