2015-05-19 13:00:06 +02:00
|
|
|
'use strict';
|
2016-07-19 02:03:42 +05:30
|
|
|
const common = require('../common');
|
2012-08-30 15:14:37 +02:00
|
|
|
// disable strict server certificate validation by the client
|
|
|
|
|
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
|
|
|
|
|
|
2016-12-30 18:38:06 -05:00
|
|
|
const assert = require('assert');
|
2015-03-04 12:11:21 +11:00
|
|
|
|
|
|
|
|
if (!common.hasCrypto) {
|
2016-05-11 15:34:52 -04:00
|
|
|
common.skip('missing crypto');
|
2015-07-07 20:55:55 +05:30
|
|
|
return;
|
2015-03-04 12:11:21 +11:00
|
|
|
}
|
2016-12-30 18:38:06 -05:00
|
|
|
const https = require('https');
|
2015-03-04 12:11:21 +11:00
|
|
|
|
2016-12-30 18:38:06 -05:00
|
|
|
const fs = require('fs');
|
2012-08-18 14:18:02 +09:00
|
|
|
|
|
|
|
|
var options = {
|
|
|
|
|
key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
|
|
|
|
|
cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
|
|
|
|
|
};
|
|
|
|
|
|
2016-07-15 15:43:24 -04:00
|
|
|
var server = https.createServer(options, common.mustCall(function(req, res) {
|
2012-08-18 14:18:02 +09:00
|
|
|
assert.equal('GET', req.method);
|
|
|
|
|
assert.equal('/foo?bar', req.url);
|
|
|
|
|
res.writeHead(200, {'Content-Type': 'text/plain'});
|
|
|
|
|
res.write('hello\n');
|
|
|
|
|
res.end();
|
|
|
|
|
server.close();
|
2016-07-15 15:43:24 -04:00
|
|
|
}));
|
2012-08-18 14:18:02 +09:00
|
|
|
|
2016-05-29 03:06:56 -04:00
|
|
|
server.listen(0, function() {
|
|
|
|
|
https.get(`https://127.0.0.1:${this.address().port}/foo?bar`);
|
2012-08-18 14:18:02 +09:00
|
|
|
});
|