2010-12-09 16:35:16 +08:00
|
|
|
var common = require('../common');
|
|
|
|
var tls = require('tls');
|
|
|
|
var fs = require('fs');
|
|
|
|
|
|
|
|
|
|
|
|
// most servers don't require certificates
|
|
|
|
|
|
|
|
var options = {
|
2011-10-05 06:08:18 +08:00
|
|
|
key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem')
|
2010-12-09 16:35:16 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-10-05 06:08:18 +08:00
|
|
|
var s = tls.connect(443, 'joyent.com', options, function() {
|
2010-12-09 18:35:16 +08:00
|
|
|
if (!s.authorized) {
|
2011-10-05 06:08:18 +08:00
|
|
|
console.error('CONNECTED: ' + s.authorizationError);
|
2010-12-09 18:35:16 +08:00
|
|
|
s.destroy();
|
|
|
|
return;
|
|
|
|
}
|
2010-12-09 16:35:16 +08:00
|
|
|
s.pipe(process.stdout);
|
|
|
|
process.openStdin().pipe(s);
|
|
|
|
});
|
|
|
|
|