mirror of
https://github.com/webtorrent/bittorrent-tracker.git
synced 2025-01-18 04:01:35 +00:00
fix: mangled scrape infohashes (#486)
This commit is contained in:
parent
b487809c85
commit
11cce83ddd
@ -4,7 +4,7 @@ import clone from 'clone'
|
||||
import Debug from 'debug'
|
||||
import get from 'simple-get'
|
||||
import Socks from 'socks'
|
||||
import { bin2hex, hex2bin, arr2text } from 'uint8-util'
|
||||
import { bin2hex, hex2bin, arr2text, text2arr, arr2hex } from 'uint8-util'
|
||||
|
||||
import common from '../common.js'
|
||||
import Tracker from './tracker.js'
|
||||
@ -244,12 +244,14 @@ class HTTPTracker extends Tracker {
|
||||
return
|
||||
}
|
||||
|
||||
keys.forEach(infoHash => {
|
||||
keys.forEach(_infoHash => {
|
||||
// TODO: optionally handle data.flags.min_request_interval
|
||||
// (separate from announce interval)
|
||||
const response = Object.assign(data[infoHash], {
|
||||
const infoHash = _infoHash.length !== 20 ? arr2hex(text2arr(_infoHash)) : bin2hex(_infoHash)
|
||||
|
||||
const response = Object.assign(data[_infoHash], {
|
||||
announce: this.announceUrl,
|
||||
infoHash: bin2hex(infoHash)
|
||||
infoHash
|
||||
})
|
||||
this.client.emit('scrape', response)
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user