mirror of
https://github.com/logos-storage/bittorrent-tracker.git
synced 2026-01-03 21:43:12 +00:00
Revert "server _onHttpRequest(): ensure non-empty params"
This reverts commit 74d91390494becb06af12e1b353f21a81eb1bbfb.
Conflicts:
server.js
feross commented on 74d9139 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…
x
Reference in New Issue
Block a user