Comparing version 5.0.0 to 5.0.1
@@ -11,10 +11,11 @@ 'use strict'; | ||
internals.Range = class { | ||
// RFC 7233 (https://tools.ietf.org/html/rfc7233#appendix-D) | ||
// | ||
// Range = "bytes" "=" byte-range-set | ||
// byte-range-set = *( "," OWS ) byte-range-spec *( OWS "," [ OWS byte-range-spec ] ) | ||
// byte-range-spec = ( 1*DIGIT "-" [ 1*DIGIT ] ) / ( "-" 1*DIGIT ) | ||
constructor(from, to) { | ||
this.from = from; | ||
this.to = to; | ||
} | ||
}; | ||
// 12 3 3 4 425 6 7 7 8 865 1 | ||
internals.headerRx = /^bytes=[\s,]*((?:(?:\d+\-\d*)|(?:\-\d+))(?:\s*,\s*(?:(?:\d+\-\d*)|(?:\-\d+)))*)$/i; | ||
@@ -26,6 +27,4 @@ | ||
const parts = header.split('='); | ||
if (parts.length !== 2 || | ||
parts[0] !== 'bytes') { | ||
const parts = internals.headerRx.exec(header); | ||
if (!parts) { | ||
return null; | ||
@@ -42,6 +41,2 @@ } | ||
for (let range of ranges) { | ||
if (range.length === 1) { // '-' | ||
return null; | ||
} | ||
let from; | ||
@@ -106,2 +101,12 @@ let to; | ||
internals.Range = class { | ||
constructor(from, to) { | ||
this.from = from; | ||
this.to = to; | ||
} | ||
}; | ||
exports.Clip = class extends Stream.Transform { | ||
@@ -108,0 +113,0 @@ |
{ | ||
"name": "@hapi/ammo", | ||
"description": "HTTP Range processing utilities", | ||
"version": "5.0.0", | ||
"version": "5.0.1", | ||
"repository": "git://github.com/hapijs/ammo", | ||
@@ -6,0 +6,0 @@ "main": "lib/index.js", |
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
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
8349
162
0