Browse Source

Catch Exceptions thrown when openssl is disabled

v0.7.4-release
Tony Metzidis 14 years ago
committed by Ryan Dahl
parent
commit
debf389490
  1. 1
      .gitignore
  2. 7
      test/disabled/tls_client.js
  3. 7
      test/disabled/tls_server.js
  4. 7
      test/simple/test-crypto.js
  5. 8
      test/simple/test-http-tls.js
  6. 7
      test/simple/test-net-tls.js

1
.gitignore

@ -12,3 +12,4 @@ test/fixtures/hello.txt
tmp/
node
node_g
*.swp

7
test/disabled/tls_client.js

@ -12,7 +12,12 @@ var client = net.createConnection(443, "www.microsoft.com");
var caPem = fs.readFileSync(common.fixturesDir+"/msca.pem");
//var caPem = fs.readFileSync("ca.pem");
var credentials = crypto.createCredentials({ca:caPem});
try{
var credentials = crypto.createCredentials({ca:caPem});
} catch (e) {
console.log("Not compiled with OPENSSL support.");
process.exit();
}
client.setEncoding("UTF8");
client.addListener("connect", function () {

7
test/disabled/tls_server.js

@ -9,7 +9,12 @@ var crypto=require('crypto');
var keyPem = fs.readFileSync(common.fixturesDir + "/cert.pem");
var certPem = fs.readFileSync(common.fixturesDir + "/cert.pem");
var credentials = crypto.createCredentials({key:keyPem, cert:certPem});
try{
var credentials = crypto.createCredentials({key:keyPem, cert:certPem});
} catch (e) {
console.log("Not compiled with OPENSSL support.");
process.exit();
}
var i = 0;
var server = net.createServer(function (connection) {
connection.setSecure(credentials);

7
test/simple/test-crypto.js

@ -17,7 +17,12 @@ var caPem = fs.readFileSync(common.fixturesDir+"/test_ca.pem", 'ascii');
var certPem = fs.readFileSync(common.fixturesDir+"/test_cert.pem", 'ascii');
var keyPem = fs.readFileSync(common.fixturesDir+"/test_key.pem", 'ascii');
var credentials = crypto.createCredentials({key:keyPem, cert:certPem, ca:caPem});
try{
var credentials = crypto.createCredentials({key:keyPem, cert:certPem, ca:caPem});
} catch (e) {
console.log("Not compiled with OPENSSL support.");
process.exit();
}
// Test HMAC
//var h1 = (new crypto.Hmac).init("sha1", "Node").update("some data").update("to hmac").digest("hex");

8
test/simple/test-http-tls.js

@ -27,7 +27,13 @@ var caPem = fs.readFileSync(common.fixturesDir+"/test_ca.pem", 'ascii');
var certPem = fs.readFileSync(common.fixturesDir+"/test_cert.pem", 'ascii');
var keyPem = fs.readFileSync(common.fixturesDir+"/test_key.pem", 'ascii');
var credentials = crypto.createCredentials({key:keyPem, cert:certPem, ca:caPem});
try{
var credentials = crypto.createCredentials({key:keyPem, cert:certPem, ca:caPem});
} catch (e) {
console.log("Not compiled with OPENSSL support.");
process.exit();
}
var https_server = http.createServer(function (req, res) {
res.id = request_number;

7
test/simple/test-net-tls.js

@ -18,7 +18,12 @@ var caPem = fs.readFileSync(common.fixturesDir+"/test_ca.pem", 'ascii');
var certPem = fs.readFileSync(common.fixturesDir+"/test_cert.pem", 'ascii');
var keyPem = fs.readFileSync(common.fixturesDir+"/test_key.pem", 'ascii');
var credentials = crypto.createCredentials({key:keyPem, cert:certPem, ca:caPem});
try{
var credentials = crypto.createCredentials({key:keyPem, cert:certPem, ca:caPem});
} catch (e) {
console.log("Not compiled with OPENSSL support.");
process.exit();
}
var testData = "TEST123";
var serverData = '';

Loading…
Cancel
Save