From 18c57e238153d6c2e7d2327e8f3e490c6a18ce2b Mon Sep 17 00:00:00 2001 From: Eric Martindale Date: Sun, 29 Mar 2015 14:40:43 -0400 Subject: [PATCH 1/2] Remove `server` header when serverInfo set to null. --- lib/node-static.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/node-static.js b/lib/node-static.js index 040f0aa..10696f4 100644 --- a/lib/node-static.js +++ b/lib/node-static.js @@ -104,7 +104,9 @@ Server.prototype.finish = function (status, headers, req, res, promise, callback message: http.STATUS_CODES[status] }; - headers['server'] = this.serverInfo; + if (this.options.serverInfo !== null) { + headers['server'] = this.serverInfo; + } if (!status || status >= 400) { if (callback) { @@ -393,6 +395,3 @@ Server.prototype.stream = function (pathname, files, buffer, startByte, res, cal exports.Server = Server; exports.version = version; exports.mime = mime; - - - From 5bbf3c5c828137f85740c3a64ce00156e041e30b Mon Sep 17 00:00:00 2001 From: Eric Martindale Date: Sun, 29 Mar 2015 15:47:28 -0400 Subject: [PATCH 2/2] Catch non-string values. --- lib/node-static.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node-static.js b/lib/node-static.js index 10696f4..6f2c2a3 100644 --- a/lib/node-static.js +++ b/lib/node-static.js @@ -31,7 +31,7 @@ var Server = function (root, options) { } } - if ('serverInfo' in this.options) { + if ('serverInfo' in this.options && this.options.serverInfo) { this.serverInfo = this.options.serverInfo.toString(); } else { this.serverInfo = 'node-static/' + version.join('.');