mirror of
https://github.com/webtorrent/bittorrent-tracker.git
synced 2024-12-13 10:56:25 +00:00
Revert "server _onHttpRequest(): ensure non-empty params"
This reverts commit74d9139049
. Conflicts: server.js feross commented on74d9139
5 hours ago > Do we need to check for empty params here? > > _onRequest should return an error via callback because > params.action is missing. Won't that work?74d9139049 (commitcomment-8937428)
This commit is contained in:
parent
66b71db8f5
commit
991363a28c
15
server.js
15
server.js
@ -127,27 +127,22 @@ Server.prototype.getSwarm = function (binaryInfoHash) {
|
||||
|
||||
Server.prototype._onHttpRequest = function (req, res) {
|
||||
var self = this
|
||||
var error
|
||||
|
||||
var params
|
||||
try {
|
||||
params = parseHttpRequest(req, {
|
||||
trustProxy: self._trustProxy
|
||||
})
|
||||
} catch (err) {
|
||||
error = err
|
||||
}
|
||||
|
||||
if (!error && !params) error = new Error('Empty HTTP parameters')
|
||||
if (error) {
|
||||
debug('sent error %s', error.message)
|
||||
debug('sent error %s', err.message)
|
||||
res.end(bencode.encode({
|
||||
'failure reason': error.message
|
||||
'failure reason': err.message
|
||||
}))
|
||||
|
||||
// even though it's an error for the client, it's just a warning for the server.
|
||||
// don't crash the server because a client sent bad data :)
|
||||
self.emit('warning', error)
|
||||
|
||||
self.emit('warning', err)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user