summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorerdgeist <>2007-10-21 05:15:35 +0000
committererdgeist <>2007-10-21 05:15:35 +0000
commit00972c6c68c44aecafd49add235346a761074a90 (patch)
tree9fdf687272d9e24f05e188eb5bfd333a4909057e
parent0de8b53fdde212b291cdd406c59a80d1814f8184 (diff)
Work around the stupid utorrent 1600 bug. That'll be removed after a while.
-rw-r--r--opentracker.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/opentracker.c b/opentracker.c
index 8378824..2339f66 100644
--- a/opentracker.c
+++ b/opentracker.c
@@ -397,7 +397,7 @@ write( 2, debug_request, l );
397 397
398SCRAPE_WORKAROUND: 398SCRAPE_WORKAROUND:
399 399
400 /* This is to hack around stupid clients that send "announce ?info_hash" */ 400 /* This is to hack around stupid clients that send "scrape ?info_hash" */
401 if( c[-1] != '?' ) { 401 if( c[-1] != '?' ) {
402 while( ( *c != '?' ) && ( *c != '\n' ) ) ++c; 402 while( ( *c != '?' ) && ( *c != '\n' ) ) ++c;
403 if( *c == '\n' ) HTTPERROR_400_PARAM; 403 if( *c == '\n' ) HTTPERROR_400_PARAM;
@@ -408,7 +408,10 @@ SCRAPE_WORKAROUND:
408 while( scanon ) { 408 while( scanon ) {
409 switch( scan_urlencoded_query( &c, data = c, SCAN_SEARCHPATH_PARAM ) ) { 409 switch( scan_urlencoded_query( &c, data = c, SCAN_SEARCHPATH_PARAM ) ) {
410 case -2: scanon = 0; break; /* TERMINATOR */ 410 case -2: scanon = 0; break; /* TERMINATOR */
411 case -1: HTTPERROR_400_PARAM; /* PARSE ERROR */ 411 case -1:
412 if( scrape_count )
413 goto UTORRENT1600_WORKAROUND;
414 HTTPERROR_400_PARAM; /* PARSE ERROR */
412 default: scan_urlencoded_skipvalue( &c ); break; 415 default: scan_urlencoded_skipvalue( &c ); break;
413 case 9: 416 case 9:
414 if(byte_diff(data,9,"info_hash")) { 417 if(byte_diff(data,9,"info_hash")) {
@@ -426,6 +429,8 @@ SCRAPE_WORKAROUND:
426 /* No info_hash found? Inform user */ 429 /* No info_hash found? Inform user */
427 if( !scrape_count ) HTTPERROR_400_PARAM; 430 if( !scrape_count ) HTTPERROR_400_PARAM;
428 431
432UTORRENT1600_WORKAROUND:
433
429 /* Enough for http header + whole scrape string */ 434 /* Enough for http header + whole scrape string */
430 if( !( reply_size = return_tcp_scrape_for_torrent( multiscrape_buf, scrape_count, SUCCESS_HTTP_HEADER_LENGTH + static_outbuf ) ) ) HTTPERROR_500; 435 if( !( reply_size = return_tcp_scrape_for_torrent( multiscrape_buf, scrape_count, SUCCESS_HTTP_HEADER_LENGTH + static_outbuf ) ) ) HTTPERROR_500;
431 436