Comparing version 1.0.1 to 2.0.0
Version history | ||
=============== | ||
### 2.0.0 (2013-11-09) ### | ||
* Splitting out everything that is not related to negotiating HTTP2 or the node-like HTTP API. | ||
These live in separate module form now on: | ||
[http2-protocol](https://github.com/molnarg/node-http2-protocol). | ||
* The only backwards incompatible change: the `Endpoint` class is not exported anymore. Use the | ||
http2-protocol module if you want to use this low level interface. | ||
* [Tarball](https://github.com/molnarg/node-http2/archive/node-http2-2.0.0.tar.gz) | ||
### 1.0.1 (2013-10-14) ### | ||
@@ -5,0 +14,0 @@ |
@@ -138,3 +138,3 @@ // Public API | ||
var Writable = require('stream').Writable; | ||
var Endpoint = require('./endpoint').Endpoint; | ||
var Endpoint = require('http2-protocol').Endpoint; | ||
var http = require('http'); | ||
@@ -146,3 +146,2 @@ var https = require('https'); | ||
exports.OutgoingMessage = OutgoingMessage; | ||
exports.Endpoint = Endpoint; | ||
@@ -166,7 +165,2 @@ var deprecatedHeaders = [ | ||
// Using ALPN or NPN depending on node.js support (preferring ALPN) | ||
var negotiationMethod = process.features.tls_alpn ? 'ALPN' : 'NPN'; | ||
var protocolList = process.features.tls_alpn ? 'ALPNProtocols' : 'NPNProtocols'; | ||
var negotiatedProtocol = process.features.tls_alpn ? 'alpnProtocol' : 'npnProtocol'; | ||
// Logging | ||
@@ -189,7 +183,3 @@ // ------- | ||
// Bunyan serializers exported by submodules that are worth adding when creating a logger. | ||
exports.serializers = {}; | ||
var modules = ['./framer', './compressor', './flow', './connection', './stream', './endpoint']; | ||
modules.forEach(function(module) { | ||
util._extend(exports.serializers, require(module).serializers); | ||
}); | ||
exports.serializers = require('http2-protocol').serializers; | ||
@@ -355,3 +345,3 @@ // IncomingMessage class | ||
function Server(options) { | ||
options = options || {}; | ||
options = util._extend({}, options); | ||
@@ -366,5 +356,6 @@ this._log = (options.log || defaultLogger).child({ component: 'http' }); | ||
if ((options.key && options.cert) || options.pfx) { | ||
this._log.info('Creating HTTP/2 server over TLS/' + negotiationMethod); | ||
this._log.info('Creating HTTP/2 server over TLS'); | ||
this._mode = 'tls'; | ||
options[protocolList] = supportedProtocols; | ||
options.ALPNProtocols = supportedProtocols; | ||
options.NPNProtocols = supportedProtocols; | ||
this._server = https.createServer(options); | ||
@@ -374,3 +365,4 @@ this._originalSocketListeners = this._server.listeners('secureConnection'); | ||
this._server.on('secureConnection', function(socket) { | ||
if (socket[negotiatedProtocol] === implementedVersion && socket.servername) { | ||
var negotiatedProtocol = socket.alpnProtocol || socket.npnProtocol; | ||
if ((negotiatedProtocol === implementedVersion) && socket.servername) { | ||
start(socket); | ||
@@ -426,4 +418,6 @@ } else { | ||
Server.prototype._fallback = function _fallback(socket) { | ||
var negotiatedProtocol = socket.alpnProtocol || socket.npnProtocol; | ||
this._log.info({ client: socket.remoteAddress + ':' + socket.remotePort, | ||
protocol: socket[negotiatedProtocol], | ||
protocol: negotiatedProtocol, | ||
SNI: socket.servername | ||
@@ -663,3 +657,3 @@ }, 'Falling back to simple HTTPS'); | ||
options = options || {}; | ||
options = util._extend({}, options); | ||
@@ -675,3 +669,4 @@ this._settings = options.settings; | ||
var agentOptions = {}; | ||
agentOptions[protocolList] = supportedProtocols; | ||
agentOptions.ALPNProtocols = supportedProtocols; | ||
agentOptions.NPNProtocols = supportedProtocols; | ||
this._httpsAgent = new https.Agent(agentOptions); | ||
@@ -687,2 +682,4 @@ | ||
options = url.parse(options); | ||
} else { | ||
options = util._extend({}, options); | ||
} | ||
@@ -734,3 +731,4 @@ | ||
var started = false; | ||
options[protocolList] = supportedProtocols; | ||
options.ALPNProtocols = supportedProtocols; | ||
options.NPNProtocols = supportedProtocols; | ||
options.servername = options.host; // Server Name Indication | ||
@@ -741,3 +739,4 @@ options.agent = this._httpsAgent; | ||
httpsRequest.on('socket', function(socket) { | ||
if (socket[negotiatedProtocol] !== undefined) { | ||
var negotiatedProtocol = socket.alpnProtocol || socket.npnProtocol; | ||
if (negotiatedProtocol !== undefined) { | ||
negotiated(); | ||
@@ -752,3 +751,4 @@ } else { | ||
var endpoint; | ||
if (httpsRequest.socket[negotiatedProtocol] === implementedVersion) { | ||
var negotiatedProtocol = httpsRequest.socket.alpnProtocol || httpsRequest.socket.npnProtocol; | ||
if (negotiatedProtocol === implementedVersion) { | ||
httpsRequest.socket.emit('agentRemove'); | ||
@@ -755,0 +755,0 @@ unbundleSocket(httpsRequest.socket); |
116
lib/index.js
@@ -1,40 +0,16 @@ | ||
// [node-http2][homepage] is an [HTTP/2 (draft 04)][http2] implementation for [node.js][node]. | ||
// [node-http2][homepage] is an [HTTP/2 (draft 06)][http2] implementation for [node.js][node]. | ||
// | ||
// The main building blocks are mainly [node.js streams][node-stream] that are connected through | ||
// pipes. | ||
// The core of the protocol is implemented by the [http2-protocol] module. This module provides | ||
// two important features on top of http2-protocol: | ||
// | ||
// The main components are: | ||
// * Implementation of different negotiation schemes that can be used to start a HTTP2 connection. | ||
// These include TLS ALPN, Upgrade and Plain TCP. | ||
// | ||
// * [http.js](http.html): the top layer that presents an API very similar to the standard node.js | ||
// [HTTPS module][node-https] (which is in turn very similar to the [HTTP module][node-http]). | ||
// * Providing an API very similar to the standard node.js [HTTPS module API][node-https] | ||
// (which is in turn very similar to the [HTTP module API][node-http]). | ||
// | ||
// * [Endpoint](endpoint.html): represents an HTTP/2 endpoint (client or server). It's | ||
// responsible for the the first part of the handshake process (sending/receiving the | ||
// [connection header][http2-connheader]) and manages other components (framer, compressor, | ||
// connection, streams) that make up a client or server. | ||
// | ||
// * [Connection](connection.html): multiplexes the active HTTP/2 streams, manages connection | ||
// lifecycle and settings, and responsible for enforcing the connection level limits (flow | ||
// control, initiated stream limit) | ||
// | ||
// * [Stream](stream.html): implementation of the [HTTP/2 stream concept](http2-stream). | ||
// Implements the [stream state machine][http2-streamstate] defined by the standard, provides | ||
// management methods and events for using the stream (sending/receiving headers, data, etc.), | ||
// and enforces stream level constraints (flow control, sending only legal frames). | ||
// | ||
// * [Flow](flow.html): implements flow control for Connection and Stream as parent class. | ||
// | ||
// * [Compressor and Decompressor](compressor.html): compression and decompression of HEADER and | ||
// PUSH_PROMISE frames | ||
// | ||
// * [Serializer and Deserializer](framer.html): the lowest layer in the stack that transforms | ||
// between the binary and the JavaScript object representation of HTTP/2 frames | ||
// | ||
// [homepage]: https://github.com/molnarg/node-http2 | ||
// [http2]: http://tools.ietf.org/html/draft-ietf-httpbis-http2-04 | ||
// [http2-connheader]: http://tools.ietf.org/html/draft-ietf-httpbis-http2-04#section-3.5 | ||
// [http2-stream]: http://tools.ietf.org/html/draft-ietf-httpbis-http2-04#section-5 | ||
// [http2-streamstate]: http://tools.ietf.org/html/draft-ietf-httpbis-http2-04#section-5.1 | ||
// [http2-protocol]: https://github.com/molnarg/node-http2-protocol | ||
// [http2]: http://tools.ietf.org/html/draft-ietf-httpbis-http2-06 | ||
// [node]: http://nodejs.org/ | ||
// [node-stream]: http://nodejs.org/api/stream.html | ||
// [node-https]: http://nodejs.org/api/https.html | ||
@@ -46,49 +22,33 @@ // [node-http]: http://nodejs.org/api/http.html | ||
/* | ||
API user | ||
HTTP API | ||
| ^ | ||
| | | ||
+---------------|------------|--------------------------------------------------------+ | ||
| | | Server/Agent | | ||
| v | | | ||
| +----------+ +----------+ | | ||
| | Outgoing | | Incoming | | | ||
| | req/res. | | req/res. | | | ||
| +----------+ +----------+ | | ||
| | ^ | | ||
| +-----------|------------|---------------------------------------+ +----- | | ||
| | | | Endpoint | | | | ||
| | | | | | | | ||
| | +-------|------------|-----------------------------------+ | | | | ||
| | | | | Connection | | | | | ||
| | | v | | | | | | ||
| | | +-----------------------+ +-------------------- | | | | | ||
| | | | Stream | | Stream ... | | | | | ||
| | | +-----------------------+ +-------------------- | | | | | ||
| | | | ^ | ^ | | | | | ||
| | | v | v | | | | | | ||
| | | +------------+--+--------+--+------------+- ... | | | | | ||
| | | | ^ | | | | | ||
| | | | | | | | ... | | ||
| | +-----------------------|--------|-----------------------+ | | | | ||
| | | | | | | | ||
| | v | | | | | ||
| | +--------------------------+ +--------------------------+ | | | | ||
| | | Compressor | | Decompressor | | | | | ||
| | +--------------------------+ +--------------------------+ | | | | ||
| | | ^ | | | | ||
| | v | | | | | ||
| | +--------------------------+ +--------------------------+ | | | | ||
| | | Serializer | | Deserializer | | | | | ||
| | +--------------------------+ +--------------------------+ | | | | ||
| | | ^ | | | | ||
| +---------------------------|--------|---------------------------+ +----- | | ||
| | | | | ||
| v | | | ||
| +----------------------------------------------------------------+ +----- | | ||
| | TCP stream | | ... | | ||
| +----------------------------------------------------------------+ +----- | | ||
| | | ||
+-------------------------------------------------------------------------------------+ | ||
| ^ | ||
| | | ||
+-------------|------------|------------------------------------------------------+ | ||
| | | Server/Agent | | ||
| v | | | ||
| +----------+ +----------+ | | ||
| | Outgoing | | Incoming | | | ||
| | req/res. | | req/res. | | | ||
| +----------+ +----------+ | | ||
| | ^ | | ||
| | | | | ||
| +---------|------------|-------------------------------------+ +----- | | ||
| | | | Endpoint | | | | ||
| | | | | | | | ||
| | v | | | | | ||
| | +-----------------------+ +-------------------- | | | | ||
| | | Stream | | Stream ... | | | | ||
| | +-----------------------+ +-------------------- | | | | ||
| | | | | | ||
| +------------------------------------------------------------+ +----- | | ||
| | | | | ||
| | | | | ||
| v | | | ||
| +------------------------------------------------------------+ +----- | | ||
| | TCP stream | | ... | | ||
| +------------------------------------------------------------+ +----- | | ||
| | | ||
+---------------------------------------------------------------------------------+ | ||
*/ |
{ | ||
"name": "http2", | ||
"version": "1.0.1", | ||
"version": "2.0.0", | ||
"description": "An HTTP/2 client and server implementation", | ||
"main": "lib/index.js", | ||
"engines" : { | ||
"node" : ">=0.10.0" | ||
"node" : ">=0.10.19" | ||
}, | ||
"dependencies": { | ||
"http2-protocol": "0.6.x" | ||
}, | ||
"devDependencies": { | ||
@@ -22,3 +25,3 @@ "istanbul": "*", | ||
"type": "git", | ||
"url": "git://github.com/molnarg/node-http2.git" | ||
"url": "https://github.com/molnarg/node-http2.git" | ||
}, | ||
@@ -25,0 +28,0 @@ "homepage": "https://github.com/molnarg/node-http2", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
11
528159
1
25
2143
8
+ Addedhttp2-protocol@0.6.x
+ Addedhttp2-protocol@0.6.0(transitive)