[Pkg-javascript-commits] [node-static] 58/151: ContentType should be case-insensitive. Reference http://www.ietf.org/rfc/rfc2616.txt / 3.7 Media Types

Tonnerre Lombard tonnerre-guest at moszumanska.debian.org
Tue Jan 7 23:17:58 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 08863e18eee39afdee687564711dcc3defc724c0
Author: Pablo Cantero <pablo at pablocantero.com>
Date:   Mon Jun 18 22:25:01 2012 -0300

    ContentType should be case-insensitive. Reference http://www.ietf.org/rfc/rfc2616.txt / 3.7 Media Types
---
 lib/node-static.js | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/node-static.js b/lib/node-static.js
index 9399257..5c6ccf4 100644
--- a/lib/node-static.js
+++ b/lib/node-static.js
@@ -196,8 +196,9 @@ this.Server.prototype.respond = function (pathname, status, _headers, files, sta
     } else if (req.method === 'HEAD') {
         finish(200, headers);
     } else {
+        var fileExtension = path.extname(files[0]).slice(1).toLowerCase();
         headers['Content-Length'] = stat.size;
-        headers['Content-Type']   = mime.contentTypes[path.extname(files[0]).slice(1)] ||
+        headers['Content-Type']   = mime.contentTypes[fileExtension] ||
                                    'application/octet-stream';
 
         for (var k in _headers) { headers[k] = _headers[k] }

-- 
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