From d044e2de07f147771dd68fa859165df6380264c0 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Tue, 4 May 2010 14:21:01 -0700 Subject: [PATCH] Lazy load crypto The whole program is being slowed down by the large CA string in crypto. Why? --- lib/net.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/net.js b/lib/net.js index 40b6745..5849401 100644 --- a/lib/net.js +++ b/lib/net.js @@ -1,7 +1,6 @@ var sys = require("sys"); var fs = require("fs"); var events = require("events"); -var crypto= require("crypto"); var dns = require('dns'); var kMinPoolSpace = 128; @@ -422,6 +421,7 @@ Stream.prototype.setSecure = function(credentials) { if (!have_crypto) { throw new Error('node.js not compiled with openssl crypto support.'); } + var crypto= require("crypto"); this.secure = true; this.secureEstablished = false; // If no credentials given, create a new one for just this Stream -- 2.7.4