http2-protocol
Advanced tools
Comparing version 0.12.1 to 0.12.2
Version history | ||
=============== | ||
### 0.12.2 (2014-05-25) ### | ||
* Support for node 0.11.x | ||
### 0.12.1 (2014-04-26) ### | ||
@@ -5,0 +9,0 @@ |
@@ -200,25 +200,13 @@ var assert = require('assert'); | ||
// * Looking at the first frame in the queue without pulling it out if possible. This will save | ||
// a costly unshift if the frame proves to be too large to return. | ||
var firstInQueue = this._readableState.buffer[0]; | ||
var frame = firstInQueue || Duplex.prototype.read.call(this); | ||
if ((frame === null) || (frame.type !== 'DATA') || (frame.data.length <= limit)) { | ||
if (firstInQueue) { | ||
Duplex.prototype.read.call(this); | ||
} | ||
return frame; | ||
// * Looking at the first frame in the queue without pulling it out if possible. | ||
var frame = this._readableState.buffer[0]; | ||
if (!frame && !this._readableState.ended) { | ||
this._read(); | ||
frame = this._readableState.buffer[0]; | ||
} | ||
else if (limit <= 0) { | ||
if (!firstInQueue) { | ||
this.unshift(frame); | ||
} | ||
return null; | ||
} | ||
else { | ||
if (frame && (frame.type === 'DATA') && limit && (frame.data.length > limit)) { | ||
this._log.trace({ frame: frame, size: frame.data.length, forwardable: limit }, | ||
'Splitting out forwardable part of a DATA frame.'); | ||
var forwardable = { | ||
this.unshift({ | ||
type: 'DATA', | ||
@@ -228,10 +216,7 @@ flags: {}, | ||
data: frame.data.slice(0, limit) | ||
}; | ||
}); | ||
frame.data = frame.data.slice(limit); | ||
} | ||
if (!firstInQueue) { | ||
this.unshift(frame); | ||
} | ||
return forwardable; | ||
} | ||
return Duplex.prototype.read.call(this); | ||
}; | ||
@@ -238,0 +223,0 @@ |
{ | ||
"name": "http2-protocol", | ||
"version": "0.12.1", | ||
"version": "0.12.2", | ||
"description": "A JavaScript implementation of the HTTP/2 framing layer", | ||
"main": "lib/index.js", | ||
"engines" : { | ||
"node" : "0.10.x" | ||
"node" : ">=0.10.0" | ||
}, | ||
@@ -9,0 +9,0 @@ "devDependencies": { |
@@ -53,8 +53,8 @@ node-http2-protocol | ||
To generate a code coverage report, run `npm test --coverage` (it may be slow, be patient). | ||
Code coverage summary as of version 0.12.1: | ||
Code coverage summary as of version 0.12.2: | ||
``` | ||
Statements : 91.63% ( 1357/1481 ) | ||
Branches : 85.2% ( 564/662 ) | ||
Statements : 91.86% ( 1354/1474 ) | ||
Branches : 85.69% ( 563/657 ) | ||
Functions : 92.5% ( 148/160 ) | ||
Lines : 91.72% ( 1351/1473 ) | ||
Lines : 91.95% ( 1348/1466 ) | ||
``` | ||
@@ -61,0 +61,0 @@ |
@@ -131,6 +131,6 @@ var expect = require('chai').expect; | ||
}); | ||
client_stream.on('readable', function() { | ||
expect(client_stream.read()).to.deep.equal(response_data); | ||
client_stream.on('data', function(data) { | ||
expect(data).to.deep.equal(response_data); | ||
done(); | ||
}); | ||
}) | ||
}); | ||
@@ -166,4 +166,4 @@ }); | ||
}); | ||
request.on('readable', function() { | ||
expect(request.read()).to.deep.equal(response_content); | ||
request.on('data', function(data) { | ||
expect(data).to.deep.equal(response_content); | ||
done(); | ||
@@ -177,9 +177,7 @@ }); | ||
}); | ||
pushed.on('readable', function() { | ||
expect(pushed.read()).to.deep.equal(push_content); | ||
pushed.on('data', function(data) { | ||
expect(data).to.deep.equal(push_content); | ||
done(); | ||
}); | ||
pushed.on('end', function() { | ||
done(); | ||
}); | ||
pushed.on('end', done); | ||
}); | ||
@@ -186,0 +184,0 @@ }); |
@@ -38,6 +38,4 @@ var expect = require('chai').expect; | ||
'control queue is empty', function() { | ||
var sendCalled = 0; | ||
var notFlowControlledFrame = { type: 'PRIORITY', flags: {}, priority: 1 }; | ||
flow._send = function _send() { | ||
sendCalled += 1; | ||
this.push(notFlowControlledFrame); | ||
@@ -49,6 +47,6 @@ }; | ||
flow._queue.push({ type: 'DATA', flags: {}, data: { length: 1 } }); | ||
expect(flow.read().type).to.equal('BLOCKED'); | ||
var frame = flow.read(); | ||
while (frame.type === notFlowControlledFrame.type) frame = flow.read(); | ||
expect(frame.type).to.equal('BLOCKED'); | ||
expect(flow.read()).to.equal(null); | ||
expect(sendCalled).to.equal(1); | ||
}); | ||
@@ -210,3 +208,2 @@ it('has to be overridden by the child class, otherwise it throws', function() { | ||
// Sender side | ||
console.log(flow1._flowControlId, flow2._flowControlId) | ||
var frameNumber = util.random(5, 8); | ||
@@ -213,0 +210,0 @@ var input = []; |
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
247367
5765