aboutsummaryrefslogtreecommitdiff
path: root/lib/serve.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/serve.js')
-rw-r--r--lib/serve.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/serve.js b/lib/serve.js
index d550e0f..d0a9624 100644
--- a/lib/serve.js
+++ b/lib/serve.js
@@ -92,6 +92,14 @@ Serve.prototype.go = function () {
return
}
}
+ var allowAddresses = conf.allowAddresses
+ if (allowAddresses) {
+ var ip = this.req.socket.remoteAddress
+ if (allowAddresses.indexOf(ip) === -1) {
+ this.res.writeHead(401)
+ return this.res.end('Not authorized')
+ }
+ }
if (this.req.method === 'POST' || this.req.method === 'PUT') {
if (/^multipart\/form-data/.test(this.req.headers['content-type'])) {