Socket
Socket
Sign inDemoInstall

http2

Package Overview
Dependencies
Maintainers
2
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

http2 - npm Package Compare versions

Comparing version 3.3.4 to 3.3.5

.vscode/launch.json

11

example/server.js

@@ -33,2 +33,13 @@ var fs = require('fs');

// Example for testing large (boundary-sized) frames.
else if (request.url === "/largeframe") {
response.writeHead(200);
var body = 'a';
for (var i = 0; i < 14; i++) {
body += body;
}
body = body + 'a';
response.end(body);
}
// Otherwise responding with 404.

@@ -35,0 +46,0 @@ else {

3

HISTORY.md
Version history
===============
### 3.3.5 (2016-09-06) ###
* Fix issues with large DATA frames (https://github.com/molnarg/node-http2/issues/207)
### 3.3.4 (2016-04-22) ###

@@ -5,0 +8,0 @@ * More PR bugfixes (https://github.com/molnarg/node-http2/issues?q=milestone%3Av3.3.4)

49

lib/http.js

@@ -14,7 +14,7 @@ // Public API

// - **Class: http2.Endpoint**: an API for using the raw HTTP/2 framing layer. For documentation
// see the [lib/endpoint.js](endpoint.html) file.
// see [protocol/endpoint.js](protocol/endpoint.html).
//
// - **Class: http2.Server**
// - **Event: 'connection' (socket, [endpoint])**: there's a second argument if the negotiation of
// HTTP/2 was successful: the reference to the [Endpoint](endpoint.html) object tied to the
// HTTP/2 was successful: the reference to the [Endpoint](protocol/endpoint.html) object tied to the
// socket.

@@ -24,4 +24,2 @@ //

// - **log**: an optional [bunyan](https://github.com/trentm/node-bunyan) logger object
// - **plain**: if `true`, the server will accept HTTP/2 connections over plain TCP instead of
// TLS
//

@@ -38,16 +36,13 @@ // - **Class: http2.ServerResponse**

// - **agent.sockets**: only contains TCP sockets that corresponds to HTTP/1 requests.
// - **agent.endpoints**: contains [Endpoint](endpoint.html) objects for HTTP/2 connections.
// - **agent.endpoints**: contains [Endpoint](protocol/endpoint.html) objects for HTTP/2 connections.
//
// - **http2.request(options, [callback])**: additional option:
// - **plain**: if `true`, the client will not try to build a TLS tunnel, instead it will use
// the raw TCP stream for HTTP/2
// - **http2.request(options, [callback])**:
// - similar to http.request
//
// - **http2.get(options, [callback])**: additional option:
// - **plain**: if `true`, the client will not try to build a TLS tunnel, instead it will use
// the raw TCP stream for HTTP/2
// - this performs request and then also calls request.end() for request instance
// - **http2.get(options, [callback])**:
// - similar to http.get
//
// - **Class: http2.ClientRequest**
// - **Event: 'socket' (socket)**: in case of an HTTP/2 incoming message, `socket` is a reference
// to the associated [HTTP/2 Stream](stream.html) object (and not to the TCP socket).
// to the associated [HTTP/2 Stream](protocol/stream.html) object (and not to the TCP socket).
// - **Event: 'push' (promise)**: signals the intention of a server push associated to this

@@ -63,3 +58,3 @@ // request. `promise` is an IncomingPromise. If there's no listener for this event, the server

// - **message.socket**: in case of an HTTP/2 incoming message, it's a reference to the associated
// [HTTP/2 Stream](stream.html) object (and not to the TCP socket).
// [HTTP/2 Stream](protocol/stream.html) object (and not to the TCP socket).
//

@@ -99,7 +94,7 @@ // - **Class: http2.IncomingRequest (IncomingMessage)**

// - **Class: http2.Server**
// - **Event: 'checkContinue'**: not in the spec, yet (see [http-spec#18][expect-continue])
// - **Event: 'checkContinue'**: not in the spec
// - **Event: 'upgrade'**: upgrade is deprecated in HTTP/2
// - **Event: 'timeout'**: HTTP/2 sockets won't timeout because of application level keepalive
// (PING frames)
// - **Event: 'connect'**: not in the spec, yet (see [http-spec#230][connect])
// - **Event: 'connect'**: not yet supported
// - **server.setTimeout(msecs, [callback])**

@@ -132,7 +127,5 @@ // - **server.timeout**

//
// [1]: http://nodejs.org/api/https.html
// [2]: http://nodejs.org/api/http.html
// [3]: http://tools.ietf.org/html/draft-ietf-httpbis-http2-16#section-8.1.2.4
// [expect-continue]: https://github.com/http2/http2-spec/issues/18
// [connect]: https://github.com/http2/http2-spec/issues/230
// [1]: https://nodejs.org/api/https.html
// [2]: https://nodejs.org/api/http.html
// [3]: https://tools.ietf.org/html/rfc7540#section-8.1.2.4

@@ -171,3 +164,3 @@ // Common server and client side code

// Ciphersuite list based on the recommendations of http://wiki.mozilla.org/Security/Server_Side_TLS
// Ciphersuite list based on the recommendations of https://wiki.mozilla.org/Security/Server_Side_TLS
// The only modification is that kEDH+AESGCM were placed after DHE and ECDHE suites

@@ -236,3 +229,3 @@ var cipherSuites = [

function IncomingMessage(stream) {
// * This is basically a read-only wrapper for the [Stream](stream.html) class.
// * This is basically a read-only wrapper for the [Stream](protocol/stream.html) class.
PassThrough.call(this);

@@ -261,3 +254,3 @@ stream.pipe(this);

// [Request Header Fields](http://tools.ietf.org/html/draft-ietf-httpbis-http2-16#section-8.1.2.3)
// [Request Header Fields](https://tools.ietf.org/html/rfc7540#section-8.1.2.3)
// * `headers` argument: HTTP/2.0 request and response header fields carry information as a series

@@ -338,3 +331,3 @@ // of key-value pairs. This includes the target URI for the request, the status code for the

function OutgoingMessage() {
// * This is basically a read-only wrapper for the [Stream](stream.html) class.
// * This is basically a read-only wrapper for the [Stream](protocol/stream.html) class.
Writable.call(this);

@@ -548,3 +541,3 @@

// the backing TCP or HTTPS server.
// [1]: http://nodejs.org/api/http.html#http_server_listen_port_hostname_backlog_callback
// [1]: https://nodejs.org/api/http.html#http_server_listen_port_hostname_backlog_callback
Server.prototype.listen = function listen(port, hostname) {

@@ -673,3 +666,3 @@ this._log.info({ on: ((typeof hostname === 'string') ? (hostname + ':' + port) : port) },

// [Request Header Fields](http://tools.ietf.org/html/draft-ietf-httpbis-http2-16#section-8.1.2.3)
// [Request Header Fields](https://tools.ietf.org/html/rfc7540#section-8.1.2.3)
// * `headers` argument: HTTP/2.0 request and response header fields carry information as a series

@@ -1229,3 +1222,3 @@ // of key-value pairs. This includes the target URI for the request, the status code for the

// [Response Header Fields](http://tools.ietf.org/html/draft-ietf-httpbis-http2-16#section-8.1.2.4)
// [Response Header Fields](https://tools.ietf.org/html/rfc7540#section-8.1.2.4)
// * `headers` argument: HTTP/2.0 request and response header fields carry information as a series

@@ -1232,0 +1225,0 @@ // of key-value pairs. This includes the target URI for the request, the status code for the

@@ -1,2 +0,2 @@

// [node-http2][homepage] is an [HTTP/2 (draft 16)][http2] implementation for [node.js][node].
// [node-http2][homepage] is an [HTTP/2][http2] implementation for [node.js][node].
//

@@ -13,6 +13,6 @@ // The core of the protocol is implemented in the protocol sub-directory. This directory provides

// [homepage]: https://github.com/molnarg/node-http2
// [http2]: http://tools.ietf.org/html/draft-ietf-httpbis-http2-16
// [node]: http://nodejs.org/
// [node-https]: http://nodejs.org/api/https.html
// [node-http]: http://nodejs.org/api/http.html
// [http2]: https://tools.ietf.org/html/rfc7540
// [node]: https://nodejs.org/
// [node-https]: https://nodejs.org/api/https.html
// [node-http]: https://nodejs.org/api/http.html

@@ -19,0 +19,0 @@ module.exports = require('./http');

@@ -14,5 +14,5 @@ // The implementation of the [HTTP/2 Header Compression][http2-compression] spec is separated from

//
// [node-transform]: http://nodejs.org/api/stream.html#stream_class_stream_transform
// [node-objectmode]: http://nodejs.org/api/stream.html#stream_new_stream_readable_options
// [http2-compression]: http://tools.ietf.org/html/draft-ietf-httpbis-header-compression-07
// [node-transform]: https://nodejs.org/api/stream.html#stream_class_stream_transform
// [node-objectmode]: https://nodejs.org/api/stream.html#stream_new_stream_readable_options
// [http2-compression]: https://tools.ietf.org/html/rfc7541

@@ -39,4 +39,4 @@ exports.HeaderTable = HeaderTable;

// In this implementation, the Header Table and the [Static Table] are handled as a single table.
// [Header Table]: http://tools.ietf.org/html/draft-ietf-httpbis-header-compression-07#section-3.1.2
// [Static Table]: http://tools.ietf.org/html/draft-ietf-httpbis-header-compression-07#appendix-B
// [Header Table]: https://tools.ietf.org/html/rfc7541#section-2.3.2
// [Static Table]: https://tools.ietf.org/html/rfc7541#section-2.3.1
function HeaderTable(log, limit) {

@@ -75,3 +75,3 @@ var self = HeaderTable.staticTable.map(entryFromPair);

// The `add(index, entry)` can be used to [manage the header table][tablemgmt]:
// [tablemgmt]: http://tools.ietf.org/html/draft-ietf-httpbis-header-compression-07#section-3.3
// [tablemgmt]: https://tools.ietf.org/html/rfc7541#section-4
//

@@ -121,5 +121,4 @@ // * it pushes the new `entry` at the beggining of the table

// [The Static Table](http://tools.ietf.org/html/draft-ietf-httpbis-header-compression-07#appendix-B)
// [The Static Table](https://tools.ietf.org/html/rfc7541#section-2.3.1)
// ------------------
// [statictable]:http://tools.ietf.org/html/draft-ietf-httpbis-header-compression-07#appendix-B

@@ -215,3 +214,3 @@ // The table is generated with feeding the table from the spec to the following sed command:

// TransformStream class. It collects the data chunks for later processing.
// [_transform]: http://nodejs.org/api/stream.html#stream_transform_transform_chunk_encoding_callback
// [_transform]: https://nodejs.org/api/stream.html#stream_transform_transform_chunk_encoding_callback
HeaderSetDecompressor.prototype._transform = function _transform(chunk, encoding, callback) {

@@ -223,3 +222,3 @@ this._chunks.push(chunk);

// `execute(rep)` executes the given [header representation][representation].
// [representation]: http://tools.ietf.org/html/draft-ietf-httpbis-header-compression-07#section-3.1.4
// [representation]: https://tools.ietf.org/html/rfc7541#section-6

@@ -290,3 +289,3 @@ // The *JavaScript object representation* of a header representation:

// the input stream is over.
// [_flush]: http://nodejs.org/api/stream.html#stream_transform_flush_callback
// [_flush]: https://nodejs.org/api/stream.html#stream_transform_flush_callback
HeaderSetDecompressor.prototype._flush = function _flush(callback) {

@@ -337,3 +336,3 @@ var buffer = concat(this._chunks);

// TransformStream class. It processes the input headers one by one:
// [_transform]: http://nodejs.org/api/stream.html#stream_transform_transform_chunk_encoding_callback
// [_transform]: https://nodejs.org/api/stream.html#stream_transform_transform_chunk_encoding_callback
HeaderSetCompressor.prototype._transform = function _transform(pair, encoding, callback) {

@@ -384,3 +383,3 @@ var name = pair[0].toLowerCase();

// TransformStream class. It gets called when there's no more header to compress. The final step:
// [_flush]: http://nodejs.org/api/stream.html#stream_transform_flush_callback
// [_flush]: https://nodejs.org/api/stream.html#stream_transform_flush_callback
HeaderSetCompressor.prototype._flush = function _flush(callback) {

@@ -390,3 +389,3 @@ callback();

// [Detailed Format](http://tools.ietf.org/html/draft-ietf-httpbis-header-compression-07#section-4)
// [Detailed Format](https://tools.ietf.org/html/rfc7541#section-5)
// -----------------

@@ -393,0 +392,0 @@

@@ -8,3 +8,3 @@ var assert = require('assert');

// subclassed by [Connection](connection.html) and the `upstream` component of [Stream](stream.html).
// [1]: http://nodejs.org/api/stream.html#stream_class_stream_duplex
// [1]: https://nodejs.org/api/stream.html#stream_class_stream_duplex

@@ -23,3 +23,3 @@ var Duplex = require('stream').Duplex;

//
// [1]: http://tools.ietf.org/html/draft-ietf-httpbis-http2-16#section-6.9.2
// [1]: https://tools.ietf.org/html/rfc7540#section-6.9.2

@@ -47,3 +47,3 @@ // API for child classes

// Small exception: pass -1 as `limit` if the max. flow control size is 0. `read(0)` means the
// same thing as [in the original API](http://nodejs.org/api/stream.html#stream_stream_read_0).
// same thing as [in the original API](https://nodejs.org/api/stream.html#stream_stream_read_0).
//

@@ -85,3 +85,3 @@ // * **getLastQueuedFrame(): frame**: returns the last frame in output buffers

// incoming frame is a WINDOW_UPDATE.
// [1]: http://nodejs.org/api/stream.html#stream_writable_write_chunk_encoding_callback_1
// [1]: https://nodejs.org/api/stream.html#stream_writable_write_chunk_encoding_callback_1
Flow.prototype._write = function _write(frame, encoding, callback) {

@@ -154,3 +154,3 @@ var sentToUs = (this._flowControlId === undefined) || (frame.stream === this._flowControlId);

// items in the output queue.
// [1]: http://nodejs.org/api/stream.html#stream_writable_write_chunk_encoding_callback_1
// [1]: https://nodejs.org/api/stream.html#stream_writable_write_chunk_encoding_callback_1
Flow.prototype._read = function _read() {

@@ -257,4 +257,5 @@ // * if the flow control queue is empty, then let the user push more frames

var data = frame && (frame.type === 'DATA') && frame.data;
var maxFrameLength = (this._window < 16384) ? this._window : 16384;
if (!data || (data.length <= this._window)) {
if (!data || (data.length <= maxFrameLength)) {
return this._parentPush(frame);

@@ -270,3 +271,3 @@ }

'Splitting out forwardable part of a DATA frame.');
frame.data = data.slice(this._window);
frame.data = data.slice(maxFrameLength);
this._parentPush({

@@ -276,3 +277,3 @@ type: 'DATA',

stream: frame.stream,
data: data.slice(0, this._window)
data: data.slice(0, maxFrameLength)
});

@@ -279,0 +280,0 @@ return null;

// The framer consists of two [Transform Stream][1] subclasses that operate in [object mode][2]:
// the Serializer and the Deserializer
// [1]: http://nodejs.org/api/stream.html#stream_class_stream_transform
// [2]: http://nodejs.org/api/stream.html#stream_new_stream_readable_options
// [1]: https://nodejs.org/api/stream.html#stream_class_stream_transform
// [2]: https://nodejs.org/api/stream.html#stream_new_stream_readable_options
var assert = require('assert');

@@ -149,6 +149,6 @@

// [Frame Header](http://tools.ietf.org/html/draft-ietf-httpbis-http2-16#section-4.1)
// [Frame Header](https://tools.ietf.org/html/rfc7540#section-4.1)
// --------------------------------------------------------------
//
// HTTP/2.0 frames share a common base format consisting of a 9-byte header followed by 0 to 2^24 - 1
// HTTP/2 frames share a common base format consisting of a 9-byte header followed by 0 to 2^24 - 1
// bytes of data.

@@ -277,3 +277,3 @@ //

// [DATA Frames](http://tools.ietf.org/html/draft-ietf-httpbis-http2-16#section-6.1)
// [DATA Frames](https://tools.ietf.org/html/rfc7540#section-6.1)
// ------------------------------------------------------------

@@ -325,3 +325,3 @@ //

// [HEADERS](http://tools.ietf.org/html/draft-ietf-httpbis-http2-16#section-6.2)
// [HEADERS](https://tools.ietf.org/html/rfc7540#section-6.2)
// --------------------------------------------------------------

@@ -424,3 +424,3 @@ //

// [PRIORITY](http://tools.ietf.org/html/draft-ietf-httpbis-http2-16#section-6.3)
// [PRIORITY](https://tools.ietf.org/html/rfc7540#section-6.3)
// -------------------------------------------------------

@@ -474,3 +474,3 @@ //

// [RST_STREAM](http://tools.ietf.org/html/draft-ietf-httpbis-http2-16#section-6.4)
// [RST_STREAM](https://tools.ietf.org/html/rfc7540#section-6.4)
// -----------------------------------------------------------

@@ -517,3 +517,3 @@ //

// [SETTINGS](http://tools.ietf.org/html/draft-ietf-httpbis-http2-16#section-6.5)
// [SETTINGS](https://tools.ietf.org/html/rfc7540#section-6.5)
// -------------------------------------------------------

@@ -625,3 +625,3 @@ //

// [PUSH_PROMISE](http://tools.ietf.org/html/draft-ietf-httpbis-http2-16#section-6.6)
// [PUSH_PROMISE](https://tools.ietf.org/html/rfc7540#section-6.6)
// ---------------------------------------------------------------

@@ -696,3 +696,3 @@ //

// [PING](http://tools.ietf.org/html/draft-ietf-httpbis-http2-16#section-6.7)
// [PING](https://tools.ietf.org/html/rfc7540#section-6.7)
// -----------------------------------------------

@@ -727,3 +727,3 @@ //

// [GOAWAY](http://tools.ietf.org/html/draft-ietf-httpbis-http2-16#section-6.8)
// [GOAWAY](https://tools.ietf.org/html/rfc7540#section-6.8)
// ---------------------------------------------------

@@ -783,3 +783,3 @@ //

// [WINDOW_UPDATE](http://tools.ietf.org/html/draft-ietf-httpbis-http2-16#section-6.9)
// [WINDOW_UPDATE](https://tools.ietf.org/html/rfc7540#section-6.9)
// -----------------------------------------------------------------

@@ -822,3 +822,3 @@ //

// [CONTINUATION](http://tools.ietf.org/html/draft-ietf-httpbis-http2-16#section-6.10)
// [CONTINUATION](https://tools.ietf.org/html/rfc7540#section-6.10)
// ------------------------------------------------------------

@@ -848,3 +848,3 @@ //

// [ALTSVC](http://tools.ietf.org/html/draft-ietf-httpbis-alt-svc-06#section-4)
// [ALTSVC](https://tools.ietf.org/html/rfc7838#section-4)
// ------------------------------------------------------------

@@ -874,3 +874,3 @@ //

// Origin: An OPTIONAL sequence of characters containing ASCII
// serialisation of an origin ([RFC6454](http://tools.ietf.org/html/rfc6454),
// serialisation of an origin ([RFC6454](https://tools.ietf.org/html/rfc6454),
// Section 6.2) that the alternate service is applicable to.

@@ -881,3 +881,3 @@ //

// length) containing a value identical to the Alt-Svc field value
// defined in (Section 3)[http://tools.ietf.org/html/draft-ietf-httpbis-alt-svc-06#section-3]
// defined in (Section 3)[https://tools.ietf.org/html/rfc7838#section-3]
// (ABNF production "Alt-Svc").

@@ -1106,3 +1106,3 @@

// [Error Codes](http://tools.ietf.org/html/draft-ietf-httpbis-http2-16#section-7)
// [Error Codes](https://tools.ietf.org/html/rfc7540#section-7)
// ------------------------------------------------------------

@@ -1109,0 +1109,0 @@

@@ -1,2 +0,2 @@

// [node-http2-protocol][homepage] is an implementation of the [HTTP/2 (draft 16)][http2]
// This is an implementation of the [HTTP/2][http2]
// framing layer for [node.js][node].

@@ -17,3 +17,3 @@ //

//
// * [Stream](stream.html): implementation of the [HTTP/2 stream concept](http2-stream).
// * [Stream](stream.html): implementation of the [HTTP/2 stream concept][http2-stream].
// Implements the [stream state machine][http2-streamstate] defined by the standard, provides

@@ -31,11 +31,10 @@ // management methods and events for using the stream (sending/receiving headers, data, etc.),

//
// [homepage]: https://github.com/molnarg/node-http2
// [http2]: http://tools.ietf.org/html/draft-ietf-httpbis-http2-16
// [http2-connheader]: http://tools.ietf.org/html/draft-ietf-httpbis-http2-16#section-3.5
// [http2-stream]: http://tools.ietf.org/html/draft-ietf-httpbis-http2-16#section-5
// [http2-streamstate]: http://tools.ietf.org/html/draft-ietf-httpbis-http2-16#section-5.1
// [node]: http://nodejs.org/
// [node-stream]: http://nodejs.org/api/stream.html
// [node-https]: http://nodejs.org/api/https.html
// [node-http]: http://nodejs.org/api/http.html
// [http2]: https://tools.ietf.org/html/rfc7540
// [http2-connheader]: https://tools.ietf.org/html/rfc7540#section-3.5
// [http2-stream]: https://tools.ietf.org/html/rfc7540#section-5
// [http2-streamstate]: https://tools.ietf.org/html/rfc7540#section-5.1
// [node]: https://nodejs.org/
// [node-stream]: https://nodejs.org/api/stream.html
// [node-https]: https://nodejs.org/api/https.html
// [node-http]: https://nodejs.org/api/http.html

@@ -42,0 +41,0 @@ exports.VERSION = 'h2';

@@ -6,4 +6,4 @@ var assert = require('assert');

// Stream is a [Duplex stream](http://nodejs.org/api/stream.html#stream_class_stream_duplex)
// subclass that implements the [HTTP/2 Stream](http://http2.github.io/http2-spec/#rfc.section.3.4)
// Stream is a [Duplex stream](https://nodejs.org/api/stream.html#stream_class_stream_duplex)
// subclass that implements the [HTTP/2 Stream](https://tools.ietf.org/html/rfc7540#section-5)
// concept. It has two 'sides': one that is used by the user to send/receive data (the `stream`

@@ -44,3 +44,3 @@ // object itself) and one that is used by a Connection to read/write frames to/from the other peer

// Headers are always in the [regular node.js header format][1].
// [1]: http://nodejs.org/api/http.html#http_message_headers
// [1]: https://nodejs.org/api/http.html#http_message_headers

@@ -187,3 +187,3 @@ // Constructor

// the user to write or read the body of the request.
// [1]: http://nodejs.org/api/stream.html#stream_class_stream_duplex
// [1]: https://nodejs.org/api/stream.html#stream_class_stream_duplex

@@ -358,3 +358,3 @@ // upstream side stream user side

// [Stream States](http://tools.ietf.org/html/draft-ietf-httpbis-http2-16#section-5.1)
// [Stream States](https://tools.ietf.org/html/rfc7540#section-5.1)
// ----------------

@@ -361,0 +361,0 @@ //

{
"name": "http2",
"version": "3.3.4",
"version": "3.3.5",
"description": "An HTTP/2 client and server implementation",

@@ -18,3 +18,3 @@ "main": "lib/index.js",

"test": "istanbul test _mocha -- --reporter spec --slow 500 --timeout 15000",
"doc": "docco lib/* --output doc --layout parallel --css doc/docco.css"
"doc": "docco lib/* --output doc --layout parallel --template root.jst --css doc/docco.css && docco lib/protocol/* --output doc/protocol --layout parallel --template protocol.jst --css doc/docco.css"
},

@@ -21,0 +21,0 @@ "repository": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc