Comparing version 2.5.1 to 2.5.2
@@ -7,2 +7,6 @@ # Changes | ||
## v2.5.2 (2014-10-10) | ||
* Fix receiving large text fields #922 | ||
## v2.5.1 (2014-09-22) | ||
@@ -9,0 +13,0 @@ |
@@ -101,21 +101,32 @@ var MAX_PACKET_LENGTH = Math.pow(2, 24) - 1; | ||
Parser.prototype.append = function(newBuffer) { | ||
// If resume() is called, we don't pass a buffer to write() | ||
if (!newBuffer) { | ||
Parser.prototype.append = function append(chunk) { | ||
if (!chunk || chunk.length === 0) { | ||
return; | ||
} | ||
var oldBuffer = this._buffer; | ||
var bytesRemaining = this._bytesRemaining(); | ||
var newLength = bytesRemaining + newBuffer.length; | ||
var buffer = chunk; | ||
var sliceEnd = this._buffer.length; | ||
var sliceStart = this._packetOffset === null | ||
? this._offset | ||
: this._packetOffset; | ||
var sliceLength = sliceEnd - sliceStart; | ||
var combinedBuffer = (this._offset > newLength) | ||
? oldBuffer.slice(0, newLength) | ||
: new Buffer(newLength); | ||
if (sliceLength !== 0) { | ||
// Create a new Buffer | ||
buffer = new Buffer(sliceLength + chunk.length); | ||
oldBuffer.copy(combinedBuffer, 0, this._offset); | ||
newBuffer.copy(combinedBuffer, bytesRemaining); | ||
// Copy data | ||
this._buffer.copy(buffer, 0, sliceStart, sliceEnd); | ||
chunk.copy(buffer, sliceLength); | ||
} | ||
this._buffer = combinedBuffer; | ||
this._offset = 0; | ||
// Adjust data-tracking pointers | ||
this._buffer = buffer; | ||
this._offset = this._offset - sliceStart; | ||
this._packetEnd = this._packetEnd !== null | ||
? this._packetEnd - sliceStart | ||
: null; | ||
this._packetOffset = this._packetOffset !== null | ||
? this._packetOffset - sliceStart | ||
: null; | ||
}; | ||
@@ -122,0 +133,0 @@ |
{ | ||
"name": "mysql", | ||
"description": "A node.js driver for mysql. It is written in JavaScript, does not require compiling, and is 100% MIT licensed.", | ||
"version": "2.5.1", | ||
"version": "2.5.2", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "author": "Felix Geisendörfer <felix@debuggable.com> (http://debuggable.com/)", |
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
306692
5499