spdy
Advanced tools
Comparing version 0.1.2 to 0.1.4
@@ -12,2 +12,14 @@ /** | ||
/** | ||
* Compatibility with older versions of node | ||
*/ | ||
if (!Buffer.prototype.readUInt32BE) { | ||
Buffer.prototype.readUInt32BE = function(offset, noAssert) { | ||
return this.readUInt32(offset, 'big'); | ||
}; | ||
Buffer.prototype.readUInt16BE = function(offset, noAssert) { | ||
return this.readUInt16(offset, 'big'); | ||
}; | ||
} | ||
/** | ||
* Class @constructor | ||
@@ -80,3 +92,3 @@ */ | ||
var len = buffer.readUInt32(4, 'big') & 0xffffff; | ||
var len = buffer.readUInt32BE(4) & 0xffffff; | ||
@@ -94,6 +106,6 @@ buffer = this.concat(8 + len); | ||
if (headers.c) { | ||
headers.version = buffer.readUInt16(0, 'big') & 0x7fff; | ||
headers.type = buffer.readUInt16(2, 'big'); | ||
headers.version = buffer.readUInt16BE(0) & 0x7fff; | ||
headers.type = buffer.readUInt16BE(2); | ||
} else { | ||
headers.streamID = buffer.readUInt32(0, 'big'); | ||
headers.streamID = buffer.readUInt32BE(0); | ||
} | ||
@@ -113,4 +125,4 @@ | ||
var parsed = { | ||
streamID: data.readUInt32(0, 'big') & 0x7fffffff, | ||
assocStreamID: data.readUInt32(4, 'big') & 0x7fffffff, | ||
streamID: data.readUInt32BE(0) & 0x7fffffff, | ||
assocStreamID: data.readUInt32BE(4) & 0x7fffffff, | ||
priority: (data[8] && 192) >> 6, | ||
@@ -122,3 +134,3 @@ nameValues: {} | ||
var parsed = { | ||
streamID: data.readUInt32(0, 'big') & 0x7fffffff, | ||
streamID: data.readUInt32BE(0) & 0x7fffffff, | ||
nameValues: {} | ||
@@ -129,4 +141,4 @@ }; | ||
var parsed = { | ||
streamID: data.readUInt32(0, 'big') & 0x7fffffff, | ||
statusCode: data.readUInt32(4, 'big') | ||
streamID: data.readUInt32BE(0) & 0x7fffffff, | ||
statusCode: data.readUInt32BE(4) | ||
}; | ||
@@ -149,3 +161,3 @@ data = parsed; | ||
var valueLen = nvs.readUInt16(0, 'big'), | ||
var valueLen = nvs.readUInt16BE(0), | ||
value = nvs.slice(2, 2 + valueLen); | ||
@@ -152,0 +164,0 @@ nvs = nvs.slice(2 + valueLen); |
@@ -9,2 +9,17 @@ /** | ||
/** | ||
* Compatibility with older versions of node | ||
*/ | ||
if (!Buffer.prototype.writeUInt32BE) { | ||
Buffer.prototype.writeUInt32BE = function(value, offset, noAssert) { | ||
this.writeUInt32(value, offset, 'big'); | ||
}; | ||
Buffer.prototype.writeUInt32LE = function(value, offset, noAssert) { | ||
this.writeUInt32(value, offset, 'little'); | ||
}; | ||
Buffer.prototype.writeUInt16BE = function(value, offset, noAssert) { | ||
this.writeUInt16(value, offset, 'big'); | ||
}; | ||
} | ||
/** | ||
* Create and return dataframe buffer | ||
@@ -20,3 +35,3 @@ */ | ||
// Insert stream id | ||
result.writeUInt32(headers.streamID & 0x7fffffff, 0, 'big'); | ||
result.writeUInt32BE(headers.streamID & 0x7fffffff, 0); | ||
return result; | ||
@@ -42,6 +57,6 @@ }; | ||
// Insert version | ||
result.writeUInt16(headers.version | 0x8000, 0, 'big'); | ||
result.writeUInt16BE(headers.version | 0x8000, 0); | ||
// Insert type | ||
result.writeUInt16(headers.type, 2, 'big'); | ||
result.writeUInt16BE(headers.type, 2); | ||
@@ -75,11 +90,11 @@ return result; | ||
// Insert keys count | ||
buff.writeUInt32(keysLen, 0, 'big'); | ||
buff.writeUInt32BE(keysLen, 0); | ||
keys.reduce(function(offset, key) { | ||
var raw_key = enums[key]; | ||
buff.writeUInt32(raw_key & 0xffffff, offset, 'little'); | ||
buff.writeUInt32LE(raw_key & 0xffffff, offset); | ||
var value = settings[key]; | ||
buff.writeUInt32(value, offset + 4, 'big'); | ||
buff.writeUInt32BE(value, offset + 4); | ||
@@ -135,3 +150,3 @@ return offset + 8; | ||
// Insert nvs count | ||
buff.writeUInt16(nvsCount, 0, 'big'); | ||
buff.writeUInt16BE(nvsCount, 0); | ||
@@ -144,3 +159,3 @@ Object.keys(nvs).filter(function(key) { | ||
buff.writeUInt16(nameLen, prev, 'big'); | ||
buff.writeUInt16BE(nameLen, prev); | ||
buff.write(key.toString().toLowerCase(), prev + 2); | ||
@@ -150,3 +165,3 @@ | ||
buff.writeUInt16(valueLen, prev, 'big'); | ||
buff.writeUInt16BE(valueLen, prev); | ||
buff.write(nvs[key].toString(), prev + 2); | ||
@@ -166,3 +181,3 @@ | ||
// Insert assocStreamID for SYN_STREAM | ||
buff.writeUInt32(assocStreamID & 0x7fffffff, 4, 'big'); | ||
buff.writeUInt32BE(assocStreamID & 0x7fffffff, 4); | ||
@@ -176,3 +191,3 @@ deflated.copy(buff, 10); | ||
// Insert streamID | ||
buff.writeUInt32(streamID & 0x7fffffff, 0, 'big'); | ||
buff.writeUInt32BE(streamID & 0x7fffffff, 0); | ||
@@ -179,0 +194,0 @@ // Insert priority |
{ | ||
"name": "spdy", | ||
"description": "Implementation of the SPDY protocol on node.js.", | ||
"version": "0.1.2", | ||
"version": "0.1.4", | ||
"author": "Fedor Indutny <fedor.indutny@gmail.com>", | ||
"dependencies": { | ||
"zlibcontext": ">= 1.0.4" | ||
"zlibcontext": "~ 1.0.9" | ||
}, | ||
"engine": ["node >= 0.5.x"], | ||
"main": "./lib/spdy" | ||
} | ||
"engines": [ | ||
"node >= 0.6.0" | ||
], | ||
"main": "./lib/spdy", | ||
"devDependencies": {} | ||
} |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
Found 1 instance in 1 package
125618
1279
0
9
Updatedzlibcontext@~ 1.0.9