Comparing version 3.1.1 to 3.1.2
@@ -21,2 +21,13 @@ 'use strict'; | ||
// 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 ) | ||
// 12 3 3 4 425 6 7 7 8 865 1 | ||
internals.headerRx = /^bytes=[\s,]*((?:(?:\d+\-\d*)|(?:\-\d+))(?:\s*,\s*(?:(?:\d+\-\d*)|(?:\-\d+)))*)$/i; | ||
exports.header = function (header, length) { | ||
@@ -26,6 +37,4 @@ | ||
const parts = header.split('='); | ||
if (parts.length !== 2 || | ||
parts[0] !== 'bytes') { | ||
const parts = internals.headerRx.exec(header); | ||
if (!parts) { | ||
return null; | ||
@@ -41,8 +50,3 @@ } | ||
for (let i = 0; i < ranges.length; ++i) { | ||
let range = ranges[i]; | ||
if (range.length === 1) { // '-' | ||
return null; | ||
} | ||
for (let range of ranges) { | ||
let from; | ||
@@ -49,0 +53,0 @@ let to; |
{ | ||
"name": "@hapi/ammo", | ||
"description": "HTTP Range processing utilities", | ||
"version": "3.1.1", | ||
"version": "3.1.2", | ||
"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
8160
116