Those stupid "announce ?info_hash" torrents get really annoying. Fix it in announce and scrape.
This commit is contained in:
parent
e0f88d7545
commit
33530a2ac6
|
@ -372,6 +372,11 @@ LOG_TO_STDERR( "stats: %d.%d.%d.%d - mode: s24s old\n", h->ip[0], h->ip[1], h->i
|
|||
case 6: /* scrape ? */
|
||||
if( byte_diff( data, 6, "scrape") ) HTTPERROR_404;
|
||||
|
||||
/* This is to hack around stupid clients that just replace
|
||||
"announce ?info_hash" with "scrape ?info_hash".
|
||||
We do not want to bomb them with full scrapes */
|
||||
if( !byte_diff( c, 2, " ?" ) ) ++c;
|
||||
|
||||
SCRAPE_WORKAROUND:
|
||||
|
||||
scanon = 1;
|
||||
|
@ -414,6 +419,9 @@ write( 2, "\n", 1 );
|
|||
case 8:
|
||||
if( byte_diff( data, 8, "announce" ) ) HTTPERROR_404;
|
||||
|
||||
/* This is to hack around stupid clients that send "announce ?info_hash" */
|
||||
if( !byte_diff( c, 2, " ?" ) ) ++c;
|
||||
|
||||
ANNOUNCE_WORKAROUND:
|
||||
|
||||
OT_SETIP( &peer, ((struct http_data*)io_getcookie( s ) )->ip );
|
||||
|
|
Loading…
Reference in New Issue