]> git.ipfire.org Git - thirdparty/opentracker.git/commitdiff
Work around the stupid utorrent 1600 bug. That'll be removed after a while.
authorerdgeist <>
Sun, 21 Oct 2007 05:15:35 +0000 (05:15 +0000)
committererdgeist <>
Sun, 21 Oct 2007 05:15:35 +0000 (05:15 +0000)
opentracker.c

index 837882478dd84a09afadebfee57be208d77def61..2339f660ea11f355c07da12840778efa9e5e1f4b 100644 (file)
@@ -397,7 +397,7 @@ write( 2, debug_request, l );
 
 SCRAPE_WORKAROUND:
 
-    /* This is to hack around stupid clients that send "announce ?info_hash" */
+    /* This is to hack around stupid clients that send "scrape ?info_hash" */
     if( c[-1] != '?' ) {
       while( ( *c != '?' ) && ( *c != '\n' ) ) ++c;
       if( *c == '\n' ) HTTPERROR_400_PARAM;
@@ -408,7 +408,10 @@ SCRAPE_WORKAROUND:
     while( scanon ) {
       switch( scan_urlencoded_query( &c, data = c, SCAN_SEARCHPATH_PARAM ) ) {
       case -2: scanon = 0; break;   /* TERMINATOR */
-      case -1: HTTPERROR_400_PARAM; /* PARSE ERROR */
+      case -1:
+        if( scrape_count )
+          goto UTORRENT1600_WORKAROUND;
+        HTTPERROR_400_PARAM; /* PARSE ERROR */
       default: scan_urlencoded_skipvalue( &c ); break;
       case 9:
         if(byte_diff(data,9,"info_hash")) {
@@ -426,6 +429,8 @@ SCRAPE_WORKAROUND:
     /* No info_hash found? Inform user */
     if( !scrape_count ) HTTPERROR_400_PARAM;
 
+UTORRENT1600_WORKAROUND:
+
     /* Enough for http header + whole scrape string */
     if( !( reply_size = return_tcp_scrape_for_torrent( multiscrape_buf, scrape_count, SUCCESS_HTTP_HEADER_LENGTH + static_outbuf ) ) ) HTTPERROR_500;