error on missing info hash

This commit is contained in:
Feross Aboukhadijeh 2014-07-05 14:41:46 -07:00
parent f21ab25347
commit ac00794fb4

View File

@ -116,10 +116,10 @@ Server.prototype._onHttpRequest = function (req, res) {
// TODO: detect when required params are missing
// TODO: support multiple info_hash parameters as a concatenation of individual requests
var infoHash = bytewiseDecodeURIComponent(params.info_hash).toString('hex')
var infoHash = params.info_hash && bytewiseDecodeURIComponent(params.info_hash).toString('hex')
if (!infoHash) {
return error('bittorrent-tracker server only supports announcing one torrent at a time')
return error('missing info hash')
}
if (s[0] === '/announce' || s[0] === '/') {