Fix for trackers that include parameters in announce URL.

This commit is contained in:
Josh Elsasser 2006-10-13 07:42:55 +00:00
parent f97c34da93
commit 631df817ae
1 changed files with 12 additions and 2 deletions

View File

@ -236,6 +236,7 @@ static tr_http_t * getQuery( tr_tracker_t * tc )
uint64_t left; uint64_t left;
uint64_t down; uint64_t down;
uint64_t up; uint64_t up;
char * start;
down = tor->downloadedCur; down = tor->downloadedCur;
up = tor->uploadedCur; up = tor->uploadedCur;
@ -263,11 +264,20 @@ static tr_http_t * getQuery( tr_tracker_t * tc )
event = ""; event = "";
} }
if( NULL == strchr( inf->trackerAnnounce, '?' ) )
{
start = "?";
}
else
{
start = "&";
}
left = tr_cpLeftBytes( tor->completion ); left = tr_cpLeftBytes( tor->completion );
return tr_httpClient( TR_HTTP_GET, inf->trackerAddress, return tr_httpClient( TR_HTTP_GET, inf->trackerAddress,
inf->trackerPort, inf->trackerPort,
"%s?" "%s%s"
"info_hash=%s&" "info_hash=%s&"
"peer_id=%s&" "peer_id=%s&"
"port=%d&" "port=%d&"
@ -278,7 +288,7 @@ static tr_http_t * getQuery( tr_tracker_t * tc )
"numwant=50&" "numwant=50&"
"key=%s" "key=%s"
"%s", "%s",
inf->trackerAnnounce, tor->hashString, tc->id, inf->trackerAnnounce, start, tor->hashString, tc->id,
tc->bindPort, up, down, left, tor->key, event ); tc->bindPort, up, down, left, tor->key, event );
} }