Skip to content

Commit 9c8005a

Browse files
committed
Fix body parsing
This was broken by: nodejs/node@b970634
1 parent 88c6653 commit 9c8005a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

http-parser.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ HTTPParser.prototype.reinitialize = HTTPParser;
9898
HTTPParser.prototype.close =
9999
HTTPParser.prototype.pause =
100100
HTTPParser.prototype.resume =
101+
HTTPParser.prototype.remove =
101102
HTTPParser.prototype.free = function () {};
102103
HTTPParser.prototype._compatMode0_11 = false;
103104
HTTPParser.prototype.getAsyncId = function() { return 0; };
@@ -392,7 +393,7 @@ HTTPParser.prototype.BODY_CHUNKHEAD = function () {
392393

393394
HTTPParser.prototype.BODY_CHUNK = function () {
394395
var length = Math.min(this.end - this.offset, this.body_bytes);
395-
this.userCall()(this[kOnBody](this.chunk, this.offset, length));
396+
this.userCall()(this[kOnBody](this.chunk.slice(this.offset, this.offset + length)));
396397
this.offset += length;
397398
this.body_bytes -= length;
398399
if (!this.body_bytes) {
@@ -425,14 +426,13 @@ HTTPParser.prototype.BODY_CHUNKTRAILERS = function () {
425426
};
426427

427428
HTTPParser.prototype.BODY_RAW = function () {
428-
var length = this.end - this.offset;
429-
this.userCall()(this[kOnBody](this.chunk, this.offset, length));
429+
this.userCall()(this[kOnBody](this.chunk.slice(this.offset, this.end)));
430430
this.offset = this.end;
431431
};
432432

433433
HTTPParser.prototype.BODY_SIZED = function () {
434434
var length = Math.min(this.end - this.offset, this.body_bytes);
435-
this.userCall()(this[kOnBody](this.chunk, this.offset, length));
435+
this.userCall()(this[kOnBody](this.chunk.slice(this.offset, this.offset + length)));
436436
this.offset += length;
437437
this.body_bytes -= length;
438438
if (!this.body_bytes) {

0 commit comments

Comments
 (0)