Comparing version 0.7.1 to 0.7.2
@@ -0,1 +1,4 @@ | ||
2015/04/05 Version 0.7.2 | ||
- Correctly handle req.statusCode in recursive calls; do not inherit upstream res.statusCode | ||
2015/03/27 Version 0.7.1 | ||
@@ -2,0 +5,0 @@ - Treat ENOTDIR as 404 (same as ENOENT) |
@@ -79,10 +79,9 @@ #! /usr/bin/env node | ||
if (req.statusCode == 404) { | ||
// This means we're already trying ./404.html | ||
// This means we're already trying ./404.html and can not find it. | ||
// So send plain text response with 404 status code | ||
status[404](res, next); | ||
} | ||
else if (defaultExt && !path.extname(parsed.pathname).length) { | ||
// | ||
// If no file extension is specified and there is a default extension | ||
// try that before rendering 404.html. | ||
// | ||
else if (!path.extname(parsed.pathname).length && defaultExt) { | ||
// If there is no file extension in the path and we have a default | ||
// extension try filename and default extension combination before rendering 404.html. | ||
middleware({ | ||
@@ -93,10 +92,3 @@ url: parsed.pathname + '.' + defaultExt + ((parsed.search)? parsed.search:'') | ||
else { | ||
// Try for ./404.html | ||
// | ||
// In order to make tests pass, we have to punch the status code | ||
// in both spots. It's stupid and mysterious, but at least we get | ||
// the behavior we want. | ||
// | ||
// TODO: Figure out what the Hell is going on and clean this up. | ||
res.statusCode = 404; | ||
// Try to serve default ./404.html | ||
middleware({ | ||
@@ -204,3 +196,3 @@ url: (handleError ? ('/' + path.join(baseDir, '404.' + defaultExt)) : req.url), | ||
'Content-Length': chunksize, | ||
'Content-Type': contentType | ||
'Content-Type': contentType | ||
}); | ||
@@ -229,4 +221,8 @@ fstream.pipe(res); | ||
// set the response statusCode if we have a request statusCode. | ||
// This only can happen if we have a 404 with some kind of 404.html | ||
// In all other cases where we have a file we serve the 200 | ||
res.statusCode = req.statusCode || 200; | ||
if (req.method === "HEAD") { | ||
res.statusCode = req.statusCode || 200; // overridden for 404's | ||
return res.end(); | ||
@@ -233,0 +229,0 @@ } |
@@ -5,3 +5,3 @@ { | ||
"description": "A simple static file server middleware that works with both Express and Flatiron", | ||
"version": "0.7.1", | ||
"version": "0.7.2", | ||
"homepage": "https://github.com/jfhbrook/node-ecstatic", | ||
@@ -8,0 +8,0 @@ "repository": { |
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
226048
632