https: support rejectUnauthorized for unix sockets
This commit allows self signed certificates to work with unix sockets by forwarding the rejectUnauthorized option. Fixes: https://github.com/nodejs/node/issues/13470 PR-URL: https://github.com/nodejs/node/pull/13505 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
This commit is contained in:
parent
d958bf88b8
commit
d0571a926a
@ -247,7 +247,8 @@ function ClientRequest(options, cb) {
|
|||||||
this.shouldKeepAlive = false;
|
this.shouldKeepAlive = false;
|
||||||
var optionsPath = {
|
var optionsPath = {
|
||||||
path: this.socketPath,
|
path: this.socketPath,
|
||||||
timeout: this.timeout
|
timeout: this.timeout,
|
||||||
|
rejectUnauthorized: !!options.rejectUnauthorized
|
||||||
};
|
};
|
||||||
newSocket = this.agent.createConnection(optionsPath, oncreate);
|
newSocket = this.agent.createConnection(optionsPath, oncreate);
|
||||||
if (newSocket && !called) {
|
if (newSocket && !called) {
|
||||||
|
28
test/parallel/test-https-unix-socket-self-signed.js
Normal file
28
test/parallel/test-https-unix-socket-self-signed.js
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
'use strict';
|
||||||
|
const common = require('../common');
|
||||||
|
|
||||||
|
if (!common.hasCrypto) {
|
||||||
|
common.skip('missing crypto');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
common.refreshTmpDir();
|
||||||
|
|
||||||
|
const fs = require('fs');
|
||||||
|
const https = require('https');
|
||||||
|
const options = {
|
||||||
|
cert: fs.readFileSync(common.fixturesDir + '/test_cert.pem'),
|
||||||
|
key: fs.readFileSync(common.fixturesDir + '/test_key.pem')
|
||||||
|
};
|
||||||
|
|
||||||
|
const server = https.createServer(options, common.mustCall((req, res) => {
|
||||||
|
res.end('bye\n');
|
||||||
|
server.close();
|
||||||
|
}));
|
||||||
|
|
||||||
|
server.listen(common.PIPE, common.mustCall(() => {
|
||||||
|
https.get({
|
||||||
|
socketPath: common.PIPE,
|
||||||
|
rejectUnauthorized: false
|
||||||
|
});
|
||||||
|
}));
|
Loading…
x
Reference in New Issue
Block a user