Comparing version 4.0.1 to 4.0.2
@@ -140,2 +140,3 @@ // Public API | ||
var assign = Object.assign || require('object.assign'); | ||
var pako = require('pako'); | ||
@@ -319,3 +320,2 @@ exports.STATUS_CODES = { | ||
} | ||
// * The last header block, if it's not the first, will represent the trailers | ||
@@ -1032,10 +1032,2 @@ var self = this; | ||
endpoint.socket.on('close', function (error) { | ||
// DPW This is sort of a hack to protect against | ||
// the reuse of a endpoint that has the underlying | ||
// connection closed. It would probably be better | ||
// to implement this near lin 933 (if (key in this.endpoints)) | ||
// by checking the endpoint state (requires new API to expose) | ||
// Alternatively, this could be a bug with my WS connection | ||
// not emitting an error when it is unexpectedly closed ?? | ||
delete self.endpoints[key]; | ||
@@ -1237,2 +1229,7 @@ }); | ||
} | ||
if (!headers['accept-encoding']) // The app expects to handle the encoding | ||
{ | ||
headers['accept-encoding'] = 'gzip'; | ||
} | ||
headers[':path'] = options.path; | ||
@@ -1239,0 +1236,0 @@ |
@@ -59,2 +59,4 @@ var assert = require('assert'); | ||
this._initializeConnectionFlowControl(); | ||
// * multiplexing | ||
@@ -435,3 +437,10 @@ this._initializeMultiplexing(); | ||
// The initial connection flow control window is 6mb bytes. | ||
var INITIAL_STREAM_WINDOW_SIZE = 6*1024*1024; | ||
var DEFAULT_CONNECTION_WINDOW_SIZE = 65535; | ||
var INITIAL_CONNECTION_WINDOW_SIZE = 15*1024*1024; | ||
var defaultSettings = { | ||
'SETTINGS_INITIAL_WINDOW_SIZE': INITIAL_STREAM_WINDOW_SIZE | ||
}; | ||
@@ -517,2 +526,3 @@ | ||
}); | ||
for (var name in settings) { | ||
@@ -637,5 +647,17 @@ this.emit('SENDING_' + name, settings[name]); | ||
// The initial connection flow control window is 65535 bytes. | ||
var INITIAL_STREAM_WINDOW_SIZE = 65535; | ||
Connection.prototype._initializeConnectionFlowControl = function _initializeConnectionFlowControl() { | ||
// This WINDOW_UPDATE increases the connection budget to 15mb | ||
var windowSize = INITIAL_CONNECTION_WINDOW_SIZE - DEFAULT_CONNECTION_WINDOW_SIZE; | ||
if (windowSize > 0) { | ||
this.push({ | ||
type: 'WINDOW_UPDATE', | ||
flags: {}, | ||
stream: 0, | ||
window_size: windowSize | ||
}); | ||
} | ||
}; | ||
// A SETTINGS frame can alter the initial flow control window size for all current streams. When the | ||
@@ -642,0 +664,0 @@ // value of SETTINGS_INITIAL_WINDOW_SIZE changes, a receiver MUST adjust the window size of all |
var assert = require('assert'); | ||
var pako = require('pako'); | ||
var Buffer = require('buffer').Buffer; | ||
@@ -113,2 +115,6 @@ // The Stream class | ||
} | ||
if (this.state === 'HALF_CLOSED_LOCAL') // transitioned just before this | ||
{ | ||
this.contentEncoding = frame.headers['content-encoding']; | ||
} | ||
this.emit('headers', frame.headers); | ||
@@ -277,6 +283,28 @@ }; | ||
if (!this._ended && (frame.type === 'DATA')) { | ||
var moreNeeded = this.push(frame.data); | ||
if (!moreNeeded) { | ||
this._receiveMore = ready; | ||
if (this.contentEncoding === 'gzip' && frame.data.length > 0) | ||
{ | ||
if (!this.pakoInf) | ||
{ | ||
var self = this; | ||
this.pakoInf = new pako.Inflate(); | ||
this.pakoInf.onData = function(data) | ||
{ | ||
var moreNeeded = self.push(Buffer.from(data)); | ||
if (!moreNeeded) | ||
{ | ||
this._receiveMore = ready; | ||
} | ||
}; | ||
} | ||
var data = frame.data; | ||
this.pakoInf.push(data, frame.END_STREAM); | ||
} | ||
else | ||
{ | ||
var moreNeeded = this.push(frame.data); | ||
if (!moreNeeded) | ||
{ | ||
this._receiveMore = ready; | ||
} | ||
} | ||
} | ||
@@ -283,0 +311,0 @@ |
{ | ||
"name": "http2.js", | ||
"version": "4.0.1", | ||
"version": "4.0.2", | ||
"description": "An HTTP/2 client and server implementation", | ||
@@ -11,7 +11,7 @@ "main": "lib/index.js", | ||
"bunyan": "^2.0.2", | ||
"chai": "*", | ||
"docco": "*", | ||
"istanbul": "*", | ||
"jshint": "*", | ||
"mocha": "*", | ||
"chai": "^4.1.2", | ||
"docco": "^0.7.0", | ||
"istanbul": "^0.4.5", | ||
"jshint": "^2.9.5", | ||
"mocha": "^4.0.1", | ||
"websocket-stream": "^5.0.1" | ||
@@ -22,3 +22,3 @@ }, | ||
"pretest": "npm run lint", | ||
"test": "istanbul test node_modules/mocha/bin/_mocha -- --reporter spec --slow 500 --timeout 15000", | ||
"test": "istanbul test node_modules/mocha/bin/_mocha -- --reporter spec --slow 500 --timeout 15000 --exit", | ||
"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" | ||
@@ -58,4 +58,5 @@ }, | ||
"object.assign": "^4.0.4", | ||
"setimmediate": "^1.0.5" | ||
"setimmediate": "^1.0.5", | ||
"pako": "1.0.6" | ||
} | ||
} |
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
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
245506
5346
4
+ Addedpako@1.0.6
+ Addedpako@1.0.6(transitive)