https: support rejectUnauthorized for unix sockets · nodejs/node@c4cbd99

2 files changed

lines changed

Original file line numberDiff line numberDiff line change

@@ -247,7 +247,8 @@ function ClientRequest(options, cb) {

247247

this.shouldKeepAlive = false;

248248

var optionsPath = {

249249

path: this.socketPath,

250-

timeout: this.timeout

250+

timeout: this.timeout,

251+

rejectUnauthorized: !!options.rejectUnauthorized

251252

};

252253

newSocket = this.agent.createConnection(optionsPath, oncreate);

253254

if (newSocket && !called) {

Original file line numberDiff line numberDiff line change

@@ -0,0 +1,28 @@

1+

'use strict';

2+

const common = require('../common');

3+
4+

if (!common.hasCrypto) {

5+

common.skip('missing crypto');

6+

return;

7+

}

8+
9+

common.refreshTmpDir();

10+
11+

const fs = require('fs');

12+

const https = require('https');

13+

const options = {

14+

cert: fs.readFileSync(common.fixturesDir + '/test_cert.pem'),

15+

key: fs.readFileSync(common.fixturesDir + '/test_key.pem')

16+

};

17+
18+

const server = https.createServer(options, common.mustCall((req, res) => {

19+

res.end('bye\n');

20+

server.close();

21+

}));

22+
23+

server.listen(common.PIPE, common.mustCall(() => {

24+

https.get({

25+

socketPath: common.PIPE,

26+

rejectUnauthorized: false

27+

});

28+

}));