From 8098adb48eb9d3409e6b569d30dfb4391e3224c2 Mon Sep 17 00:00:00 2001 From: erdgeist <> Date: Fri, 19 Oct 2007 23:15:13 +0000 Subject: [PATCH] Be even more stupidistas-tolerant --- opentracker.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/opentracker.c b/opentracker.c index e375f72..7e06044 100644 --- a/opentracker.c +++ b/opentracker.c @@ -429,14 +429,17 @@ SCRAPE_WORKAROUND: /****************************** * A N N O U N C E * ******************************/ + case 7: + if( byte_diff( data, 7, "announc" ) ) HTTPERROR_404; + goto ANNOUNCE_WORKAROUND; 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+=2; - ANNOUNCE_WORKAROUND: + /* This is to hack around stupid clients that send "announce ?info_hash" */ + if( !byte_diff( c+1, 5, "?info" ) ) c+=2; + OT_SETIP( &peer, ((struct http_data*)io_getcookie( s ) )->ip ); OT_SETPORT( &peer, &port ); OT_FLAG( &peer ) = 0;