[Pkg-javascript-commits] [node-static] 123/151: Merge remote-tracking branch 'upstream/master'

Tonnerre Lombard tonnerre-guest at moszumanska.debian.org
Tue Jan 7 23:18:03 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 de26676aaa6a57aa90bb935e35c0f3e040d7c6a2
Merge: 2bbf68a e294621
Author: TeeTeeHaa <teeteehaa at server.fake>
Date:   Tue May 28 21:59:05 2013 +0200

    Merge remote-tracking branch 'upstream/master'

 .gitignore                           |   3 +
 README.md                            |  54 ++++++++--
 bin/cli.js                           | 104 ++++++++++++++++++
 etc/404.html                         |  23 ++++
 etc/trainwreck.jpg                   | Bin 0 -> 543733 bytes
 examples/file-server.js              |  26 ++---
 lib/node-static.js                   | 148 ++++++++++++++++----------
 lib/node-static/mime.js              | 139 ------------------------
 lib/node-static/util.js              |   6 +-
 package.json                         |  48 ++++++---
 test/fixtures/hello.txt              |   1 +
 test/fixtures/index.html             |   8 ++
 test/integration/node-static-test.js | 200 +++++++++++++++++++++++++++++++++++
 13 files changed, 527 insertions(+), 233 deletions(-)

diff --cc lib/node-static.js
index e6ac1c4,2381590..358ceef
--- a/lib/node-static.js
+++ b/lib/node-static.js
@@@ -52,17 -56,10 +56,17 @@@ Server.prototype.serveDir = function (p
  
      fs.stat(htmlIndex, function (e, stat) {
          if (!e) {
 -            that.respond(null, 200, {}, [htmlIndex], stat, req, res, finish);
 +            var status = 200;
 +            var headers = {};
 +            var originalPathname = decodeURI(url.parse(req.url).pathname);
 +            if (originalPathname.length && originalPathname.charAt(originalPathname.length - 1) !== '/') {
 +                status = 301;
 +                headers['Location'] = originalPathname + '/';
 +            }
 +            that.respond(null, status, headers, [htmlIndex], stat, req, res, finish);
          } else {
-             if (pathname in exports.store) {
-                 streamFiles(exports.indexStore[pathname].files);
+             if (pathname in indexStore) {
+                 streamFiles(indexStore[pathname].files);
              } else {
                  // Stream a directory of files as a single file.
                  fs.readFile(path.join(pathname, 'index.json'), function (e, contents) {

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