nodejs-self-signed-certific.../request-without-warnings.js

22 lines
482 B
JavaScript
Raw Normal View History

#!/usr/bin/env node
'use strict';
var https = require('https');
var fs = require('fs');
var path = require('path');
var ca = fs.readFileSync(path.join(__dirname, 'certs', 'client', 'chain.pem'));
var port = process.argv[2] || 8043;
var hostname = process.argv[3] || 'localhost.daplie.com';
var options = {
2014-07-15 03:38:33 +00:00
host: hostname
, port: port
, path: '/'
, ca: ca
};
options.agent = new https.Agent(options);
https.request(options, function(res) {
res.pipe(process.stdout);
}).end();