]> git.ipfire.org Git - thirdparty/opentracker.git/commitdiff
Those stupid "announce ?info_hash" torrents get really annoying. Fix it in announce...
authorerdgeist <>
Fri, 19 Oct 2007 20:02:41 +0000 (20:02 +0000)
committererdgeist <>
Fri, 19 Oct 2007 20:02:41 +0000 (20:02 +0000)
opentracker.c

index 191d5d6c097a25b61cb7ebbb03e361071a98d77c..1725cd2b90a4cd5aa5f6ab034670c1902fadae59 100644 (file)
@@ -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 );