Revert "server _onHttpRequest(): ensure non-empty params"

This reverts commit 74d9139049.

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:
Astro 2014-12-12 02:55:40 +01:00
parent 66b71db8f5
commit 991363a28c

View File

@ -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
}