Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hostname option to mitigate DNS rebinding #1260

Merged
merged 2 commits into from Mar 2, 2018
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Prev

simplify double if statement

  • Loading branch information
feross committed Mar 2, 2018
commit 7c107e6d47415d72ca7fd075fc8f78aaae548908
@@ -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
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.