docker-stream-cleanser
Advanced tools
Comparing version 0.0.13 to 0.0.14
10
app.js
@@ -49,8 +49,5 @@ module.exports = function(data, encoding, fixCarriageReturns) { | ||
// have the first 4 bytes (hopefully). | ||
if (data[0] > 0 && data[0] < 4 && (data[1] - data[2] - data[3] === 0)) { | ||
if (data.length > 0 && data[0] > 0 && data[0] < 4) { | ||
// If true, we at least have a legit docker message' | ||
if (data.length < 8) { | ||
// If we don't even have enough message for the full header, save it to the buffer and leave | ||
lastBuffer = data; | ||
} else { | ||
if (data[1] - data[2] - data[3] === 0) { | ||
// We can at least read the size now. | ||
@@ -85,2 +82,5 @@ var header = data.slice(0, 8); | ||
} | ||
} else if (data.length < 8 ) { | ||
// If we don't even have enough message for the full header, save it to the buffer and leave | ||
lastBuffer = data; | ||
} | ||
@@ -87,0 +87,0 @@ } else { |
{ | ||
"name": "docker-stream-cleanser", | ||
"version": "0.0.13", | ||
"version": "0.0.14", | ||
"main": "app.js", | ||
@@ -5,0 +5,0 @@ "devDependencies": { |
@@ -158,4 +158,4 @@ var Lab = require('lab'); | ||
dockerStream.write(dataWithHeader.toString('hex') + | ||
dataWithHeader2.slice(0, 4).toString('hex')); | ||
dockerStream.write(dataWithHeader2.slice(4).toString('hex')); | ||
dataWithHeader2.slice(0, 1).toString('hex')); | ||
dockerStream.write(dataWithHeader2.slice(1).toString('hex')); | ||
}); | ||
@@ -162,0 +162,0 @@ |
Sorry, the diff of this file is not supported yet
79142