Comparing version 0.4.2 to 0.4.3
@@ -8,2 +8,3 @@ // This is so you can have options aliasing and defaults in one place. | ||
cache = 'max-age=3600', | ||
gzip = false, | ||
defaultExt; | ||
@@ -42,9 +43,14 @@ | ||
if (opts.cache !== undefined) { | ||
if (typeof opts.cache === 'string') { | ||
cache = opts.cache | ||
} else if(typeof opts.cache === 'number') { | ||
cache = 'max-age=' + opts.cache; | ||
} | ||
} | ||
if (opts.cache !== undefined) { | ||
if (typeof opts.cache === 'string') { | ||
cache = opts.cache | ||
} | ||
else if(typeof opts.cache === 'number') { | ||
cache = 'max-age=' + opts.cache; | ||
} | ||
} | ||
if (typeof opts.gzip !== undefined && opts.gzip !== null) { | ||
gzip = opts.gzip; | ||
} | ||
} | ||
@@ -57,4 +63,5 @@ | ||
defaultExt: defaultExt, | ||
baseDir: (opts && opts.baseDir) || '/' | ||
baseDir: (opts && opts.baseDir) || '/', | ||
gzip: gzip | ||
} | ||
} |
@@ -113,3 +113,3 @@ var ecstatic = require('../ecstatic'), | ||
dirs.sort(function (a, b) { return b[0] - a[0] }).forEach(writeRow); | ||
files.sort(function (a, b) { return b[0] - a[0] }).forEach(writeRow); | ||
files.sort(function (a, b) { return b.toString().localeCompare(a.toString()) }).forEach(writeRow); | ||
@@ -121,3 +121,3 @@ html += '</table>\n'; | ||
+ ' server running @ ' | ||
+ ent.encode(req.headers.host) + '</address>\n' | ||
+ ent.encode(req.headers.host || '') + '</address>\n' | ||
+ '</body></html>' | ||
@@ -124,0 +124,0 @@ ; |
@@ -5,3 +5,3 @@ { | ||
"description": "A simple static file server middleware that works with both Express and Flatiron", | ||
"version": "0.4.2", | ||
"version": "0.4.3", | ||
"homepage": "https://github.com/jesusabdullah/node-ecstatic", | ||
@@ -8,0 +8,0 @@ "repository": { |
@@ -102,3 +102,3 @@ # Ecstatic [![build status](https://secure.travis-ci.org/jesusabdullah/node-ecstatic.png)](http://travis-ci.org/jesusabdullah/node-ecstatic) | ||
Serve `/path/index.html` when `/path/` is requested. | ||
Turn **off** autoIndexing with `opts.autoIndex === true`. Defaults to **true**. | ||
Turn **off** autoIndexing with `opts.autoIndex === false`. Defaults to **true**. | ||
@@ -105,0 +105,0 @@ ### `opts.defaultExt` |
224763
846