|
@ -23,16 +23,11 @@ if (!process.versions.openssl) { |
|
|
console.error('Skipping because node compiled without OpenSSL.'); |
|
|
console.error('Skipping because node compiled without OpenSSL.'); |
|
|
process.exit(0); |
|
|
process.exit(0); |
|
|
} |
|
|
} |
|
|
require('child_process').exec('openssl version', function(err) { |
|
|
|
|
|
if (err !== null) { |
|
|
doTest({ tickets: false } , function() { |
|
|
console.error('Skipping because openssl command is not available.'); |
|
|
|
|
|
process.exit(0); |
|
|
|
|
|
} |
|
|
|
|
|
doTest({ tickets: false } , function() { |
|
|
|
|
|
doTest({ tickets: true } , function() { |
|
|
doTest({ tickets: true } , function() { |
|
|
console.error('all done'); |
|
|
console.error('all done'); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
|
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
function doTest(testOptions, callback) { |
|
|
function doTest(testOptions, callback) { |
|
@ -56,7 +51,6 @@ function doTest(testOptions, callback) { |
|
|
var requestCount = 0; |
|
|
var requestCount = 0; |
|
|
var resumeCount = 0; |
|
|
var resumeCount = 0; |
|
|
var session; |
|
|
var session; |
|
|
var badOpenSSL = false; |
|
|
|
|
|
|
|
|
|
|
|
var server = tls.createServer(options, function(cleartext) { |
|
|
var server = tls.createServer(options, function(cleartext) { |
|
|
cleartext.on('error', function(er) { |
|
|
cleartext.on('error', function(er) { |
|
@ -87,7 +81,7 @@ function doTest(testOptions, callback) { |
|
|
}, 100); |
|
|
}, 100); |
|
|
}); |
|
|
}); |
|
|
server.listen(common.PORT, function() { |
|
|
server.listen(common.PORT, function() { |
|
|
var client = spawn('openssl', [ |
|
|
var client = spawn(common.opensslCli, [ |
|
|
's_client', |
|
|
's_client', |
|
|
'-tls1', |
|
|
'-tls1', |
|
|
'-connect', 'localhost:' + common.PORT, |
|
|
'-connect', 'localhost:' + common.PORT, |
|
@ -104,11 +98,6 @@ function doTest(testOptions, callback) { |
|
|
}); |
|
|
}); |
|
|
client.on('exit', function(code) { |
|
|
client.on('exit', function(code) { |
|
|
console.error('done'); |
|
|
console.error('done'); |
|
|
if (/^unknown option/.test(err)) { |
|
|
|
|
|
// using an incompatible version of openssl
|
|
|
|
|
|
assert(code); |
|
|
|
|
|
badOpenSSL = true; |
|
|
|
|
|
} else |
|
|
|
|
|
assert.equal(code, 0); |
|
|
assert.equal(code, 0); |
|
|
server.close(function() { |
|
|
server.close(function() { |
|
|
setTimeout(callback, 100); |
|
|
setTimeout(callback, 100); |
|
@ -117,7 +106,6 @@ function doTest(testOptions, callback) { |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
process.on('exit', function() { |
|
|
process.on('exit', function() { |
|
|
if (!badOpenSSL) { |
|
|
|
|
|
if (testOptions.tickets) { |
|
|
if (testOptions.tickets) { |
|
|
assert.equal(requestCount, 6); |
|
|
assert.equal(requestCount, 6); |
|
|
assert.equal(resumeCount, 0); |
|
|
assert.equal(resumeCount, 0); |
|
@ -127,6 +115,5 @@ function doTest(testOptions, callback) { |
|
|
assert.equal(requestCount, 6); |
|
|
assert.equal(requestCount, 6); |
|
|
assert.equal(resumeCount, 5); |
|
|
assert.equal(resumeCount, 5); |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|