[Pkg-javascript-commits] [node-static] 69/151: HEAD requests should have the same headers as GET.
Tonnerre Lombard
tonnerre-guest at moszumanska.debian.org
Tue Jan 7 23:17:59 UTC 2014
This is an automated email from the git hooks/post-receive script.
tonnerre-guest pushed a commit to branch master
in repository node-static.
commit 94bbfde4d6dbb82fa995faf0cb07bb99ac7ec4e3
Author: pbouzakis <github at paulbouzakis.com>
Date: Fri Jun 29 13:51:05 2012 -0400
HEAD requests should have the same headers as GET.
---
lib/node-static.js | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/lib/node-static.js b/lib/node-static.js
index 12c3aef..215e6ad 100644
--- a/lib/node-static.js
+++ b/lib/node-static.js
@@ -192,8 +192,6 @@ this.Server.prototype.respond = function (pathname, status, _headers, files, sta
if (req.headers['if-none-match'] === headers['ETag'] ||
Date.parse(req.headers['if-modified-since']) >= mtime) {
finish(304, headers);
- } else if (req.method === 'HEAD') {
- finish(200, headers);
} else {
var fileExtension = path.extname(files[0]).slice(1).toLowerCase();
headers['Content-Length'] = stat.size;
@@ -204,6 +202,11 @@ this.Server.prototype.respond = function (pathname, status, _headers, files, sta
res.writeHead(status, headers);
+ if (req.method === 'HEAD') {
+ finish(200, headers);
+ return;
+ }
+
// If the file was cached and it's not older
// than what's on disk, serve the cached version.
if (this.cache && (key in exports.store) &&
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-static.git
More information about the Pkg-javascript-commits
mailing list