Comparing version 5.0.3 to 5.1.0
@@ -52,3 +52,4 @@ 'use strict'; | ||
internals.defaults = { | ||
maxBytes: Infinity | ||
maxBytes: Infinity, | ||
maxParts: Infinity | ||
}; | ||
@@ -75,4 +76,6 @@ | ||
this._error = null; | ||
this._bytes = 0; | ||
this._bytesCount = 0; | ||
this._partsCount = 0; | ||
this._maxBytes = settings.maxBytes; | ||
this._maxParts = settings.maxParts; | ||
@@ -137,5 +140,5 @@ this._parts = new Nigel.Stream(Buffer.from('--' + settings.boundary)); | ||
this._bytes += Buffer.byteLength(data); | ||
this._bytesCount += Buffer.byteLength(data); | ||
if (this._bytes > this._maxBytes) { | ||
if (this._bytesCount > this._maxBytes) { | ||
finish(Boom.entityTooLarge('Maximum size exceeded')); | ||
@@ -199,2 +202,8 @@ } | ||
} | ||
else { | ||
this._partsCount++; | ||
if (this._partsCount > this._maxParts) { | ||
return this._abort(Boom.badRequest('Maximum parts exceeded')); | ||
} | ||
} | ||
@@ -201,0 +210,0 @@ this._state = internals.state.boundary; |
{ | ||
"name": "@hapi/pez", | ||
"description": "Multipart parser", | ||
"version": "5.0.3", | ||
"version": "5.1.0", | ||
"repository": "git://github.com/hapijs/pez", | ||
@@ -15,2 +15,7 @@ "main": "lib/index.js", | ||
], | ||
"eslintConfig": { | ||
"extends": [ | ||
"plugin:@hapi/module" | ||
] | ||
}, | ||
"dependencies": { | ||
@@ -25,6 +30,7 @@ "@hapi/b64": "5.x.x", | ||
"@hapi/code": "8.x.x", | ||
"@hapi/lab": "22.x.x", | ||
"@hapi/teamwork": "4.x.x", | ||
"@hapi/eslint-plugin": "5.x.x", | ||
"@hapi/lab": "24.x.x", | ||
"@hapi/teamwork": "5.x.x", | ||
"@hapi/wreck": "17.x.x", | ||
"form-data": "3.x.x" | ||
"form-data": "4.x.x" | ||
}, | ||
@@ -31,0 +37,0 @@ "scripts": { |
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
13287
277
6