diff options
author | Feross Aboukhadijeh <feross@feross.org> | 2018-03-03 01:29:02 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-03 01:29:02 +0300 |
commit | 7c107e6d47415d72ca7fd075fc8f78aaae548908 (patch) | |
tree | 86f16fcd5302179006c61c414fbe2a55da162f69 /lib/server.js | |
parent | eea73a38ed8552c6a99cdd0dea5c9619dc955a21 (diff) |
simplify double if statement
Diffstat (limited to 'lib/server.js')
-rw-r--r-- | lib/server.js | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/server.js b/lib/server.js index d0f5716..5b24181 100644 --- a/lib/server.js +++ b/lib/server.js @@ -54,10 +54,8 @@ function Server (torrent, opts) { // If a 'hostname' string is specified, deny requests with a 'Host' // header that does not match the origin of the torrent server to prevent // DNS rebinding attacks. - if (opts.hostname) { - if (req.headers.host !== `${opts.hostname}:${server.address().port}`) { - return false - } + if (opts.hostname && req.headers.host !== `${opts.hostname}:${server.address().port}`) { + return false } // The user allowed all origins |