Comparing version 0.5.8 to 0.6.0
@@ -27,3 +27,4 @@ #! /usr/bin/env node | ||
defaultExt = opts.defaultExt, | ||
handleError = opts.handleError; | ||
handleError = opts.handleError, | ||
serverHeader = opts.serverHeader; | ||
@@ -59,4 +60,6 @@ opts.root = dir; | ||
// Set common headers. | ||
res.setHeader('server', 'ecstatic-'+version); | ||
if(serverHeader !== false) { | ||
// Set common headers. | ||
res.setHeader('server', 'ecstatic-'+version); | ||
} | ||
@@ -233,7 +236,2 @@ // TODO: This check is broken, which causes the 403 on the | ||
}); | ||
stream.on('end', function () { | ||
res.statusCode = 200; | ||
res.end(); | ||
}); | ||
} | ||
@@ -261,3 +259,3 @@ }; | ||
function decodePathname(pathname) { | ||
var pieces = pathname.split('/'); | ||
var pieces = pathname.replace(/\\/g,"/").split('/'); | ||
@@ -264,0 +262,0 @@ return pieces.map(function (piece) { |
@@ -12,3 +12,4 @@ // This is so you can have options aliasing and defaults in one place. | ||
defaultExt = '.html', | ||
handleError = true; | ||
handleError = true, | ||
serverHeader = true; | ||
@@ -83,2 +84,14 @@ if (opts) { | ||
}); | ||
[ | ||
'serverHeader', | ||
'serverheader', | ||
'server-header' | ||
].some(function (k) { | ||
if (typeof opts[k] !== 'undefined' && opts[k] !== null) { | ||
serverHeader = opts[k]; | ||
return true; | ||
} | ||
}); | ||
} | ||
@@ -95,4 +108,5 @@ | ||
gzip: gzip, | ||
handleError: handleError | ||
handleError: handleError, | ||
serverHeader: serverHeader | ||
}; | ||
}; |
@@ -109,2 +109,3 @@ var ecstatic = require('../ecstatic'), | ||
' <meta charset="utf-8">', | ||
' <meta name="viewport" content="width=device-width">', | ||
' <title>Index of ' + pathname +'</title>', | ||
@@ -122,5 +123,5 @@ ' </head>', | ||
var isDir = file[1].isDirectory && file[1].isDirectory(); | ||
var href = | ||
var href = encodeURI( | ||
parsed.pathname.replace(/\/$/, '') + | ||
'/' + encodeURIComponent(file[0]); | ||
'/' + file[0]); | ||
@@ -127,0 +128,0 @@ // append trailing slash and query for dir entry |
@@ -5,7 +5,7 @@ { | ||
"description": "A simple static file server middleware that works with both Express and Flatiron", | ||
"version": "0.5.8", | ||
"homepage": "https://github.com/jesusabdullah/node-ecstatic", | ||
"version": "0.6.0", | ||
"homepage": "https://github.com/jfhbrook/node-ecstatic", | ||
"repository": { | ||
"type": "git", | ||
"url": "git@github.com:jesusabdullah/node-ecstatic.git" | ||
"url": "git@github.com:jfhbrook/node-ecstatic.git" | ||
}, | ||
@@ -12,0 +12,0 @@ "main": "./lib/ecstatic.js", |
@@ -74,3 +74,4 @@ # Ecstatic [![build status](https://secure.travis-ci.org/jesusabdullah/node-ecstatic.png)](http://travis-ci.org/jesusabdullah/node-ecstatic) | ||
defaultExt : 'html', | ||
gzip : false | ||
gzip : false, | ||
serverHeader : true | ||
} | ||
@@ -132,2 +133,7 @@ ``` | ||
### `opts.serverHeader` | ||
Set `opts.serverHeader` to false in order to turn off setting the `Server` header | ||
on all responses served by ecstatic. | ||
### `opts.handleError` | ||
@@ -134,0 +140,0 @@ |
Sorry, the diff of this file is not supported yet
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
174
2
4
224923
19
621