summaryrefslogtreecommitdiff
path: root/test/simple/test-https-foafssl.js
diff options
context:
space:
mode:
authorLalit Kapoor <lalitkapoor@gmail.com>2013-12-10 21:10:10 -0600
committerFedor Indutny <fedor.indutny@gmail.com>2013-12-12 21:31:59 +0400
commit4d5489667cb073ec9d82ef292ecd0749de494238 (patch)
tree5d314c06dbb79b8d1504d5403ccf76c4cac2a917 /test/simple/test-https-foafssl.js
parent6f3d60388eb8be4f24e6e8312f7bc85f5f8773c3 (diff)
downloadnode-new-4d5489667cb073ec9d82ef292ecd0749de494238.tar.gz
test: use s_client instead of curl
fixes #6647
Diffstat (limited to 'test/simple/test-https-foafssl.js')
-rw-r--r--test/simple/test-https-foafssl.js30
1 files changed, 19 insertions, 11 deletions
diff --git a/test/simple/test-https-foafssl.js b/test/simple/test-https-foafssl.js
index 2336e5cd41..c464855723 100644
--- a/test/simple/test-https-foafssl.js
+++ b/test/simple/test-https-foafssl.js
@@ -29,8 +29,7 @@ var assert = require('assert');
var join = require('path').join;
var fs = require('fs');
-var exec = require('child_process').exec;
-
+var spawn = require('child_process').spawn;
var https = require('https');
var options = {
@@ -40,6 +39,7 @@ var options = {
};
var reqCount = 0;
+var CRLF = '\r\n';
var body = 'hello world\n';
var cert;
var subjectaltname;
@@ -60,19 +60,27 @@ var server = https.createServer(options, function(req, res) {
res.end(body);
});
-
server.listen(common.PORT, function() {
- var cmd = 'curl --insecure https://127.0.0.1:' + common.PORT + '/';
- cmd += ' --cert ' + join(common.fixturesDir, 'foafssl.crt');
- cmd += ' --key ' + join(common.fixturesDir, 'foafssl.key');
- console.error('executing %j', cmd);
- exec(cmd, function(err, stdout, stderr) {
- if (err) throw err;
- common.error(common.inspect(stdout));
- assert.equal(body, stdout);
+ var args = ['s_client',
+ '-quiet',
+ '-connect', '127.0.0.1:' + common.PORT,
+ '-cert', join(common.fixturesDir, 'foafssl.crt'),
+ '-key', join(common.fixturesDir, 'foafssl.key')];
+
+ var client = spawn(common.opensslCli, args);
+
+ client.stdout.on('data', function(data) {
+ var message = data.toString();
+ var contents = message.split(CRLF + CRLF).pop();
+ assert.equal(body, contents);
server.close();
});
+ client.stdin.write('GET /\n\n');
+
+ client.on('error', function(error) {
+ throw error;
+ });
});
process.on('exit', function() {