File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -5,10 +5,12 @@ export default parseHttpRequest
55function parseHttpRequest ( req , opts ) {
66 if ( ! opts ) opts = { }
77 const s = req . url . split ( '?' )
8+ const p = s [ 0 ] . split ( '/' )
9+ p . shift ( ) ;
810 const params = common . querystringParse ( s [ 1 ] )
911 params . type = 'http'
1012
11- if ( opts . action === 'announce' || s [ 0 ] === '/ announce' ) {
13+ if ( opts . action === 'announce' || p [ 0 ] === 'announce' ) {
1214 params . action = common . ACTIONS . ANNOUNCE
1315
1416 if ( typeof params . info_hash !== 'string' || params . info_hash . length !== 20 ) {
@@ -39,7 +41,7 @@ function parseHttpRequest (req, opts) {
3941 params . addr = `${ common . IPV6_RE . test ( params . ip ) ? `[${ params . ip } ]` : params . ip } :${ params . port } `
4042
4143 params . headers = req . headers
42- } else if ( opts . action === 'scrape' || s [ 0 ] === '/ scrape' ) {
44+ } else if ( opts . action === 'scrape' || p [ 0 ] === 'scrape' ) {
4345 params . action = common . ACTIONS . SCRAPE
4446
4547 if ( typeof params . info_hash === 'string' ) params . info_hash = [ params . info_hash ]
You can’t perform that action at this time.
0 commit comments