diff --git a/test/common.js b/test/common.js index 352f7b676471af..901425b2888cab 100644 --- a/test/common.js +++ b/test/common.js @@ -43,6 +43,9 @@ Object.defineProperty(exports, 'opensslCli', {get: function() { return opensslCli; }, enumerable: true }); +Object.defineProperty(exports, 'hasCrypto', {get: function() { + return process.versions.openssl ? true : false; +}}); if (process.platform === 'win32') { exports.PIPE = '\\\\.\\pipe\\libuv-test'; diff --git a/test/internet/test-http-https-default-ports.js b/test/internet/test-http-https-default-ports.js index 76c6e3a1e4aec9..26732ee086f1fa 100644 --- a/test/internet/test-http-https-default-ports.js +++ b/test/internet/test-http-https-default-ports.js @@ -1,7 +1,12 @@ var common = require('../common'); var assert = require('assert'); +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var https = require('https'); + var http = require('http'); var gotHttpsResp = false; var gotHttpResp = false; diff --git a/test/internet/test-tls-reuse-host-from-socket.js b/test/internet/test-tls-reuse-host-from-socket.js index 04098e4ecfc56c..2f6392ce83455a 100644 --- a/test/internet/test-tls-reuse-host-from-socket.js +++ b/test/internet/test-tls-reuse-host-from-socket.js @@ -1,7 +1,12 @@ var common = require('../common'); var assert = require('assert'); +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var tls = require('tls'); + var net = require('net'); var connected = false; var secure = false; diff --git a/test/parallel/test-buffer.js b/test/parallel/test-buffer.js index 1c2c4250900a6c..f4e89e2a579733 100644 --- a/test/parallel/test-buffer.js +++ b/test/parallel/test-buffer.js @@ -1108,16 +1108,20 @@ assert.throws(function () { new SlowBuffer(smalloc.kMaxLength + 1); }, RangeError); -// Test truncation after decode -var crypto = require('crypto'); - -var b1 = new Buffer('YW55=======', 'base64'); -var b2 = new Buffer('YW55', 'base64'); - -assert.equal( - crypto.createHash('sha1').update(b1).digest('hex'), - crypto.createHash('sha1').update(b2).digest('hex') -); +if (common.hasCrypto) { + // Test truncation after decode + var crypto = require('crypto'); + + var b1 = new Buffer('YW55=======', 'base64'); + var b2 = new Buffer('YW55', 'base64'); + + assert.equal( + crypto.createHash('sha1').update(b1).digest('hex'), + crypto.createHash('sha1').update(b2).digest('hex') + ); +} else { + console.log('1..0 # Skipped: missing crypto'); +} // Test Compare var b = new Buffer(1).fill('a'); diff --git a/test/parallel/test-crypto-authenticated.js b/test/parallel/test-crypto-authenticated.js index 5d8bfa0635a440..0336871a56fa20 100644 --- a/test/parallel/test-crypto-authenticated.js +++ b/test/parallel/test-crypto-authenticated.js @@ -1,12 +1,11 @@ var common = require('../common'); var assert = require('assert'); -try { - var crypto = require('crypto'); -} catch (e) { - console.log('Not compiled with OPENSSL support.'); +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); process.exit(); } +var crypto = require('crypto'); crypto.DEFAULT_ENCODING = 'buffer'; diff --git a/test/parallel/test-crypto-binary-default.js b/test/parallel/test-crypto-binary-default.js index 4cd5d8dd2ab148..2efd3fa519d32b 100644 --- a/test/parallel/test-crypto-binary-default.js +++ b/test/parallel/test-crypto-binary-default.js @@ -6,13 +6,11 @@ var common = require('../common'); var assert = require('assert'); var constants = require('constants'); -try { - var crypto = require('crypto'); - var tls = require('tls'); -} catch (e) { - console.log('Not compiled with OPENSSL support.'); +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); process.exit(); } +var crypto = require('crypto'); crypto.DEFAULT_ENCODING = 'binary'; diff --git a/test/parallel/test-crypto-certificate.js b/test/parallel/test-crypto-certificate.js index 033ea691cc21cb..9c98fda2bd5120 100644 --- a/test/parallel/test-crypto-certificate.js +++ b/test/parallel/test-crypto-certificate.js @@ -1,6 +1,10 @@ var common = require('../common'); var assert = require('assert'); +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var crypto = require('crypto'); crypto.DEFAULT_ENCODING = 'buffer'; diff --git a/test/parallel/test-crypto-cipher-decipher.js b/test/parallel/test-crypto-cipher-decipher.js index 47084d07f4db84..e82a08d7031d0c 100644 --- a/test/parallel/test-crypto-cipher-decipher.js +++ b/test/parallel/test-crypto-cipher-decipher.js @@ -1,12 +1,11 @@ var common = require('../common'); var assert = require('assert'); -try { - var crypto = require('crypto'); -} catch (e) { - console.log('Not compiled with OPENSSL support.'); +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); process.exit(); } +var crypto = require('crypto'); function testCipher1(key) { // Test encryption and decryption diff --git a/test/parallel/test-crypto-dh-odd-key.js b/test/parallel/test-crypto-dh-odd-key.js index 21b16e20a5d3a8..46b3c3d8c65c23 100644 --- a/test/parallel/test-crypto-dh-odd-key.js +++ b/test/parallel/test-crypto-dh-odd-key.js @@ -1,7 +1,12 @@ var common = require('../common'); var assert = require('assert'); +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var crypto = require('crypto'); + var odd = new Buffer(39); odd.fill('A'); diff --git a/test/parallel/test-crypto-dh.js b/test/parallel/test-crypto-dh.js index e9240477b35cbd..9eccc2f357215c 100644 --- a/test/parallel/test-crypto-dh.js +++ b/test/parallel/test-crypto-dh.js @@ -2,12 +2,11 @@ var common = require('../common'); var assert = require('assert'); var constants = require('constants'); -try { - var crypto = require('crypto'); -} catch (e) { - console.log('Not compiled with OPENSSL support.'); +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); process.exit(); } +var crypto = require('crypto'); // Test Diffie-Hellman with two parties sharing a secret, // using various encodings as we go along diff --git a/test/parallel/test-crypto-domain.js b/test/parallel/test-crypto-domain.js index 7936bfc35ab934..910e026d20c0ef 100644 --- a/test/parallel/test-crypto-domain.js +++ b/test/parallel/test-crypto-domain.js @@ -2,12 +2,11 @@ var common = require('../common'); var assert = require('assert'); var domain = require('domain'); -try { - var crypto = require('crypto'); -} catch (e) { - console.log('Skipping test, compiled without crypto support.'); - return; +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); } +var crypto = require('crypto'); function test(fn) { var ex = new Error('BAM'); diff --git a/test/parallel/test-crypto-domains.js b/test/parallel/test-crypto-domains.js index 59579f022cf324..eb5c77e12ca1eb 100644 --- a/test/parallel/test-crypto-domains.js +++ b/test/parallel/test-crypto-domains.js @@ -1,10 +1,16 @@ -var crypto = require('crypto'); +var common = require('../common'); var domain = require('domain'); var assert = require('assert'); var d = domain.create(); var expect = ['pbkdf2', 'randomBytes', 'pseudoRandomBytes'] var errors = 0; +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} +var crypto = require('crypto'); + process.on('exit', function() { assert.equal(errors, 3); }); diff --git a/test/parallel/test-crypto-ecb.js b/test/parallel/test-crypto-ecb.js index 12a4517ad1b862..f924dfd29b9bc3 100644 --- a/test/parallel/test-crypto-ecb.js +++ b/test/parallel/test-crypto-ecb.js @@ -1,12 +1,11 @@ var common = require('../common'); var assert = require('assert'); -try { - var crypto = require('crypto'); -} catch (e) { - console.log('Not compiled with OPENSSL support.'); +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); process.exit(); } +var crypto = require('crypto'); crypto.DEFAULT_ENCODING = 'buffer'; diff --git a/test/parallel/test-crypto-from-binary.js b/test/parallel/test-crypto-from-binary.js index 90cf5fd2fd8d6d..ae450645dda610 100644 --- a/test/parallel/test-crypto-from-binary.js +++ b/test/parallel/test-crypto-from-binary.js @@ -5,12 +5,11 @@ var common = require('../common'); var assert = require('assert'); -try { - var crypto = require('crypto'); -} catch (e) { - console.log('Not compiled with OPENSSL support.'); +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); process.exit(); } +var crypto = require('crypto'); var EXTERN_APEX = 0xFBEE9; diff --git a/test/parallel/test-crypto-hash-stream-pipe.js b/test/parallel/test-crypto-hash-stream-pipe.js index c3f14245eef773..795abd49a0f597 100644 --- a/test/parallel/test-crypto-hash-stream-pipe.js +++ b/test/parallel/test-crypto-hash-stream-pipe.js @@ -1,7 +1,12 @@ var common = require('../common'); var assert = require('assert'); +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var crypto = require('crypto'); + var stream = require('stream') var s = new stream.PassThrough(); var h = crypto.createHash('sha1'); diff --git a/test/parallel/test-crypto-hash.js b/test/parallel/test-crypto-hash.js index f49160b7e80586..af323ac4f6496e 100644 --- a/test/parallel/test-crypto-hash.js +++ b/test/parallel/test-crypto-hash.js @@ -3,12 +3,11 @@ var assert = require('assert'); var fs = require('fs'); var path = require('path'); -try { - var crypto = require('crypto'); -} catch (e) { - console.log('Not compiled with OPENSSL support.'); +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); process.exit(); } +var crypto = require('crypto'); // Test hashing var a0 = crypto.createHash('sha1').update('Test123').digest('hex'); diff --git a/test/parallel/test-crypto-hmac.js b/test/parallel/test-crypto-hmac.js index 3fc3fa06f355ab..1a90811fe87c9e 100644 --- a/test/parallel/test-crypto-hmac.js +++ b/test/parallel/test-crypto-hmac.js @@ -1,12 +1,11 @@ var common = require('../common'); var assert = require('assert'); -try { - var crypto = require('crypto'); -} catch (e) { - console.log('Not compiled with OPENSSL support.'); +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); process.exit(); } +var crypto = require('crypto'); // Test HMAC var h1 = crypto.createHmac('sha1', 'Node') diff --git a/test/parallel/test-crypto-padding-aes256.js b/test/parallel/test-crypto-padding-aes256.js index a701f3c442603c..de5fb7ca8732c1 100644 --- a/test/parallel/test-crypto-padding-aes256.js +++ b/test/parallel/test-crypto-padding-aes256.js @@ -1,12 +1,11 @@ var common = require('../common'); var assert = require('assert'); -try { - var crypto = require('crypto'); -} catch (e) { - console.log('Not compiled with OpenSSL support.'); +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); process.exit(); } +var crypto = require('crypto'); crypto.DEFAULT_ENCODING = 'buffer'; diff --git a/test/parallel/test-crypto-padding.js b/test/parallel/test-crypto-padding.js index 7b46bfba418bb6..2cf78588f9da62 100644 --- a/test/parallel/test-crypto-padding.js +++ b/test/parallel/test-crypto-padding.js @@ -1,12 +1,11 @@ var common = require('../common'); var assert = require('assert'); -try { - var crypto = require('crypto'); -} catch (e) { - console.log('Not compiled with OPENSSL support.'); +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); process.exit(); } +var crypto = require('crypto'); crypto.DEFAULT_ENCODING = 'buffer'; diff --git a/test/parallel/test-crypto-pbkdf2.js b/test/parallel/test-crypto-pbkdf2.js index 7fbc77aca5fd93..440c6162e3b26a 100644 --- a/test/parallel/test-crypto-pbkdf2.js +++ b/test/parallel/test-crypto-pbkdf2.js @@ -1,12 +1,11 @@ var common = require('../common'); var assert = require('assert'); -try { - var crypto = require('crypto'); -} catch (e) { - console.log('Not compiled with OPENSSL support.'); +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); process.exit(); } +var crypto = require('crypto'); // // Test PBKDF2 with RFC 6070 test vectors (except #4) diff --git a/test/parallel/test-crypto-random.js b/test/parallel/test-crypto-random.js index 987f0e41897e22..de1bfccf90d2fb 100644 --- a/test/parallel/test-crypto-random.js +++ b/test/parallel/test-crypto-random.js @@ -1,12 +1,11 @@ var common = require('../common'); var assert = require('assert'); -try { - var crypto = require('crypto'); -} catch (e) { - console.log('Not compiled with OPENSSL support.'); +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); process.exit(); } +var crypto = require('crypto'); crypto.DEFAULT_ENCODING = 'buffer'; diff --git a/test/parallel/test-crypto-rsa-dsa.js b/test/parallel/test-crypto-rsa-dsa.js index 57c75f88574a20..65986b49c94789 100644 --- a/test/parallel/test-crypto-rsa-dsa.js +++ b/test/parallel/test-crypto-rsa-dsa.js @@ -3,12 +3,11 @@ var assert = require('assert'); var fs = require('fs'); var constants = require('constants'); -try { - var crypto = require('crypto'); -} catch (e) { - console.log('Not compiled with OPENSSL support.'); +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); process.exit(); } +var crypto = require('crypto'); // Test certificates var certPem = fs.readFileSync(common.fixturesDir + '/test_cert.pem', 'ascii'); diff --git a/test/parallel/test-crypto-sign-verify.js b/test/parallel/test-crypto-sign-verify.js index ded68be37710c2..5cac8948dbd02f 100644 --- a/test/parallel/test-crypto-sign-verify.js +++ b/test/parallel/test-crypto-sign-verify.js @@ -2,12 +2,11 @@ var common = require('../common'); var assert = require('assert'); var fs = require('fs'); -try { - var crypto = require('crypto'); -} catch (e) { - console.log('Not compiled with OPENSSL support.'); +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); process.exit(); } +var crypto = require('crypto'); // Test certificates var certPem = fs.readFileSync(common.fixturesDir + '/test_cert.pem', 'ascii'); diff --git a/test/parallel/test-crypto-stream.js b/test/parallel/test-crypto-stream.js index 2987ed0a218b85..75ea5b13a4c5df 100644 --- a/test/parallel/test-crypto-stream.js +++ b/test/parallel/test-crypto-stream.js @@ -3,12 +3,11 @@ var assert = require('assert'); var stream = require('stream'); var util = require('util'); -try { - var crypto = require('crypto'); -} catch (e) { - console.log('Not compiled with OPENSSL support.'); +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); process.exit(); } +var crypto = require('crypto'); // Small stream to buffer converter function Stream2buffer(callback) { diff --git a/test/parallel/test-crypto-verify-failure.js b/test/parallel/test-crypto-verify-failure.js index 0702e16e854e5a..6190ae247dae2c 100644 --- a/test/parallel/test-crypto-verify-failure.js +++ b/test/parallel/test-crypto-verify-failure.js @@ -1,13 +1,12 @@ var common = require('../common'); var assert = require('assert'); -try { - var crypto = require('crypto'); - var tls = require('tls'); -} catch (e) { - console.log('Not compiled with OPENSSL support.'); +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); process.exit(); } +var crypto = require('crypto'); +var tls = require('tls'); crypto.DEFAULT_ENCODING = 'buffer'; diff --git a/test/parallel/test-crypto.js b/test/parallel/test-crypto.js index 5033e8cb9dfee8..d8a5099bbd80ea 100644 --- a/test/parallel/test-crypto.js +++ b/test/parallel/test-crypto.js @@ -2,12 +2,11 @@ var common = require('../common'); var assert = require('assert'); var util = require('util'); -try { - var crypto = require('crypto'); -} catch (e) { - console.log('Not compiled with OPENSSL support.'); +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); process.exit(); } +var crypto = require('crypto'); crypto.DEFAULT_ENCODING = 'buffer'; diff --git a/test/parallel/test-http-curl-chunk-problem.js b/test/parallel/test-http-curl-chunk-problem.js index fd429c6d5fd9ac..58e195d4b4168a 100644 --- a/test/parallel/test-http-curl-chunk-problem.js +++ b/test/parallel/test-http-curl-chunk-problem.js @@ -1,11 +1,11 @@ -if (!process.versions.openssl) { - console.error('Skipping because node compiled without OpenSSL.'); +var common = require('../common'); +var assert = require('assert'); +if (!common.opensslCli) { + console.error('Skipping because node compiled without OpenSSL CLI.'); process.exit(0); } // http://groups.google.com/group/nodejs/browse_thread/thread/f66cd3c960406919 -var common = require('../common'); -var assert = require('assert'); var http = require('http'); var cp = require('child_process'); var fs = require('fs'); @@ -16,7 +16,7 @@ var count = 0; function maybeMakeRequest() { if (++count < 2) return; console.log('making curl request'); - var cmd = 'curl http://127.0.0.1:' + common.PORT + '/ | openssl sha1'; + var cmd = 'curl http://127.0.0.1:' + common.PORT + '/ | ' + common.opensslCli + ' sha1'; cp.exec(cmd, function(err, stdout, stderr) { if (err) throw err; var hex = stdout.match(/([A-Fa-f0-9]{40})/)[0]; diff --git a/test/parallel/test-http-default-port.js b/test/parallel/test-http-default-port.js index 29ade45bb4496a..5f702073121128 100644 --- a/test/parallel/test-http-default-port.js +++ b/test/parallel/test-http-default-port.js @@ -1,6 +1,5 @@ var common = require('../common'); var http = require('http'), - https = require('https'), PORT = common.PORT, SSLPORT = common.PORT + 1, assert = require('assert'), @@ -15,15 +14,21 @@ var http = require('http'), gotHttpsResp = false, gotHttpResp = false; +if (common.hasCrypto) { + var https = require('https'); +} else { + console.log('1..0 # Skipped: missing crypto'); +} + process.on('exit', function() { - assert(gotHttpsResp); + if (common.hasCrypto) { + assert(gotHttpsResp); + } assert(gotHttpResp); console.log('ok'); }); http.globalAgent.defaultPort = PORT; -https.globalAgent.defaultPort = SSLPORT; - http.createServer(function(req, res) { assert.equal(req.headers.host, hostExpect); assert.equal(req.headers['x-port'], PORT); @@ -42,21 +47,24 @@ http.createServer(function(req, res) { }); }); -https.createServer(options, function(req, res) { - assert.equal(req.headers.host, hostExpect); - assert.equal(req.headers['x-port'], SSLPORT); - res.writeHead(200); - res.end('ok'); - this.close(); -}).listen(SSLPORT, function() { - var req = https.get({ - host: 'localhost', - rejectUnauthorized: false, - headers: { - 'x-port': SSLPORT - } - }, function(res) { - gotHttpsResp = true; - res.resume(); +if (common.hasCrypto) { + https.globalAgent.defaultPort = SSLPORT; + https.createServer(options, function(req, res) { + assert.equal(req.headers.host, hostExpect); + assert.equal(req.headers['x-port'], SSLPORT); + res.writeHead(200); + res.end('ok'); + this.close(); + }).listen(SSLPORT, function() { + var req = https.get({ + host: 'localhost', + rejectUnauthorized: false, + headers: { + 'x-port': SSLPORT + } + }, function(res) { + gotHttpsResp = true; + res.resume(); + }); }); -}); +} diff --git a/test/parallel/test-http-dns-error.js b/test/parallel/test-http-dns-error.js index a016c9883e0067..15547cd39450d1 100644 --- a/test/parallel/test-http-dns-error.js +++ b/test/parallel/test-http-dns-error.js @@ -2,7 +2,12 @@ var common = require('../common'); var assert = require('assert'); var http = require('http'); -var https = require('https'); + +if (common.hasCrypto) { + var https = require('https'); +} else { + console.log('1..0 # Skipped: missing crypto'); +} var expected_bad_requests = 0; var actual_bad_requests = 0; @@ -38,10 +43,14 @@ function test(mod) { req.end(); } -test(https); +if (common.hasCrypto) { + test(https); +} else { + console.log('1..0 # Skipped: missing crypto'); +} + test(http); process.on('exit', function() { assert.equal(actual_bad_requests, expected_bad_requests); }); - diff --git a/test/parallel/test-http-host-headers.js b/test/parallel/test-http-host-headers.js index 288fc03354cf5e..10e50306609d67 100644 --- a/test/parallel/test-http-host-headers.js +++ b/test/parallel/test-http-host-headers.js @@ -1,14 +1,7 @@ var http = require('http'), - https = require('https'), - fs = require('fs'), common = require('../common'), assert = require('assert'), - options = { - key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'), - cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem') - }, - httpServer = http.createServer(reqHandler), - httpsServer = https.createServer(options, reqHandler); + httpServer = http.createServer(reqHandler); function reqHandler(req, res) { console.log('Got request: ' + req.headers.host + ' ' + req.url); @@ -41,7 +34,6 @@ function testHttp() { console.log('back from http request. counter = ' + counter); if (counter === 0) { httpServer.close(); - testHttps(); } res.resume(); } @@ -97,78 +89,3 @@ function testHttp() { }, cb).on('error', thrower).end(); }); } - -function testHttps() { - - console.log('testing https on port ' + common.PORT); - - var counter = 0; - - function cb(res) { - counter--; - console.log('back from https request. counter = ' + counter); - if (counter === 0) { - httpsServer.close(); - console.log('ok'); - } - res.resume(); - } - - httpsServer.listen(common.PORT, function(er) { - if (er) throw er; - - https.get({ - method: 'GET', - path: '/' + (counter++), - host: 'localhost', - //agent: false, - port: common.PORT, - rejectUnauthorized: false - }, cb).on('error', thrower); - - https.request({ - method: 'GET', - path: '/' + (counter++), - host: 'localhost', - //agent: false, - port: common.PORT, - rejectUnauthorized: false - }, cb).on('error', thrower).end(); - - https.request({ - method: 'POST', - path: '/' + (counter++), - host: 'localhost', - //agent: false, - port: common.PORT, - rejectUnauthorized: false - }, cb).on('error', thrower).end(); - - https.request({ - method: 'PUT', - path: '/' + (counter++), - host: 'localhost', - //agent: false, - port: common.PORT, - rejectUnauthorized: false - }, cb).on('error', thrower).end(); - - https.request({ - method: 'DELETE', - path: '/' + (counter++), - host: 'localhost', - //agent: false, - port: common.PORT, - rejectUnauthorized: false - }, cb).on('error', thrower).end(); - - https.get({ - method: 'GET', - path: '/setHostFalse' + (counter++), - host: 'localhost', - setHost: false, - port: common.PORT, - rejectUnauthorized: false - }, cb).on('error', thrower).end(); - }); -} diff --git a/test/parallel/test-http-url.parse-https.request.js b/test/parallel/test-http-url.parse-https.request.js index cda01be53a6aae..44287bc6b974dd 100644 --- a/test/parallel/test-http-url.parse-https.request.js +++ b/test/parallel/test-http-url.parse-https.request.js @@ -1,6 +1,12 @@ var common = require('../common'); var assert = require('assert'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var https = require('https'); + var url = require('url'); var fs = require('fs'); var clientRequest; diff --git a/test/parallel/test-http-url.parse-post.js b/test/parallel/test-http-url.parse-post.js index 4cc3b3e04f83b0..ae6a85da0ec395 100644 --- a/test/parallel/test-http-url.parse-post.js +++ b/test/parallel/test-http-url.parse-post.js @@ -1,7 +1,6 @@ var common = require('../common'); var assert = require('assert'); var http = require('http'); -var https = require('https'); var url = require('url'); var testURL = url.parse('http://localhost:' + common.PORT + '/asdf?qwer=zxcv'); diff --git a/test/parallel/test-http-url.parse-search.js b/test/parallel/test-http-url.parse-search.js index 96402e1cebfbcb..16b65d2f94a3ea 100644 --- a/test/parallel/test-http-url.parse-search.js +++ b/test/parallel/test-http-url.parse-search.js @@ -1,7 +1,6 @@ var common = require('../common'); var assert = require('assert'); var http = require('http'); -var https = require('https'); var url = require('url'); var testURL = url.parse('http://localhost:' + common.PORT + '/asdf?qwer=zxcv'); diff --git a/test/parallel/test-https-agent.js b/test/parallel/test-https-agent.js index 92ceb4e23d0b25..15604f74e5fc75 100644 --- a/test/parallel/test-https-agent.js +++ b/test/parallel/test-https-agent.js @@ -1,11 +1,12 @@ -if (!process.versions.openssl) { - console.error('Skipping because node compiled without OpenSSL.'); - process.exit(0); -} - var common = require('../common'); var assert = require('assert'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var https = require('https'); + var fs = require('fs'); var options = { diff --git a/test/parallel/test-https-byteswritten.js b/test/parallel/test-https-byteswritten.js index 02ccf2711344d8..5c657b26076499 100644 --- a/test/parallel/test-https-byteswritten.js +++ b/test/parallel/test-https-byteswritten.js @@ -1,12 +1,12 @@ -if (!process.versions.openssl) { - console.error('Skipping because node compiled without OpenSSL.'); - process.exit(0); -} - var common = require('../common'); var assert = require('assert'); var fs = require('fs'); var http = require('http'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var https = require('https'); var options = { diff --git a/test/parallel/test-https-client-checkServerIdentity.js b/test/parallel/test-https-client-checkServerIdentity.js index a379ab0784f037..c7bffc90002291 100644 --- a/test/parallel/test-https-client-checkServerIdentity.js +++ b/test/parallel/test-https-client-checkServerIdentity.js @@ -1,11 +1,12 @@ -if (!process.versions.openssl) { - console.error('Skipping because node compiled without OpenSSL.'); - process.exit(0); -} - var common = require('../common'); var assert = require('assert'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var https = require('https'); + var fs = require('fs'); var path = require('path'); diff --git a/test/parallel/test-https-client-get-url.js b/test/parallel/test-https-client-get-url.js index dc03ead2438d24..01cea20242e710 100644 --- a/test/parallel/test-https-client-get-url.js +++ b/test/parallel/test-https-client-get-url.js @@ -1,14 +1,15 @@ -if (!process.versions.openssl) { - console.error('Skipping because node compiled without OpenSSL.'); - process.exit(0); -} - // disable strict server certificate validation by the client process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; var common = require('../common'); var assert = require('assert'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var https = require('https'); + var fs = require('fs'); var seen_req = false; diff --git a/test/parallel/test-https-client-reject.js b/test/parallel/test-https-client-reject.js index bd086bc77fcdc7..d3fcae7befebb4 100644 --- a/test/parallel/test-https-client-reject.js +++ b/test/parallel/test-https-client-reject.js @@ -1,11 +1,12 @@ -if (!process.versions.openssl) { - console.error('Skipping because node compiled without OpenSSL.'); - process.exit(0); -} - var common = require('../common'); var assert = require('assert'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var https = require('https'); + var fs = require('fs'); var path = require('path'); diff --git a/test/parallel/test-https-client-resume.js b/test/parallel/test-https-client-resume.js index bb4e7369511639..974db0f59775cf 100644 --- a/test/parallel/test-https-client-resume.js +++ b/test/parallel/test-https-client-resume.js @@ -1,15 +1,15 @@ // Create an ssl server. First connection, validate that not resume. // Cache session and close connection. Use session on second connection. // ASSERT resumption. - -if (!process.versions.openssl) { - console.error('Skipping because node compiled without OpenSSL.'); - process.exit(0); -} - var common = require('../common'); var assert = require('assert'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var https = require('https'); + var tls = require('tls'); var fs = require('fs'); diff --git a/test/parallel/test-https-connecting-to-http.js b/test/parallel/test-https-connecting-to-http.js index 584d8af2233661..eb0ea40dc9c35a 100644 --- a/test/parallel/test-https-connecting-to-http.js +++ b/test/parallel/test-https-connecting-to-http.js @@ -2,9 +2,13 @@ // to an http server. You should get an error and exit. var common = require('../common'); var assert = require('assert'); -var https = require('https'); var http = require('http'); +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} +var https = require('https'); var reqCount = 0; var resCount = 0; diff --git a/test/parallel/test-https-drain.js b/test/parallel/test-https-drain.js index 60abd1441077be..f2ea3fb4e44be2 100644 --- a/test/parallel/test-https-drain.js +++ b/test/parallel/test-https-drain.js @@ -1,11 +1,12 @@ -if (!process.versions.openssl) { - console.error('Skipping because node compiled without OpenSSL.'); - process.exit(0); -} - var common = require('../common'); var assert = require('assert'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var https = require('https'); + var fs = require('fs'); var path = require('path'); diff --git a/test/parallel/test-https-eof-for-eom.js b/test/parallel/test-https-eof-for-eom.js index 126fecc68514d3..14e087874e2285 100644 --- a/test/parallel/test-https-eof-for-eom.js +++ b/test/parallel/test-https-eof-for-eom.js @@ -5,15 +5,17 @@ // // This test is to be sure that the https client is handling this case // correctly. -if (!process.versions.openssl) { - console.error('Skipping because node compiled without OpenSSL.'); - process.exit(0); -} var common = require('../common'); var assert = require('assert'); -var tls = require('tls'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var https = require('https'); +var tls = require('tls'); + var fs = require('fs'); var options = { @@ -77,4 +79,3 @@ process.on('exit', function() { assert.ok(gotEnd); assert.equal('hello world\nhello world\n', bodyBuffer); }); - diff --git a/test/parallel/test-https-foafssl.js b/test/parallel/test-https-foafssl.js index f785b545203ebb..9d8d34dd791a75 100644 --- a/test/parallel/test-https-foafssl.js +++ b/test/parallel/test-https-foafssl.js @@ -11,6 +11,10 @@ var join = require('path').join; var fs = require('fs'); var spawn = require('child_process').spawn; +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var https = require('https'); var options = { diff --git a/test/parallel/test-https-host-headers.js b/test/parallel/test-https-host-headers.js new file mode 100644 index 00000000000000..b8bcb407f1bebb --- /dev/null +++ b/test/parallel/test-https-host-headers.js @@ -0,0 +1,110 @@ +var common = require('../common'); +var assert = require('assert'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} +var https = require('https'); + +var fs = require('fs'), + options = { + key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'), + cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem') + }, + httpsServer = https.createServer(options, reqHandler); + +function reqHandler(req, res) { + console.log('Got request: ' + req.headers.host + ' ' + req.url); + if (req.url === '/setHostFalse5') { + assert.equal(req.headers.host, undefined); + } else { + assert.equal(req.headers.host, 'localhost:' + common.PORT, + 'Wrong host header for req[' + req.url + ']: ' + + req.headers.host); + } + res.writeHead(200, {}); + //process.nextTick(function() { res.end('ok'); }); + res.end('ok'); +} + +function thrower(er) { + throw er; +} + +testHttps(); + +function testHttps() { + + console.log('testing https on port ' + common.PORT); + + var counter = 0; + + function cb(res) { + counter--; + console.log('back from https request. counter = ' + counter); + if (counter === 0) { + httpsServer.close(); + console.log('ok'); + } + res.resume(); + } + + httpsServer.listen(common.PORT, function(er) { + if (er) throw er; + + https.get({ + method: 'GET', + path: '/' + (counter++), + host: 'localhost', + //agent: false, + port: common.PORT, + rejectUnauthorized: false + }, cb).on('error', thrower); + + https.request({ + method: 'GET', + path: '/' + (counter++), + host: 'localhost', + //agent: false, + port: common.PORT, + rejectUnauthorized: false + }, cb).on('error', thrower).end(); + + https.request({ + method: 'POST', + path: '/' + (counter++), + host: 'localhost', + //agent: false, + port: common.PORT, + rejectUnauthorized: false + }, cb).on('error', thrower).end(); + + https.request({ + method: 'PUT', + path: '/' + (counter++), + host: 'localhost', + //agent: false, + port: common.PORT, + rejectUnauthorized: false + }, cb).on('error', thrower).end(); + + https.request({ + method: 'DELETE', + path: '/' + (counter++), + host: 'localhost', + //agent: false, + port: common.PORT, + rejectUnauthorized: false + }, cb).on('error', thrower).end(); + + https.get({ + method: 'GET', + path: '/setHostFalse' + (counter++), + host: 'localhost', + setHost: false, + port: common.PORT, + rejectUnauthorized: false + }, cb).on('error', thrower).end(); + }); +} diff --git a/test/parallel/test-https-localaddress-bind-error.js b/test/parallel/test-https-localaddress-bind-error.js index 6a8790b0775d3c..153233f1a691fb 100644 --- a/test/parallel/test-https-localaddress-bind-error.js +++ b/test/parallel/test-https-localaddress-bind-error.js @@ -1,8 +1,13 @@ var common = require('../common'); var assert = require('assert'); -var https = require('https'); var fs = require('fs'); +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} +var https = require('https'); + var options = { key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'), cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem') diff --git a/test/parallel/test-https-localaddress.js b/test/parallel/test-https-localaddress.js index 9eeebef95f4e3f..b3b1d2cb942e07 100644 --- a/test/parallel/test-https-localaddress.js +++ b/test/parallel/test-https-localaddress.js @@ -1,8 +1,13 @@ -var common = require('../common'); -var https = require('https'), +var common = require('../common'), fs = require('fs'), assert = require('assert'); +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} +var https = require('https'); + if (!common.hasMultiLocalhost()) { console.log('Skipping platform-specific test.'); process.exit(); diff --git a/test/parallel/test-https-pfx.js b/test/parallel/test-https-pfx.js index 4f9b1da80d8967..30dbea6ad0975e 100644 --- a/test/parallel/test-https-pfx.js +++ b/test/parallel/test-https-pfx.js @@ -1,8 +1,13 @@ var common = require('../common'); var assert = require('assert'); -var https = require('https'); var fs = require('fs'); +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} +var https = require('https'); + var pfx = fs.readFileSync(common.fixturesDir + '/test_cert.pfx'); var options = { diff --git a/test/parallel/test-https-req-split.js b/test/parallel/test-https-req-split.js index 2867b0b4d954f0..210363e430b9f1 100644 --- a/test/parallel/test-https-req-split.js +++ b/test/parallel/test-https-req-split.js @@ -1,14 +1,15 @@ -if (!process.versions.openssl) { - console.error('Skipping because node compiled without OpenSSL.'); - process.exit(0); -} - // disable strict server certificate validation by the client process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; var common = require('../common'); var assert = require('assert'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var https = require('https'); + var tls = require('tls'); var fs = require('fs'); diff --git a/test/parallel/test-https-set-timeout-server.js b/test/parallel/test-https-set-timeout-server.js index c5058e521180ba..5ae8baee6940d7 100644 --- a/test/parallel/test-https-set-timeout-server.js +++ b/test/parallel/test-https-set-timeout-server.js @@ -1,6 +1,12 @@ var common = require('../common'); var assert = require('assert'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var https = require('https'); + var tls = require('tls'); var fs = require('fs'); diff --git a/test/parallel/test-https-simple.js b/test/parallel/test-https-simple.js index d1f681ae46f0ad..840838b83e4787 100644 --- a/test/parallel/test-https-simple.js +++ b/test/parallel/test-https-simple.js @@ -1,16 +1,15 @@ -if (!process.versions.openssl) { - console.error('Skipping because node compiled without OpenSSL.'); - process.exit(0); -} - var common = require('../common'); var assert = require('assert'); +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} +var https = require('https'); + var fs = require('fs'); var exec = require('child_process').exec; -var https = require('https'); - var options = { key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'), cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem') diff --git a/test/parallel/test-https-socket-options.js b/test/parallel/test-https-socket-options.js index 3e30da0599f1f8..eef94765a52bf1 100644 --- a/test/parallel/test-https-socket-options.js +++ b/test/parallel/test-https-socket-options.js @@ -1,16 +1,16 @@ -if (!process.versions.openssl) { - console.error('Skipping because node compiled without OpenSSL.'); - process.exit(0); -} - var common = require('../common'); var assert = require('assert'); +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} +var https = require('https'); + var fs = require('fs'); var exec = require('child_process').exec; var http = require('http'); -var https = require('https'); var options = { key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'), diff --git a/test/parallel/test-https-strict.js b/test/parallel/test-https-strict.js index e00cf90a0dc283..b2620fa88b236c 100644 --- a/test/parallel/test-https-strict.js +++ b/test/parallel/test-https-strict.js @@ -1,17 +1,17 @@ -if (!process.versions.openssl) { - console.error('Skipping because node compiled without OpenSSL.'); - process.exit(0); -} - // disable strict server certificate validation by the client process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; var common = require('../common'); var assert = require('assert'); +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} +var https = require('https'); + var fs = require('fs'); var path = require('path'); -var https = require('https'); function file(fname) { return path.resolve(common.fixturesDir, 'keys', fname); diff --git a/test/parallel/test-https-timeout-server-2.js b/test/parallel/test-https-timeout-server-2.js index 124395fa7ee7c3..d802ad4ae9b4a3 100644 --- a/test/parallel/test-https-timeout-server-2.js +++ b/test/parallel/test-https-timeout-server-2.js @@ -1,8 +1,13 @@ -if (!process.versions.openssl) process.exit(); var common = require('../common'); var assert = require('assert'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var https = require('https'); + var net = require('net'); var tls = require('tls'); var fs = require('fs'); diff --git a/test/parallel/test-https-timeout-server.js b/test/parallel/test-https-timeout-server.js index 120075053402a4..a24779ac7658b1 100644 --- a/test/parallel/test-https-timeout-server.js +++ b/test/parallel/test-https-timeout-server.js @@ -1,8 +1,12 @@ -if (!process.versions.openssl) process.exit(); - var common = require('../common'); var assert = require('assert'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var https = require('https'); + var net = require('net'); var tls = require('tls'); var fs = require('fs'); diff --git a/test/parallel/test-https-timeout.js b/test/parallel/test-https-timeout.js index 88b311f74a94ff..c03cb013d599b7 100644 --- a/test/parallel/test-https-timeout.js +++ b/test/parallel/test-https-timeout.js @@ -1,13 +1,14 @@ -if (!process.versions.openssl) { - console.error('Skipping because node compiled without OpenSSL.'); - process.exit(0); -} - var common = require('../common'); var assert = require('assert'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} +var https = require('https'); + var fs = require('fs'); var exec = require('child_process').exec; -var https = require('https'); var options = { key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'), diff --git a/test/parallel/test-https-truncate.js b/test/parallel/test-https-truncate.js index 2dc69a260452a1..6a58bfe7715321 100644 --- a/test/parallel/test-https-truncate.js +++ b/test/parallel/test-https-truncate.js @@ -1,8 +1,13 @@ var common = require('../common'); var assert = require('assert'); -var fs = require('fs'); +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var https = require('https'); + +var fs = require('fs'); var path = require('path'); var resultFile = path.resolve(common.tmpDir, 'result'); diff --git a/test/parallel/test-process-versions.js b/test/parallel/test-process-versions.js index 63bf6d1665cb55..c3159789cefeae 100644 --- a/test/parallel/test-process-versions.js +++ b/test/parallel/test-process-versions.js @@ -1,7 +1,11 @@ -require('../common'); +var common = require('../common'); var assert = require('assert'); var expected_keys = ['ares', 'http_parser', 'modules', 'node', - 'openssl', 'uv', 'v8', 'zlib']; + 'uv', 'v8', 'zlib']; -assert.deepEqual(Object.keys(process.versions).sort(), expected_keys); +if (common.hasCrypto) { + expected_keys.push('openssl'); +} + +assert.deepEqual(Object.keys(process.versions).sort(), expected_keys.sort()); diff --git a/test/parallel/test-stream2-unpipe-drain.js b/test/parallel/test-stream2-unpipe-drain.js index d593b6a68f7e94..12d1c0648d2345 100644 --- a/test/parallel/test-stream2-unpipe-drain.js +++ b/test/parallel/test-stream2-unpipe-drain.js @@ -1,6 +1,11 @@ var common = require('../common'); var assert = require('assert'); var stream = require('stream'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var crypto = require('crypto'); var util = require('util'); diff --git a/test/parallel/test-tls-0-dns-altname.js b/test/parallel/test-tls-0-dns-altname.js index fb4d250abbbac5..0d01805154255a 100644 --- a/test/parallel/test-tls-0-dns-altname.js +++ b/test/parallel/test-tls-0-dns-altname.js @@ -1,12 +1,14 @@ -if (!process.versions.openssl) { - console.error('Skipping because node compiled without OpenSSL.'); - process.exit(0); +var common = require('../common'); +var assert = require('assert'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); } +var tls = require('tls'); -var assert = require('assert'); var fs = require('fs'); var net = require('net'); -var tls = require('tls'); var common = require('../common'); diff --git a/test/parallel/test-tls-alert.js b/test/parallel/test-tls-alert.js index 4882ba09524114..a96a104f24d3d2 100644 --- a/test/parallel/test-tls-alert.js +++ b/test/parallel/test-tls-alert.js @@ -1,13 +1,18 @@ var common = require('../common'); +var assert = require('assert'); if (!common.opensslCli) { console.error('Skipping because node compiled without OpenSSL CLI.'); process.exit(0); } -var assert = require('assert'); -var fs = require('fs'); +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var tls = require('tls'); + +var fs = require('fs'); var spawn = require('child_process').spawn; var success = false; diff --git a/test/parallel/test-tls-cert-regression.js b/test/parallel/test-tls-cert-regression.js index 9076c02771bc84..c7b1742856aead 100644 --- a/test/parallel/test-tls-cert-regression.js +++ b/test/parallel/test-tls-cert-regression.js @@ -1,12 +1,12 @@ -if (!process.versions.openssl) { - console.error('Skipping because node compiled without OpenSSL.'); - process.exit(0); -} +var assert = require('assert'); +var common = require('../common'); +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var tls = require('tls'); -var assert = require('assert'); -var common = require('../common'); var cert = '-----BEGIN CERTIFICATE-----\n' + 'MIIBfjCCASgCCQDmmNjAojbDQjANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQGEwJB\n' + diff --git a/test/parallel/test-tls-check-server-identity.js b/test/parallel/test-tls-check-server-identity.js index d78d4725ecf689..85413b62e3d591 100644 --- a/test/parallel/test-tls-check-server-identity.js +++ b/test/parallel/test-tls-check-server-identity.js @@ -1,8 +1,14 @@ var common = require('../common'); var assert = require('assert'); var util = require('util'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var tls = require('tls'); + var tests = [ // Basic CN handling { host: 'a.com', cert: { subject: { CN: 'a.com' } } }, diff --git a/test/parallel/test-tls-client-abort.js b/test/parallel/test-tls-client-abort.js index d84363aa9c367a..a2a4bba5bbd28c 100644 --- a/test/parallel/test-tls-client-abort.js +++ b/test/parallel/test-tls-client-abort.js @@ -1,12 +1,13 @@ -if (!process.versions.openssl) { - console.error('Skipping because node compiled without OpenSSL.'); - process.exit(0); -} - var common = require('../common'); var assert = require('assert'); -var fs = require('fs'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var tls = require('tls'); + +var fs = require('fs'); var path = require('path'); var cert = fs.readFileSync(path.join(common.fixturesDir, 'test_cert.pem')); @@ -20,4 +21,3 @@ conn.on('error', function() { assert.doesNotThrow(function() { conn.destroy(); }); - diff --git a/test/parallel/test-tls-client-abort2.js b/test/parallel/test-tls-client-abort2.js index 39a7d598125806..7874d3d25acd56 100644 --- a/test/parallel/test-tls-client-abort2.js +++ b/test/parallel/test-tls-client-abort2.js @@ -1,10 +1,10 @@ -if (!process.versions.openssl) { - console.error('Skipping because node compiled without OpenSSL.'); - process.exit(0); -} - var common = require('../common'); var assert = require('assert'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var tls = require('tls'); var errors = 0; diff --git a/test/parallel/test-tls-client-default-ciphers.js b/test/parallel/test-tls-client-default-ciphers.js index dfae4a7bb9a9e5..e1422bac6f3662 100644 --- a/test/parallel/test-tls-client-default-ciphers.js +++ b/test/parallel/test-tls-client-default-ciphers.js @@ -1,5 +1,10 @@ var assert = require('assert'); var common = require('../common'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var tls = require('tls'); function Done() {} diff --git a/test/parallel/test-tls-client-destroy-soon.js b/test/parallel/test-tls-client-destroy-soon.js index 640b13919121e4..08b261a7222e0c 100644 --- a/test/parallel/test-tls-client-destroy-soon.js +++ b/test/parallel/test-tls-client-destroy-soon.js @@ -2,14 +2,15 @@ // Cache session and close connection. Use session on second connection. // ASSERT resumption. -if (!process.versions.openssl) { - console.error('Skipping because node compiled without OpenSSL.'); - process.exit(0); -} - var common = require('../common'); var assert = require('assert'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var tls = require('tls'); + var fs = require('fs'); var options = { diff --git a/test/parallel/test-tls-client-reject.js b/test/parallel/test-tls-client-reject.js index 5fba3793e7d828..887ff283ad0a52 100644 --- a/test/parallel/test-tls-client-reject.js +++ b/test/parallel/test-tls-client-reject.js @@ -1,11 +1,12 @@ -if (!process.versions.openssl) { - console.error('Skipping because node compiled without OpenSSL.'); - process.exit(0); -} - var common = require('../common'); var assert = require('assert'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var tls = require('tls'); + var fs = require('fs'); var path = require('path'); diff --git a/test/parallel/test-tls-client-resume.js b/test/parallel/test-tls-client-resume.js index d5873fd9b2c02c..75d96b69335d84 100644 --- a/test/parallel/test-tls-client-resume.js +++ b/test/parallel/test-tls-client-resume.js @@ -2,14 +2,15 @@ // Cache session and close connection. Use session on second connection. // ASSERT resumption. -if (!process.versions.openssl) { - console.error('Skipping because node compiled without OpenSSL.'); - process.exit(0); -} - var common = require('../common'); var assert = require('assert'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var tls = require('tls'); + var fs = require('fs'); var options = { diff --git a/test/parallel/test-tls-client-verify.js b/test/parallel/test-tls-client-verify.js index a11fc93cebe7c4..bdbde6f9931175 100644 --- a/test/parallel/test-tls-client-verify.js +++ b/test/parallel/test-tls-client-verify.js @@ -1,8 +1,13 @@ -if (!process.versions.openssl) { - console.error('Skipping because node compiled without OpenSSL.'); - process.exit(0); +var common = require('../common'); +var assert = require('assert'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); } +var tls = require('tls'); +var fs = require('fs'); var hosterr = /Hostname\/IP doesn\'t match certificate\'s altnames/g; var testCases = @@ -37,13 +42,6 @@ var testCases = } ]; - -var common = require('../common'); -var assert = require('assert'); -var fs = require('fs'); -var tls = require('tls'); - - function filenamePEM(n) { return require('path').join(common.fixturesDir, 'keys', n + '.pem'); } diff --git a/test/parallel/test-tls-close-notify.js b/test/parallel/test-tls-close-notify.js index c5decad5e51fb8..3960a62694042e 100644 --- a/test/parallel/test-tls-close-notify.js +++ b/test/parallel/test-tls-close-notify.js @@ -1,14 +1,14 @@ -if (!process.versions.openssl) { - console.error('Skipping because node compiled without OpenSSL.'); - process.exit(0); +var assert = require('assert'); +var common = require('../common'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); } +var tls = require('tls'); -var assert = require('assert'); var fs = require('fs'); var net = require('net'); -var tls = require('tls'); - -var common = require('../common'); var ended = 0; diff --git a/test/parallel/test-tls-connect-given-socket.js b/test/parallel/test-tls-connect-given-socket.js index 097dbdd3fee957..e309d824aba201 100644 --- a/test/parallel/test-tls-connect-given-socket.js +++ b/test/parallel/test-tls-connect-given-socket.js @@ -1,6 +1,12 @@ var common = require('../common'); var assert = require('assert'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var tls = require('tls'); + var net = require('net'); var fs = require('fs'); var path = require('path'); diff --git a/test/parallel/test-tls-connect-pipe.js b/test/parallel/test-tls-connect-pipe.js index 8d2e4a19131ee2..70daa0d75ab047 100644 --- a/test/parallel/test-tls-connect-pipe.js +++ b/test/parallel/test-tls-connect-pipe.js @@ -1,6 +1,12 @@ var common = require('../common'); var assert = require('assert'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var tls = require('tls'); + var fs = require('fs'); var clientConnected = 0; diff --git a/test/parallel/test-tls-connect-simple.js b/test/parallel/test-tls-connect-simple.js index a982781a2e5b28..04eb5f408a6b81 100644 --- a/test/parallel/test-tls-connect-simple.js +++ b/test/parallel/test-tls-connect-simple.js @@ -1,6 +1,12 @@ var common = require('../common'); var assert = require('assert'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var tls = require('tls'); + var fs = require('fs'); var clientConnected = 0; diff --git a/test/parallel/test-tls-connect.js b/test/parallel/test-tls-connect.js index daec1b8a6f70fb..f74dc089533c00 100644 --- a/test/parallel/test-tls-connect.js +++ b/test/parallel/test-tls-connect.js @@ -1,12 +1,13 @@ -if (!process.versions.openssl) { - console.error('Skipping because node compiled without OpenSSL.'); - process.exit(0); -} - var common = require('../common'); var assert = require('assert'); -var fs = require('fs'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var tls = require('tls'); + +var fs = require('fs'); var path = require('path'); // https://github.com/joyent/node/issues/1218 diff --git a/test/parallel/test-tls-delayed-attach.js b/test/parallel/test-tls-delayed-attach.js index d4ebc22d077b8f..fba10ceffd97bd 100644 --- a/test/parallel/test-tls-delayed-attach.js +++ b/test/parallel/test-tls-delayed-attach.js @@ -1,14 +1,14 @@ -if (!process.versions.openssl) { - console.error('Skipping because node compiled without OpenSSL.'); - process.exit(0); +var common = require('../common'); +var assert = require('assert'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); } +var tls = require('tls'); -var assert = require('assert'); var fs = require('fs'); var net = require('net'); -var tls = require('tls'); - -var common = require('../common'); var sent = 'hello world'; var received = ''; diff --git a/test/parallel/test-tls-dhe.js b/test/parallel/test-tls-dhe.js index af0db51b67c8a5..eb59c84957b52d 100644 --- a/test/parallel/test-tls-dhe.js +++ b/test/parallel/test-tls-dhe.js @@ -1,13 +1,13 @@ var common = require('../common'); +var assert = require('assert'); -if (!common.opensslCli) { - console.error('Skipping because node compiled without OpenSSL CLI.'); - process.exit(0); +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); } +var tls = require('tls'); -var assert = require('assert'); var spawn = require('child_process').spawn; -var tls = require('tls'); var fs = require('fs'); var key = fs.readFileSync(common.fixturesDir + '/keys/agent2-key.pem'); var cert = fs.readFileSync(common.fixturesDir + '/keys/agent2-cert.pem'); diff --git a/test/parallel/test-tls-ecdh-disable.js b/test/parallel/test-tls-ecdh-disable.js index 3b7c8539df39d1..e479a7e21b238f 100644 --- a/test/parallel/test-tls-ecdh-disable.js +++ b/test/parallel/test-tls-ecdh-disable.js @@ -1,13 +1,13 @@ var common = require('../common'); +var assert = require('assert'); -if (!common.opensslCli) { - console.error('Skipping because node compiled without OpenSSL CLI.'); - process.exit(0); +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); } +var tls = require('tls'); -var assert = require('assert'); var exec = require('child_process').exec; -var tls = require('tls'); var fs = require('fs'); var options = { diff --git a/test/parallel/test-tls-ecdh.js b/test/parallel/test-tls-ecdh.js index 247ca497f0eed8..55023aad5ad0f6 100644 --- a/test/parallel/test-tls-ecdh.js +++ b/test/parallel/test-tls-ecdh.js @@ -1,13 +1,13 @@ var common = require('../common'); +var assert = require('assert'); -if (!common.opensslCli) { - console.error('Skipping because node compiled without OpenSSL CLI.'); - process.exit(0); +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); } +var tls = require('tls'); -var assert = require('assert'); var exec = require('child_process').exec; -var tls = require('tls'); var fs = require('fs'); var options = { diff --git a/test/parallel/test-tls-econnreset.js b/test/parallel/test-tls-econnreset.js index 78548c415c17d2..c339fc5be60a61 100644 --- a/test/parallel/test-tls-econnreset.js +++ b/test/parallel/test-tls-econnreset.js @@ -1,10 +1,10 @@ -if (!process.versions.openssl) { - console.error('Skipping because node compiled without OpenSSL.'); - process.exit(0); -} - var common = require('../common'); var assert = require('assert'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var tls = require('tls'); var cacert = '-----BEGIN CERTIFICATE-----\n' + diff --git a/test/parallel/test-tls-fast-writing.js b/test/parallel/test-tls-fast-writing.js index 812593ac7767d8..7fd3c8f9dcd95e 100644 --- a/test/parallel/test-tls-fast-writing.js +++ b/test/parallel/test-tls-fast-writing.js @@ -1,7 +1,12 @@ var common = require('../common'); var assert = require('assert'); +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var tls = require('tls'); + var fs = require('fs'); var PORT = common.PORT; diff --git a/test/parallel/test-tls-friendly-error-message.js b/test/parallel/test-tls-friendly-error-message.js index 586e693ac18a1f..efff0c66a3169b 100644 --- a/test/parallel/test-tls-friendly-error-message.js +++ b/test/parallel/test-tls-friendly-error-message.js @@ -1,13 +1,14 @@ -if (!process.versions.openssl) { - console.error('Skipping because node compiled without OpenSSL.'); - process.exit(0); -} - var common = require('../common'); var assert = require('assert'); -var fs = require('fs'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var tls = require('tls'); +var fs = require('fs'); + var key = fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'); var cert = fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem'); diff --git a/test/parallel/test-tls-getcipher.js b/test/parallel/test-tls-getcipher.js index 05da2ca718684a..414010c0336e7e 100644 --- a/test/parallel/test-tls-getcipher.js +++ b/test/parallel/test-tls-getcipher.js @@ -1,6 +1,12 @@ var common = require('../common'); var assert = require('assert'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var tls = require('tls'); + var fs = require('fs'); var cipher_list = ['RC4-SHA', 'AES256-SHA']; var cipher_version_pattern = /TLS|SSL/; diff --git a/test/parallel/test-tls-handshake-nohang.js b/test/parallel/test-tls-handshake-nohang.js index 781dc3e182f8a4..73869892fb9ff7 100644 --- a/test/parallel/test-tls-handshake-nohang.js +++ b/test/parallel/test-tls-handshake-nohang.js @@ -1,5 +1,10 @@ var common = require('../common'); var assert = require('assert'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var tls = require('tls'); // neither should hang diff --git a/test/parallel/test-tls-hello-parser-failure.js b/test/parallel/test-tls-hello-parser-failure.js index 57d0d80d724ee5..463fdaa44b53e3 100644 --- a/test/parallel/test-tls-hello-parser-failure.js +++ b/test/parallel/test-tls-hello-parser-failure.js @@ -1,8 +1,14 @@ var common = require('../common'); +var assert = require('assert'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var tls = require('tls'); + var net = require('net'); var fs = require('fs'); -var assert = require('assert'); var options = { key: fs.readFileSync(common.fixturesDir + '/test_key.pem'), diff --git a/test/parallel/test-tls-inception.js b/test/parallel/test-tls-inception.js index 83b12a69389aca..7fd0b813d6d4c4 100644 --- a/test/parallel/test-tls-inception.js +++ b/test/parallel/test-tls-inception.js @@ -1,14 +1,15 @@ -if (!process.versions.openssl) { - console.error('Skipping because node compiled without OpenSSL.'); - process.exit(0); +var common = require('../common'); +var assert = require('assert'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); } +var tls = require('tls'); -var common = require('../common'); var fs = require('fs'); var path = require('path'); var net = require('net'); -var tls = require('tls'); -var assert = require('assert'); var options, a, b, portA, portB; var gotHello = false; diff --git a/test/parallel/test-tls-interleave.js b/test/parallel/test-tls-interleave.js index 0358c092b901fa..96a7a600381d1b 100644 --- a/test/parallel/test-tls-interleave.js +++ b/test/parallel/test-tls-interleave.js @@ -1,7 +1,12 @@ var common = require('../common'); var assert = require('assert'); +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var tls = require('tls'); + var fs = require('fs'); var PORT = common.PORT; diff --git a/test/parallel/test-tls-invoke-queued.js b/test/parallel/test-tls-invoke-queued.js index 15b4e150605e72..c6e94158829c35 100644 --- a/test/parallel/test-tls-invoke-queued.js +++ b/test/parallel/test-tls-invoke-queued.js @@ -1,14 +1,15 @@ -if (!process.versions.openssl) { - console.error('Skipping because node compiled without OpenSSL.'); - process.exit(0); +var common = require('../common'); +var assert = require('assert'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); } +var tls = require('tls'); -var assert = require('assert'); var fs = require('fs'); var net = require('net'); -var tls = require('tls'); -var common = require('../common'); var received = ''; var ended = 0; diff --git a/test/parallel/test-tls-js-stream.js b/test/parallel/test-tls-js-stream.js index 7caa7e3f1944d7..12c3381cb4fd60 100644 --- a/test/parallel/test-tls-js-stream.js +++ b/test/parallel/test-tls-js-stream.js @@ -1,11 +1,16 @@ +var common = require('../common'); var assert = require('assert'); -var stream = require('stream'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var tls = require('tls'); + +var stream = require('stream'); var fs = require('fs'); var net = require('net'); -var common = require('../common'); - var connected = { client: 0, server: 0 diff --git a/test/parallel/test-tls-junk-closes-server.js b/test/parallel/test-tls-junk-closes-server.js index 4bd20ba9ebf497..3fd129cbf6d470 100644 --- a/test/parallel/test-tls-junk-closes-server.js +++ b/test/parallel/test-tls-junk-closes-server.js @@ -1,10 +1,11 @@ -if (!process.versions.openssl) { - console.error('Skipping because node compiled without OpenSSL.'); - process.exit(0); -} - var common = require('../common'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var tls = require('tls'); + var fs = require('fs'); var net = require('net'); @@ -30,4 +31,3 @@ server.listen(common.PORT, function() { }); }); - diff --git a/test/parallel/test-tls-key-mismatch.js b/test/parallel/test-tls-key-mismatch.js index b49b415ebfddcf..cd7ad605a89675 100644 --- a/test/parallel/test-tls-key-mismatch.js +++ b/test/parallel/test-tls-key-mismatch.js @@ -1,13 +1,12 @@ -if (!process.versions.openssl) { - console.error('Skipping because node compiled without OpenSSL.'); - process.exit(0); -} - var common = require('../common'); var assert = require('assert'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var tls = require('tls'); var fs = require('fs'); -var fs = require('fs'); var options = { key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'), diff --git a/test/parallel/test-tls-max-send-fragment.js b/test/parallel/test-tls-max-send-fragment.js index 3054e8a4e6be73..4033b308acdb71 100644 --- a/test/parallel/test-tls-max-send-fragment.js +++ b/test/parallel/test-tls-max-send-fragment.js @@ -1,12 +1,14 @@ -if (!process.versions.openssl) { - console.error('Skipping because node compiled without OpenSSL.'); - process.exit(0); +var common = require('../common'); +var assert = require('assert'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); } +var tls = require('tls'); -var assert = require('assert'); var fs = require('fs'); var net = require('net'); -var tls = require('tls'); var common = require('../common'); diff --git a/test/parallel/test-tls-multi-key.js b/test/parallel/test-tls-multi-key.js index 657d9084d44d78..85ff5e808cfe16 100644 --- a/test/parallel/test-tls-multi-key.js +++ b/test/parallel/test-tls-multi-key.js @@ -1,10 +1,10 @@ -if (!process.versions.openssl) { - console.error('Skipping because node compiled without OpenSSL.'); - process.exit(0); -} - var common = require('../common'); var assert = require('assert'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var tls = require('tls'); var fs = require('fs'); diff --git a/test/parallel/test-tls-no-cert-required.js b/test/parallel/test-tls-no-cert-required.js index 1be4e69922e86a..75afc110999aa6 100644 --- a/test/parallel/test-tls-no-cert-required.js +++ b/test/parallel/test-tls-no-cert-required.js @@ -1,9 +1,9 @@ -if (!process.versions.openssl) { - console.error('Skipping because node compiled without OpenSSL.'); - process.exit(0); -} - var common = require('../common'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var tls = require('tls'); // Omitting the cert or pfx option to tls.createServer() should not throw. diff --git a/test/parallel/test-tls-no-rsa-key.js b/test/parallel/test-tls-no-rsa-key.js index 2daa80ed810a5b..389cd329c6fd4f 100644 --- a/test/parallel/test-tls-no-rsa-key.js +++ b/test/parallel/test-tls-no-rsa-key.js @@ -1,12 +1,12 @@ -if (!process.versions.openssl) { - console.error('Skipping because node compiled without OpenSSL.'); - process.exit(0); -} - var common = require('../common'); var assert = require('assert'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var tls = require('tls'); -var fs = require('fs'); + var fs = require('fs'); var options = { diff --git a/test/parallel/test-tls-no-sslv23.js b/test/parallel/test-tls-no-sslv23.js index 64f5206720510d..56fd89f76a3225 100644 --- a/test/parallel/test-tls-no-sslv23.js +++ b/test/parallel/test-tls-no-sslv23.js @@ -1,10 +1,10 @@ -if (!process.versions.openssl) { - console.error('Skipping because node compiled without OpenSSL.'); - process.exit(0); -} - var common = require('../common'); var assert = require('assert'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var tls = require('tls'); assert.throws(function() { diff --git a/test/parallel/test-tls-no-sslv3.js b/test/parallel/test-tls-no-sslv3.js index 47a0aee224ba3f..dbe19957306017 100644 --- a/test/parallel/test-tls-no-sslv3.js +++ b/test/parallel/test-tls-no-sslv3.js @@ -1,13 +1,14 @@ -if (!process.versions.openssl) { - console.error('Skipping because node compiled without OpenSSL.'); - process.exit(0); -} - var common = require('../common'); var assert = require('assert'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} +var tls = require('tls'); + var fs = require('fs'); var spawn = require('child_process').spawn; -var tls = require('tls'); if (common.opensslCli === false) { console.error('Skipping because openssl command cannot be executed'); diff --git a/test/parallel/test-tls-npn-server-client.js b/test/parallel/test-tls-npn-server-client.js index a89d8bcb6c8a52..406751b0289cb5 100644 --- a/test/parallel/test-tls-npn-server-client.js +++ b/test/parallel/test-tls-npn-server-client.js @@ -6,8 +6,14 @@ if (!process.features.tls_npn) { var common = require('../common'), assert = require('assert'), - fs = require('fs'), - tls = require('tls'); + fs = require('fs'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} +var tls = require('tls'); + function filenamePEM(n) { return require('path').join(common.fixturesDir, 'keys', n + '.pem'); diff --git a/test/parallel/test-tls-ocsp-callback.js b/test/parallel/test-tls-ocsp-callback.js index e0f3b5bc280e96..a9ac6ffa17d359 100644 --- a/test/parallel/test-tls-ocsp-callback.js +++ b/test/parallel/test-tls-ocsp-callback.js @@ -10,8 +10,13 @@ if (!common.opensslCli) { process.exit(0); } -var assert = require('assert'); +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var tls = require('tls'); + +var assert = require('assert'); var constants = require('constants'); var fs = require('fs'); var join = require('path').join; diff --git a/test/parallel/test-tls-on-empty-socket.js b/test/parallel/test-tls-on-empty-socket.js index a6db26b926cffb..f4866701e23eb5 100644 --- a/test/parallel/test-tls-on-empty-socket.js +++ b/test/parallel/test-tls-on-empty-socket.js @@ -1,14 +1,14 @@ -if (!process.versions.openssl) { - console.error('Skipping because node compiled without OpenSSL.'); - process.exit(0); +var common = require('../common'); +var assert = require('assert'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); } +var tls = require('tls'); -var assert = require('assert'); var fs = require('fs'); var net = require('net'); -var tls = require('tls'); - -var common = require('../common'); var out = ''; diff --git a/test/parallel/test-tls-over-http-tunnel.js b/test/parallel/test-tls-over-http-tunnel.js index ff567dc672308c..c851f02a575259 100644 --- a/test/parallel/test-tls-over-http-tunnel.js +++ b/test/parallel/test-tls-over-http-tunnel.js @@ -1,15 +1,15 @@ -if (!process.versions.openssl) { - console.error('Skipping because node compiled without OpenSSL.'); - process.exit(0); -} - var common = require('../common'); var assert = require('assert'); +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} +var https = require('https'); + var fs = require('fs'); var net = require('net'); var http = require('http'); -var https = require('https'); var proxyPort = common.PORT + 1; var gotRequest = false; diff --git a/test/parallel/test-tls-passphrase.js b/test/parallel/test-tls-passphrase.js index ba12523253de3b..f1253ee51b986f 100644 --- a/test/parallel/test-tls-passphrase.js +++ b/test/parallel/test-tls-passphrase.js @@ -1,11 +1,12 @@ -if (!process.versions.openssl) { - console.error('Skipping because node compiled without OpenSSL.'); - process.exit(0); -} - var common = require('../common'); var assert = require('assert'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var tls = require('tls'); + var fs = require('fs'); var path = require('path'); diff --git a/test/parallel/test-tls-pause.js b/test/parallel/test-tls-pause.js index e858fbb8c88371..95f293d234e803 100644 --- a/test/parallel/test-tls-pause.js +++ b/test/parallel/test-tls-pause.js @@ -1,11 +1,12 @@ -if (!process.versions.openssl) { - console.error('Skipping because node compiled without OpenSSL.'); - process.exit(0); -} - var common = require('../common'); var assert = require('assert'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var tls = require('tls'); + var fs = require('fs'); var path = require('path'); diff --git a/test/parallel/test-tls-peer-certificate-encoding.js b/test/parallel/test-tls-peer-certificate-encoding.js index 12a8954ecf3f2f..536bfae2031934 100644 --- a/test/parallel/test-tls-peer-certificate-encoding.js +++ b/test/parallel/test-tls-peer-certificate-encoding.js @@ -1,11 +1,12 @@ -if (!process.versions.openssl) { - console.error('Skipping because node compiled without OpenSSL.'); - process.exit(0); -} - var common = require('../common'); var assert = require('assert'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var tls = require('tls'); + var fs = require('fs'); var util = require('util'); var join = require('path').join; diff --git a/test/parallel/test-tls-peer-certificate-multi-keys.js b/test/parallel/test-tls-peer-certificate-multi-keys.js index 0bf891d7b01aa3..3488600e272091 100644 --- a/test/parallel/test-tls-peer-certificate-multi-keys.js +++ b/test/parallel/test-tls-peer-certificate-multi-keys.js @@ -1,11 +1,12 @@ -if (!process.versions.openssl) { - console.error('Skipping because node compiled without OpenSSL.'); - process.exit(0); -} - var common = require('../common'); var assert = require('assert'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var tls = require('tls'); + var fs = require('fs'); var util = require('util'); var join = require('path').join; diff --git a/test/parallel/test-tls-peer-certificate.js b/test/parallel/test-tls-peer-certificate.js index cd0a12ff2a2c48..a1a19d7035d3ca 100644 --- a/test/parallel/test-tls-peer-certificate.js +++ b/test/parallel/test-tls-peer-certificate.js @@ -1,11 +1,12 @@ -if (!process.versions.openssl) { - console.error('Skipping because node compiled without OpenSSL.'); - process.exit(0); -} - var common = require('../common'); var assert = require('assert'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var tls = require('tls'); + var fs = require('fs'); var util = require('util'); var join = require('path').join; diff --git a/test/parallel/test-tls-request-timeout.js b/test/parallel/test-tls-request-timeout.js index 480f8fb5810ccc..10a14696c43a71 100644 --- a/test/parallel/test-tls-request-timeout.js +++ b/test/parallel/test-tls-request-timeout.js @@ -1,6 +1,12 @@ var common = require('../common'); var assert = require('assert'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var tls = require('tls'); + var fs = require('fs'); var hadTimeout = false; diff --git a/test/parallel/test-tls-securepair-server.js b/test/parallel/test-tls-securepair-server.js index fee7a6ae76e93b..99bd4dd6f92606 100644 --- a/test/parallel/test-tls-securepair-server.js +++ b/test/parallel/test-tls-securepair-server.js @@ -1,16 +1,15 @@ var common = require('../common'); +var assert = require('assert'); -if (!common.opensslCli) { - console.error('Skipping because node compiled without OpenSSL CLI.'); - process.exit(0); +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); } - -var assert = require('assert'); +var tls = require('tls'); var join = require('path').join; var net = require('net'); var fs = require('fs'); -var tls = require('tls'); var spawn = require('child_process').spawn; var connections = 0; diff --git a/test/parallel/test-tls-server-verify.js b/test/parallel/test-tls-server-verify.js index d5ec50d38abd54..0204bc5d1f074e 100644 --- a/test/parallel/test-tls-server-verify.js +++ b/test/parallel/test-tls-server-verify.js @@ -98,11 +98,15 @@ var testCases = } ]; +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} +var tls = require('tls'); var constants = require('constants'); var assert = require('assert'); var fs = require('fs'); -var tls = require('tls'); var spawn = require('child_process').spawn; diff --git a/test/parallel/test-tls-session-cache.js b/test/parallel/test-tls-session-cache.js index 06df3b5f91bf52..8ba2deec2e2ebd 100644 --- a/test/parallel/test-tls-session-cache.js +++ b/test/parallel/test-tls-session-cache.js @@ -5,6 +5,11 @@ if (!common.opensslCli) { process.exit(0); } +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} + doTest({ tickets: false } , function() { doTest({ tickets: true } , function() { console.error('all done'); diff --git a/test/parallel/test-tls-set-ciphers.js b/test/parallel/test-tls-set-ciphers.js index ef4c5c5fbe36ff..62ca077f29c8c2 100644 --- a/test/parallel/test-tls-set-ciphers.js +++ b/test/parallel/test-tls-set-ciphers.js @@ -5,6 +5,11 @@ if (!common.opensslCli) { process.exit(0); } +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} + var assert = require('assert'); var exec = require('child_process').exec; var tls = require('tls'); diff --git a/test/parallel/test-tls-set-encoding.js b/test/parallel/test-tls-set-encoding.js index 6c3897fbe8589e..d73572c93ba0f7 100644 --- a/test/parallel/test-tls-set-encoding.js +++ b/test/parallel/test-tls-set-encoding.js @@ -1,6 +1,12 @@ var common = require('../common'); var assert = require('assert'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var tls = require('tls'); + var fs = require('fs'); diff --git a/test/parallel/test-tls-sni-option.js b/test/parallel/test-tls-sni-option.js index 729a998755f852..3768c7eaac8f48 100644 --- a/test/parallel/test-tls-sni-option.js +++ b/test/parallel/test-tls-sni-option.js @@ -6,8 +6,13 @@ if (!process.features.tls_sni) { var common = require('../common'), assert = require('assert'), - fs = require('fs'), - tls = require('tls'); + fs = require('fs'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} +var tls = require('tls'); function filenamePEM(n) { return require('path').join(common.fixturesDir, 'keys', n + '.pem'); diff --git a/test/parallel/test-tls-sni-server-client.js b/test/parallel/test-tls-sni-server-client.js index 668f6228e5e1ab..7a1d09b9c2ef07 100644 --- a/test/parallel/test-tls-sni-server-client.js +++ b/test/parallel/test-tls-sni-server-client.js @@ -6,8 +6,13 @@ if (!process.features.tls_sni) { var common = require('../common'), assert = require('assert'), - fs = require('fs'), - tls = require('tls'); + fs = require('fs'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} +var tls = require('tls'); function filenamePEM(n) { return require('path').join(common.fixturesDir, 'keys', n + '.pem'); diff --git a/test/parallel/test-tls-ticket-cluster.js b/test/parallel/test-tls-ticket-cluster.js index 2940a8e000c11e..1b20e5ac8e90d9 100644 --- a/test/parallel/test-tls-ticket-cluster.js +++ b/test/parallel/test-tls-ticket-cluster.js @@ -1,12 +1,13 @@ -if (!process.versions.openssl) { - console.error('Skipping because node compiled without OpenSSL.'); - process.exit(0); -} - var common = require('../common'); var assert = require('assert'); -var cluster = require('cluster'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var tls = require('tls'); + +var cluster = require('cluster'); var fs = require('fs'); var join = require('path').join; diff --git a/test/parallel/test-tls-ticket.js b/test/parallel/test-tls-ticket.js index 12dfacf7ad9a11..cf5cae9c8a8f7c 100644 --- a/test/parallel/test-tls-ticket.js +++ b/test/parallel/test-tls-ticket.js @@ -1,16 +1,16 @@ -if (!process.versions.openssl) { - console.error('Skipping because node compiled without OpenSSL.'); - process.exit(0); +var common = require('../common'); +var assert = require('assert'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); } +var tls = require('tls'); -var assert = require('assert'); var fs = require('fs'); var net = require('net'); -var tls = require('tls'); var crypto = require('crypto'); -var common = require('../common'); - var keys = crypto.randomBytes(48); var serverLog = []; var ticketLog = []; diff --git a/test/parallel/test-tls-timeout-server-2.js b/test/parallel/test-tls-timeout-server-2.js index 2e51b6845ed970..a16ce33167bb48 100644 --- a/test/parallel/test-tls-timeout-server-2.js +++ b/test/parallel/test-tls-timeout-server-2.js @@ -1,8 +1,12 @@ -if (!process.versions.openssl) process.exit(); - var common = require('../common'); var assert = require('assert'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var tls = require('tls'); + var fs = require('fs'); var options = { diff --git a/test/parallel/test-tls-timeout-server.js b/test/parallel/test-tls-timeout-server.js index 174e981e6a4627..47845fae39751c 100644 --- a/test/parallel/test-tls-timeout-server.js +++ b/test/parallel/test-tls-timeout-server.js @@ -1,9 +1,13 @@ -if (!process.versions.openssl) process.exit(); - var common = require('../common'); var assert = require('assert'); -var net = require('net'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var tls = require('tls'); + +var net = require('net'); var fs = require('fs'); var clientErrors = 0; diff --git a/test/parallel/test-tls-wrap-timeout.js b/test/parallel/test-tls-wrap-timeout.js index a2fd20b779f30e..5feb3d11056653 100644 --- a/test/parallel/test-tls-wrap-timeout.js +++ b/test/parallel/test-tls-wrap-timeout.js @@ -1,9 +1,13 @@ -if (!process.versions.openssl) process.exit(); - var common = require('../common'); var assert = require('assert'); -var net = require('net'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var tls = require('tls'); + +var net = require('net'); var fs = require('fs'); var options = { diff --git a/test/parallel/test-tls-zero-clear-in.js b/test/parallel/test-tls-zero-clear-in.js index e6dd5b15efdb28..38b21f401e21a4 100644 --- a/test/parallel/test-tls-zero-clear-in.js +++ b/test/parallel/test-tls-zero-clear-in.js @@ -1,12 +1,13 @@ -if (!process.versions.openssl) { - console.error('Skipping because node compiled without OpenSSL.'); - process.exit(0); -} - var common = require('../common'); var assert = require('assert'); -var fs = require('fs'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var tls = require('tls'); + +var fs = require('fs'); var path = require('path'); var cert = fs.readFileSync(path.join(common.fixturesDir, 'test_cert.pem')); diff --git a/test/parallel/test-zlib-random-byte-pipes.js b/test/parallel/test-zlib-random-byte-pipes.js index a5f4086e8399d1..4044cbd211a857 100644 --- a/test/parallel/test-zlib-random-byte-pipes.js +++ b/test/parallel/test-zlib-random-byte-pipes.js @@ -1,9 +1,15 @@ var common = require('../common'); +var assert = require('assert'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var crypto = require('crypto'); + var stream = require('stream'); var Stream = stream.Stream; var util = require('util'); -var assert = require('assert'); var zlib = require('zlib'); diff --git a/test/pummel/test-dh-regr.js b/test/pummel/test-dh-regr.js index 5f4534c36598b6..5c40173b121040 100644 --- a/test/pummel/test-dh-regr.js +++ b/test/pummel/test-dh-regr.js @@ -1,6 +1,10 @@ var common = require('../common'); var assert = require('assert'); +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var crypto = require('crypto'); var p = crypto.createDiffieHellman(256).getPrime(); diff --git a/test/pummel/test-https-ci-reneg-attack.js b/test/pummel/test-https-ci-reneg-attack.js index cbdb2328cb314f..1ca965e99ec583 100644 --- a/test/pummel/test-https-ci-reneg-attack.js +++ b/test/pummel/test-https-ci-reneg-attack.js @@ -1,8 +1,14 @@ var common = require('../common'); var assert = require('assert'); var spawn = require('child_process').spawn; + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var tls = require('tls'); var https = require('https'); + var fs = require('fs'); if (!common.opensslCli) { diff --git a/test/pummel/test-https-large-response.js b/test/pummel/test-https-large-response.js index 3ba36b496ad8f3..5ad5da480ca7a4 100644 --- a/test/pummel/test-https-large-response.js +++ b/test/pummel/test-https-large-response.js @@ -2,6 +2,11 @@ var common = require('../common'); var assert = require('assert'); var fs = require('fs'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var https = require('https'); var options = { @@ -60,4 +65,3 @@ process.on('exit', function() { assert.equal(body.length, count); assert.ok(gotResEnd); }); - diff --git a/test/pummel/test-https-no-reader.js b/test/pummel/test-https-no-reader.js index 1da46548c14156..798a4f70b64f81 100644 --- a/test/pummel/test-https-no-reader.js +++ b/test/pummel/test-https-no-reader.js @@ -1,11 +1,12 @@ -if (!process.versions.openssl) { - console.error('Skipping because node compiled without OpenSSL.'); - process.exit(0); -} - var common = require('../common'); var assert = require('assert'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var https = require('https'); + var Buffer = require('buffer').Buffer; var fs = require('fs'); var path = require('path'); diff --git a/test/pummel/test-regress-GH-892.js b/test/pummel/test-regress-GH-892.js index 188e552987eacc..af314349ffd962 100644 --- a/test/pummel/test-regress-GH-892.js +++ b/test/pummel/test-regress-GH-892.js @@ -7,7 +7,13 @@ var common = require('../common'); var assert = require('assert'); var spawn = require('child_process').spawn; + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var https = require('https'); + var fs = require('fs'); var PORT = 8000; diff --git a/test/pummel/test-tls-ci-reneg-attack.js b/test/pummel/test-tls-ci-reneg-attack.js index 22f5b7baaef02c..22c48699d080a7 100644 --- a/test/pummel/test-tls-ci-reneg-attack.js +++ b/test/pummel/test-tls-ci-reneg-attack.js @@ -1,7 +1,13 @@ var common = require('../common'); var assert = require('assert'); var spawn = require('child_process').spawn; + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var tls = require('tls'); + var fs = require('fs'); if (!common.opensslCli) { diff --git a/test/pummel/test-tls-connect-memleak.js b/test/pummel/test-tls-connect-memleak.js index 9f8fb9e7103d89..53275da60ed2a9 100644 --- a/test/pummel/test-tls-connect-memleak.js +++ b/test/pummel/test-tls-connect-memleak.js @@ -2,7 +2,13 @@ var common = require('../common'); var assert = require('assert'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var tls = require('tls'); + var fs = require('fs'); assert(typeof gc === 'function', 'Run this test with --expose-gc'); diff --git a/test/pummel/test-tls-securepair-client.js b/test/pummel/test-tls-securepair-client.js index 8a2950c8cc8e17..cbff5feac8fb39 100644 --- a/test/pummel/test-tls-securepair-client.js +++ b/test/pummel/test-tls-securepair-client.js @@ -7,6 +7,11 @@ if (!common.opensslCli) { process.exit(0); } +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} + var join = require('path').join; var net = require('net'); var assert = require('assert'); diff --git a/test/pummel/test-tls-server-large-request.js b/test/pummel/test-tls-server-large-request.js index eac41df22f51c3..c5eebb01a16fdb 100644 --- a/test/pummel/test-tls-server-large-request.js +++ b/test/pummel/test-tls-server-large-request.js @@ -1,6 +1,12 @@ var common = require('../common'); var assert = require('assert'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var tls = require('tls'); + var fs = require('fs'); var stream = require('stream'); var util = require('util'); diff --git a/test/pummel/test-tls-session-timeout.js b/test/pummel/test-tls-session-timeout.js index 13e6a957f10198..74a1abc99052cb 100644 --- a/test/pummel/test-tls-session-timeout.js +++ b/test/pummel/test-tls-session-timeout.js @@ -5,6 +5,11 @@ if (!common.opensslCli) { process.exit(0); } +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} + doTest(); // This test consists of three TLS requests -- diff --git a/test/pummel/test-tls-throttle.js b/test/pummel/test-tls-throttle.js index a0cca24e214c67..a8a83a2a3a9001 100644 --- a/test/pummel/test-tls-throttle.js +++ b/test/pummel/test-tls-throttle.js @@ -3,6 +3,11 @@ var common = require('../common'); var assert = require('assert'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var tls = require('tls'); var fs = require('fs'); diff --git a/test/sequential/test-regress-GH-1531.js b/test/sequential/test-regress-GH-1531.js index 120618dcad156e..9e1b8e3077870e 100644 --- a/test/sequential/test-regress-GH-1531.js +++ b/test/sequential/test-regress-GH-1531.js @@ -1,12 +1,13 @@ -if (!process.versions.openssl) { - console.error('Skipping because node compiled without OpenSSL.'); - process.exit(0); -} +var common = require('../common'); +var assert = require('assert'); +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var https = require('https'); -var assert = require('assert'); + var fs = require('fs'); -var common = require('../common'); var options = { key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'), @@ -42,4 +43,3 @@ process.on('exit', function() { assert.ok(gotCallback); console.log('ok'); }); - diff --git a/test/sequential/test-tls-honorcipherorder.js b/test/sequential/test-tls-honorcipherorder.js index 0cb85a3c19ae07..cad1a83a30e856 100644 --- a/test/sequential/test-tls-honorcipherorder.js +++ b/test/sequential/test-tls-honorcipherorder.js @@ -1,6 +1,12 @@ var common = require('../common'); var assert = require('assert'); + +if (!common.hasCrypto) { + console.log('1..0 # Skipped: missing crypto'); + process.exit(); +} var tls = require('tls'); + var fs = require('fs'); var nconns = 0; // test only in TLSv1 to use DES which is no longer supported TLSv1.2