Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

inert

Package Overview
Dependencies
Maintainers
2
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

inert - npm Package Compare versions

Comparing version 4.0.0 to 4.0.1

48

lib/file.js

@@ -166,39 +166,41 @@ 'use strict';

if (request.headers.range && length) {
if (request.route.settings.response.ranges !== false) { // Backwards compatible comparison
if (request.headers.range && length) {
// Check If-Range
// Check If-Range
if (!request.headers['if-range'] ||
request.headers['if-range'] === response.headers.etag) { // Ignoring last-modified date (weak)
if (!request.headers['if-range'] ||
request.headers['if-range'] === response.headers.etag) { // Ignoring last-modified date (weak)
// Check that response is not encoded once transmitted
// Check that response is not encoded once transmitted
const mime = request.server.mime.type(response.headers['content-type'] || 'application/octet-stream');
const encoding = (request.connection.settings.compression && mime.compressible && !response.headers['content-encoding'] ? request.info.acceptEncoding : null);
const mime = request.server.mime.type(response.headers['content-type'] || 'application/octet-stream');
const encoding = (request.connection.settings.compression && mime.compressible && !response.headers['content-encoding'] ? request.info.acceptEncoding : null);
if (encoding === 'identity' || !encoding) {
if (encoding === 'identity' || !encoding) {
// Parse header
// Parse header
const ranges = Ammo.header(request.headers.range, length);
if (!ranges) {
const error = Boom.rangeNotSatisfiable();
error.output.headers['content-range'] = 'bytes */' + length;
return callback(error);
}
const ranges = Ammo.header(request.headers.range, length);
if (!ranges) {
const error = Boom.rangeNotSatisfiable();
error.output.headers['content-range'] = 'bytes */' + length;
return callback(error);
}
// Prepare transform
// Prepare transform
if (ranges.length === 1) { // Ignore requests for multiple ranges
range = ranges[0];
response.code(206);
response.bytes(range.to - range.from + 1);
response.header('content-range', 'bytes ' + range.from + '-' + range.to + '/' + length);
if (ranges.length === 1) { // Ignore requests for multiple ranges
range = ranges[0];
response.code(206);
response.bytes(range.to - range.from + 1);
response.header('content-range', 'bytes ' + range.from + '-' + range.to + '/' + length);
}
}
}
}
response.header('accept-ranges', 'bytes');
}
response.header('accept-ranges', 'bytes');
return callback(null, range);

@@ -205,0 +207,0 @@ };

{
"name": "inert",
"description": "Static file and directory handlers plugin for hapi.js",
"version": "4.0.0",
"version": "4.0.1",
"repository": "git://github.com/hapijs/inert",

@@ -26,3 +26,3 @@ "main": "lib/index.js",

"devDependencies": {
"code": "2.x.x",
"code": "3.x.x",
"hapi": "13.x.x",

@@ -29,0 +29,0 @@ "lab": "10.x.x"

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc