From b48967245d86ceef3bc5031fa6dd00953549031a Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Thu, 25 Oct 2007 16:52:12 +0000 Subject: [PATCH] trunk: Ensure only a single "?" is used for appending arguments to the announce and scrape URL (fixes #411) --- NEWS | 10 ++++++---- libtransmission/tracker.c | 12 +++++++++--- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/NEWS b/NEWS index 1745555e4..cc3b711f2 100644 --- a/NEWS +++ b/NEWS @@ -2,12 +2,14 @@ NEWS file for Transmission 0.91 (2007/xx/xx) - libtransmission (all platforms): - + Fix 0.90 socket connection leak. - + Fix 0.90 OpenBSD build error. + + Fix 0.90 socket connection leak + + Fix 0.90 OpenBSD build error + + Ensure only a single "?" is used for appending arguments to the announce and scrape URL - OS X: - + Add Dutch localization, Re-add Russian localization, fix Korean localization + + Fix a crash caused by custom sound files + + Add Dutch localization, re-add Russian localization, fix Korean localization - gtk: - + Fix 0.90 packaging errors. + + Fix 0.90 packaging errors 0.90 (2007/10/23) - Encryption support, with option to ignore unencrypted peers diff --git a/libtransmission/tracker.c b/libtransmission/tracker.c index 1c55d0e38..becc3badb 100644 --- a/libtransmission/tracker.c +++ b/libtransmission/tracker.c @@ -579,7 +579,10 @@ onScrapeNow( void * vt ) struct evhttp_request *req; struct evbuffer * buf = evbuffer_new( ); - evbuffer_add_printf( buf, "%s?info_hash=%s", address->scrape, t->escaped ); + evbuffer_add_printf( buf, "%s%sinfo_hash=%s", + address->scrape, + ( strchr(address->scrape, '?') == NULL ? "?" : "&" ), + t->escaped ); uri = tr_strdup( (char*) EVBUFFER_DATA( buf ) ); evbuffer_free( buf ); @@ -619,8 +622,10 @@ buildTrackerRequestURI( const tr_tracker * t, struct evbuffer * buf = evbuffer_new( ); char * ret; + char * ann = getCurrentAddress(t)->announce; + evbuffer_add_printf( buf, "%s" - "?info_hash=%s" + "%sinfo_hash=%s" "&peer_id=%s" "&port=%d" "&uploaded=%"PRIu64 @@ -634,7 +639,8 @@ buildTrackerRequestURI( const tr_tracker * t, "&requirecrypto=%d" "%s%s" "%s%s", - getCurrentAddress(t)->announce, + ann, + ( strchr(ann, '?') == NULL ? "?" : "&" ), t->escaped, t->peer_id, tr_sharedGetPublicPort( t->handle->shared ),