Add support for TLS SNI

Fixes #1411
This commit is contained in:
Fedor Indutny
2011-07-28 22:52:04 +07:00
committed by Ryan Dahl
parent 9dd979228d
commit 9010f5fbab
8 changed files with 315 additions and 22 deletions

View File

@@ -23,12 +23,10 @@ var tls = require('tls');
var http = require('http');
var inherits = require('util').inherits;
var NPN_ENABLED = process.binding('constants').NPN_ENABLED;
function Server(opts, requestListener) {
if (!(this instanceof Server)) return new Server(opts, requestListener);
if (NPN_ENABLED && !opts.NPNProtocols) {
if (process.features.tls_npn && !opts.NPNProtocols) {
opts.NPNProtocols = ['http/1.1', 'http/1.0'];
}
@@ -64,7 +62,7 @@ Agent.prototype.defaultPort = 443;
Agent.prototype._getConnection = function(options, cb) {
if (NPN_ENABLED && !this.options.NPNProtocols) {
if (process.features.tls_npn && !this.options.NPNProtocols) {
this.options.NPNProtocols = ['http/1.1', 'http/1.0'];
}