summaryrefslogtreecommitdiff
path: root/lib/tls.js
diff options
context:
space:
mode:
authorManav Rathi <manav.r@directi.com>2013-03-18 19:40:41 +0530
committerBen Noordhuis <info@bnoordhuis.nl>2013-03-26 01:37:49 +0100
commitd20576165ae0e954743bed45b0c2ca33dff4b20c (patch)
treecfe5efa021332ee203e7c114a2a023f025facb4c /lib/tls.js
parent1a65154d7296b7936518dc084cd757960d3d5882 (diff)
downloadnodejs-d20576165ae0e954743bed45b0c2ca33dff4b20c.tar.gz
nodejs-d20576165ae0e954743bed45b0c2ca33dff4b20c.tar.bz2
nodejs-d20576165ae0e954743bed45b0c2ca33dff4b20c.zip
tls: expose SSL_CTX_set_timeout via tls.createServer
Add the `sessionTimeout` integral value to the list of options recognized by `tls.createServer`. This option will be useful for applications which need frequently establish short-lived TLS connections to the same endpoint. The TLS tickets RFC is an ideal option to reduce the socket setup overhead for such scenarios, but the default ticket timeout value (5 minutes) is too low to be useful.
Diffstat (limited to 'lib/tls.js')
-rw-r--r--lib/tls.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/tls.js b/lib/tls.js
index df2afec53..334f4116b 100644
--- a/lib/tls.js
+++ b/lib/tls.js
@@ -990,6 +990,7 @@ SecurePair.prototype.error = function() {
// - key. string.
// - cert: string.
// - ca: string or array of strings.
+// - sessionTimeout: integer.
//
// emit 'secureConnection'
// function (cleartextStream, encryptedStream) { }
@@ -1058,6 +1059,10 @@ function Server(/* [options], listener */) {
throw new TypeError('handshakeTimeout must be a number');
}
+ if (self.sessionTimeout) {
+ sharedCreds.context.setSessionTimeout(self.sessionTimeout);
+ }
+
// constructor call
net.Server.call(this, function(socket) {
var creds = crypto.createCredentials(null, sharedCreds.context);
@@ -1154,6 +1159,7 @@ Server.prototype.setOptions = function(options) {
if (options.secureProtocol) this.secureProtocol = options.secureProtocol;
if (options.crl) this.crl = options.crl;
if (options.ciphers) this.ciphers = options.ciphers;
+ if (options.sessionTimeout) this.sessionTimeout = options.sessionTimeout;
var secureOptions = options.secureOptions || 0;
if (options.honorCipherOrder) {
secureOptions |= constants.SSL_OP_CIPHER_SERVER_PREFERENCE;