@@ -100,6 +100,7 @@ HTTPParser.prototype.reinitialize = HTTPParser;
100
100
HTTPParser . prototype . close =
101
101
HTTPParser . prototype . pause =
102
102
HTTPParser . prototype . resume =
103
+ HTTPParser . prototype . remove =
103
104
HTTPParser . prototype . free = function ( ) { } ;
104
105
HTTPParser . prototype . _compatMode0_11 = false ;
105
106
HTTPParser . prototype . getAsyncId = function ( ) { return 0 ; } ;
@@ -394,7 +395,8 @@ HTTPParser.prototype.BODY_CHUNKHEAD = function () {
394
395
395
396
HTTPParser . prototype . BODY_CHUNK = function ( ) {
396
397
var length = Math . min ( this . end - this . offset , this . body_bytes ) ;
397
- this . userCall ( ) ( this [ kOnBody ] ( this . chunk , this . offset , length ) ) ;
398
+ // 0, length are for backwards compatibility. See: https://github.com/creationix/http-parser-js/pull/98
399
+ this . userCall ( ) ( this [ kOnBody ] ( this . chunk . slice ( this . offset , this . offset + length ) , 0 , length ) ) ;
398
400
this . offset += length ;
399
401
this . body_bytes -= length ;
400
402
if ( ! this . body_bytes ) {
@@ -429,14 +431,15 @@ HTTPParser.prototype.BODY_CHUNKTRAILERS = function () {
429
431
} ;
430
432
431
433
HTTPParser . prototype . BODY_RAW = function ( ) {
432
- var length = this . end - this . offset ;
433
- this . userCall ( ) ( this [ kOnBody ] ( this . chunk , this . offset , length ) ) ;
434
+ // 0, length are for backwards compatibility. See: https://github.com/creationix/http-parser-js/pull/98
435
+ this . userCall ( ) ( this [ kOnBody ] ( this . chunk . slice ( this . offset , this . end ) , 0 , this . end - this . offset ) ) ;
434
436
this . offset = this . end ;
435
437
} ;
436
438
437
439
HTTPParser . prototype . BODY_SIZED = function ( ) {
438
440
var length = Math . min ( this . end - this . offset , this . body_bytes ) ;
439
- this . userCall ( ) ( this [ kOnBody ] ( this . chunk , this . offset , length ) ) ;
441
+ // 0, length are for backwards compatibility. See: https://github.com/creationix/http-parser-js/pull/98
442
+ this . userCall ( ) ( this [ kOnBody ] ( this . chunk . slice ( this . offset , this . offset + length ) , 0 , length ) ) ;
440
443
this . offset += length ;
441
444
this . body_bytes -= length ;
442
445
if ( ! this . body_bytes ) {
0 commit comments