@@ -192,7 +192,7 @@ Tracker.prototype.scrape = function (opts) {
192192 debug ( 'sent `scrape` to ' + self . _announceUrl )
193193
194194 opts = extend ( {
195- info_hash : bytewiseEncodeURIComponent ( self . client . _infoHash )
195+ info_hash : common . bytewiseEncodeURIComponent ( self . client . _infoHash )
196196 } , opts )
197197
198198 self . _requestImpl ( self . _scrapeUrl , opts )
@@ -214,8 +214,8 @@ Tracker.prototype.setInterval = function (intervalMs) {
214214Tracker . prototype . _request = function ( opts ) {
215215 var self = this
216216 opts = extend ( {
217- info_hash : bytewiseEncodeURIComponent ( self . client . _infoHash ) ,
218- peer_id : bytewiseEncodeURIComponent ( self . client . _peerId ) ,
217+ info_hash : common . bytewiseEncodeURIComponent ( self . client . _infoHash ) ,
218+ peer_id : common . bytewiseEncodeURIComponent ( self . client . _peerId ) ,
219219 port : self . client . _port ,
220220 compact : 1 ,
221221 numwant : self . client . _numWant ,
@@ -461,7 +461,7 @@ Tracker.prototype._handleResponse = function (requestUrl, data) {
461461 } else if ( requestUrl === self . _scrapeUrl ) {
462462 // NOTE: the unofficial spec says to use the 'files' key but i've seen 'host' in practice
463463 data = data . files || data . host || { }
464- data = data [ bytewiseEncodeURIComponent ( self . client . _infoHash ) ]
464+ data = data [ common . bytewiseEncodeURIComponent ( self . client . _infoHash ) ]
465465
466466 if ( ! data ) {
467467 self . client . emit ( 'error' , new Error ( 'invalid scrape response' ) )
@@ -499,7 +499,3 @@ function toUInt64 (n) {
499499 }
500500 return Buffer . concat ( [ common . toUInt32 ( 0 ) , common . toUInt32 ( n ) ] )
501501}
502-
503- function bytewiseEncodeURIComponent ( buf ) {
504- return encodeURIComponent ( buf . toString ( 'binary' ) )
505- }
0 commit comments