From 802a2e79e1adb22542ba12fba5e331e94277272d Mon Sep 17 00:00:00 2001 From: Shigeki Ohtsu Date: Thu, 23 Apr 2015 15:25:15 +0900 Subject: tls, crypto: add ALPN Support ALPN is added to tls according to RFC7301, which supersedes NPN. When the server receives both NPN and ALPN extensions from the client, ALPN takes precedence over NPN and the server does not send NPN extension to the client. alpnProtocol in TLSSocket always returns false when no selected protocol exists by ALPN. In https server, http/1.1 token is always set when no options.ALPNProtocols exists. PR-URL: https://github.com/nodejs/node/pull/2564 Reviewed-By: Fedor Indutny Reviewed-By: Ben Noordhuis --- lib/https.js | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'lib/https.js') diff --git a/lib/https.js b/lib/https.js index abe4a20907..edf0aa4432 100644 --- a/lib/https.js +++ b/lib/https.js @@ -14,6 +14,13 @@ function Server(opts, requestListener) { opts.NPNProtocols = ['http/1.1', 'http/1.0']; } + if (process.features.tls_alpn && !opts.ALPNProtocols) { + // http/1.0 is not defined as Protocol IDs in IANA + // http://www.iana.org/assignments/tls-extensiontype-values + // /tls-extensiontype-values.xhtml#alpn-protocol-ids + opts.ALPNProtocols = ['http/1.1']; + } + tls.Server.call(this, opts, http._connectionListener); this.httpAllowHalfOpen = false; -- cgit v1.2.3