New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

node-static

Package Overview
Dependencies
Maintainers
3
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-static - npm Package Compare versions

Comparing version 0.7.9 to 0.7.10

1

bin/cli.js
#!/usr/bin/env node
var fs = require('fs'),
path = require('path'),
tty = require('tty'),

@@ -6,0 +5,0 @@ statik = require('./../lib/node-static');

20

lib/node-static.js

@@ -195,3 +195,3 @@ var fs = require('fs')

*/
Server.prototype.gzipOk = function(req, contentType) {
Server.prototype.gzipOk = function (req, contentType) {
var enable = this.options.gzip;

@@ -210,16 +210,13 @@ if(enable &&

*/
Server.prototype.respondGzip = function(pathname, status, contentType, _headers, files, stat, req, res, finish) {
Server.prototype.respondGzip = function (pathname, status, contentType, _headers, files, stat, req, res, finish) {
var that = this;
if(files.length == 1 && this.gzipOk(req, contentType)) {
if (files.length == 1 && this.gzipOk(req, contentType)) {
var gzFile = files[0] + ".gz";
fs.stat(gzFile, function(e, gzStat) {
if(!e && gzStat.isFile()) {
//console.log('Serving', gzFile, 'to gzip-capable client instead of', files[0], 'new size is', gzStat.size, 'uncompressed size', stat.size);
fs.stat(gzFile, function (e, gzStat) {
if (!e && gzStat.isFile()) {
var vary = _headers['Vary'];
_headers['Vary'] = (vary && vary != 'Accept-Encoding'?vary+', ':'')+'Accept-Encoding';
_headers['Vary'] = (vary && vary != 'Accept-Encoding' ? vary + ', ' : '') + 'Accept-Encoding';
_headers['Content-Encoding'] = 'gzip';
stat.size = gzStat.size;
files = [gzFile];
} else {
//console.log('gzip file not found or error finding it', gzFile, String(e), stat.isFile());
}

@@ -234,3 +231,3 @@ that.respondNoGzip(pathname, status, contentType, _headers, files, stat, req, res, finish);

Server.prototype.parseByteRange = function(req, stat) {
Server.prototype.parseByteRange = function (req, stat) {
var byteRange = {

@@ -334,3 +331,3 @@ from: 0,

'Expires',
'Last-Modified'].forEach(function(entityHeader) {
'Last-Modified'].forEach(function (entityHeader) {
delete headers[entityHeader];

@@ -340,3 +337,2 @@ });

} else {
res.writeHead(status, headers);

@@ -343,0 +339,0 @@

@@ -11,3 +11,3 @@ {

],
"author": "Alexis Sellier <self@cloudhead.net>",
"author": "Alexis Sellier <alexis@cloudhead.io>",
"contributors": [

@@ -32,3 +32,3 @@ "Pablo Cantero <pablo@pablocantero.com>",

"colors": ">=0.6.0",
"mime": ">=1.2.9"
"mime": "^1.2.9"
},

@@ -39,3 +39,3 @@ "devDependencies": {

},
"version": "0.7.9",
"version": "0.7.10",
"engines": {

@@ -42,0 +42,0 @@ "node": ">= 0.4.1"

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