From 128c6fd3cd3fa7f4f4973833bf58e774bc84e505 Mon Sep 17 00:00:00 2001 From: Martin von Gagern Date: Thu, 26 May 2016 17:59:02 +0200 Subject: [PATCH] Introduce -localhost resp. -l abbreviation This increases the chances of lazy people still using a security-relevant setting. --- README.md | 4 +++- bin/server.js | 7 +++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a2cc108..5e83173 100644 --- a/README.md +++ b/README.md @@ -188,6 +188,8 @@ Options: -H --host HOST Bind address HOST (default=*) +-l --localhost Same as "--host localhost" + -d --dir DIRECTORY Serve the contents of DIRECTORY (default=cwd) -u --url MOUNTURL Serve the contents at MOUNTURL mount path (default=/) @@ -281,6 +283,6 @@ traversal, then you are encouraged to please refactor so that you do not depend on having `..` in url paths, as this tends to expose data that you may be surprised to be exposing. -Consider using the `--host localhost` setting if you don't want other +Consider using the `--localhost` setting if you don't want other people on your local network to read the files served by the command line server. This may become the default in a future major version. diff --git a/bin/server.js b/bin/server.js index 2539b39..97d77ec 100755 --- a/bin/server.js +++ b/bin/server.js @@ -27,6 +27,11 @@ for (var i = 2; i < process.argv.length; i++) { } break + case '-l': + case '--localhost': + host = 'localhost' + break + case '-d': case '--dir': dir = process.argv[++i] @@ -108,6 +113,8 @@ function help () { ,'' ,'-H --host HOST Bind address HOST (default=*)' ,'' +,'-l --localhost Same as "--host localhost"' +,'' ,'-d --dir DIRECTORY Serve the contents of DIRECTORY (default=cwd)' ,'' ,'-u --url /url Serve at this mount url (default=/)'