diff options
| author | erdgeist <> | 2007-10-19 20:02:41 +0000 |
|---|---|---|
| committer | erdgeist <> | 2007-10-19 20:02:41 +0000 |
| commit | 271ff156ecfd7a7638d694a71d3eb9e4b87b2dcb (patch) | |
| tree | ac1dab842e0bc14f3dfed33b2ac47b8026873f21 | |
| parent | 1b0859411e0b8cd217c2ede83c400c16cd58bd3d (diff) | |
Those stupid "announce ?info_hash" torrents get really annoying. Fix it in announce and scrape.
| -rw-r--r-- | opentracker.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/opentracker.c b/opentracker.c index 191d5d6..1725cd2 100644 --- a/opentracker.c +++ b/opentracker.c | |||
| @@ -372,6 +372,11 @@ LOG_TO_STDERR( "stats: %d.%d.%d.%d - mode: s24s old\n", h->ip[0], h->ip[1], h->i | |||
| 372 | case 6: /* scrape ? */ | 372 | case 6: /* scrape ? */ |
| 373 | if( byte_diff( data, 6, "scrape") ) HTTPERROR_404; | 373 | if( byte_diff( data, 6, "scrape") ) HTTPERROR_404; |
| 374 | 374 | ||
| 375 | /* This is to hack around stupid clients that just replace | ||
| 376 | "announce ?info_hash" with "scrape ?info_hash". | ||
| 377 | We do not want to bomb them with full scrapes */ | ||
| 378 | if( !byte_diff( c, 2, " ?" ) ) ++c; | ||
| 379 | |||
| 375 | SCRAPE_WORKAROUND: | 380 | SCRAPE_WORKAROUND: |
| 376 | 381 | ||
| 377 | scanon = 1; | 382 | scanon = 1; |
| @@ -414,6 +419,9 @@ write( 2, "\n", 1 ); | |||
| 414 | case 8: | 419 | case 8: |
| 415 | if( byte_diff( data, 8, "announce" ) ) HTTPERROR_404; | 420 | if( byte_diff( data, 8, "announce" ) ) HTTPERROR_404; |
| 416 | 421 | ||
| 422 | /* This is to hack around stupid clients that send "announce ?info_hash" */ | ||
| 423 | if( !byte_diff( c, 2, " ?" ) ) ++c; | ||
| 424 | |||
| 417 | ANNOUNCE_WORKAROUND: | 425 | ANNOUNCE_WORKAROUND: |
| 418 | 426 | ||
| 419 | OT_SETIP( &peer, ((struct http_data*)io_getcookie( s ) )->ip ); | 427 | OT_SETIP( &peer, ((struct http_data*)io_getcookie( s ) )->ip ); |
