diff --git a/bin/http-server b/bin/http-server index 9a3ea5bc..926e0dd7 100755 --- a/bin/http-server +++ b/bin/http-server @@ -39,6 +39,7 @@ if (argv.h || argv.help) { ' -K --key Path to ssl key file (default: key.pem).', '', ' -r --robots Respond to /robots.txt [User-agent: *\\nDisallow: /]', + ' --no-dotfiles Do not show dotfiles', ' -h --help Print this list and exit.' ].join('\n')); process.exit(); @@ -101,7 +102,8 @@ function listen(port) { robots: argv.r || argv.robots, ext: argv.e || argv.ext, logFn: logger.request, - proxy: proxy + proxy: proxy, + showDotfiles: argv.dotfiles }; if (argv.cors) { diff --git a/lib/http-server.js b/lib/http-server.js index 51aa4bf4..7e3e06df 100644 --- a/lib/http-server.js +++ b/lib/http-server.js @@ -46,6 +46,7 @@ function HttpServer(options) { this.cache = options.cache === undefined ? 3600 : options.cache; // in seconds. this.showDir = options.showDir !== 'false'; this.autoIndex = options.autoIndex !== 'false'; + this.showDotfiles = options.showDotfiles; this.gzip = options.gzip === true; this.contentType = options.contentType || 'application/octet-stream'; @@ -96,6 +97,7 @@ function HttpServer(options) { root: this.root, cache: this.cache, showDir: this.showDir, + showDotfiles: this.showDotfiles, autoIndex: this.autoIndex, defaultExt: this.ext, gzip: this.gzip,