Ticket #26 (closed: fixed)

Opened 7 years ago

Last modified 20 months ago

send client version to tracker

Reported by: jwestfall@surrealistic.net Owned by: rakshasa
Priority: lowest Component: libtorrent
Version: HEAD Severity: normal
Keywords: Cc:

Description

would be nice to send the client version to the tracker like other bt clients.

looks like its done by sending the User-Agent http header with the version info.

Change History

Changed 7 years ago by rakshasa

  • milestone set to 0.8 Sodden Squirrel

Actually it is done by sending an "User-agent" string in addition to "User-Agent". I always thought this was an ugly hack, and so i used the latter which works on the official tracker.

I'll change it to the former so it works for everyone.

Changed 7 years ago by solanum0@gmail.com

I don't think thats true:

BitTornado?'s HTTP-Header:

GET /announce.php?info_hash=xxx&peer_id=xxx&(....) HTTP/1.1\r\n
Host: xxx.xxxxxxxxxx.xxx:xx\r\n
Accept-Encoding: gzip\r\n
User-Agent: BitTornado/T-0.3.12\r\n
\r\n

rtorrent/libtorrent's HTTTP-Header:

GET /announce.php?info_hash=xxx(...) HTTP/1.1\r\n
User-Agent: libtorrent/0.7.5\r\n
Host: xxx.xxxxxxxxxxx.xxx:xx\r\n
Pragma: no-cache\r\n
Accept: */*\r\n
\r\n

BitTornado gets recognized correctly so i think the trackers just don't list the client if they don't know it.

I also tried the use of "User-agent" instead of "User-Agent" but that didn't work either.

This is what i just did to rtorrent/src/core/curl_get.cc Line 74 for testing:

  m_handle = curl_easy_init();

  struct curl_slist *a=NULL;
  a = curl_slist_append(a, "User-agent: " PACKAGE_NAME "/" PACKAGE_VERSION);
  a = curl_slist_append(a, "User-Agent: " PACKAGE_NAME "/" PACKAGE_VERSION);

  curl_easy_setopt(m_handle, CURLOPT_URL,           m_url.c_str());
  curl_easy_setopt(m_handle, CURLOPT_HTTPHEADER,    a);
//  curl_easy_setopt(m_handle, CURLOPT_USERAGENT,     m_userAgent.c_str());
  curl_easy_setopt(m_handle, CURLOPT_WRITEFUNCTION, &curl_get_receive_write);
  curl_easy_setopt(m_handle, CURLOPT_WRITEDATA,     this);

  curl_easy_setopt(m_handle, CURLOPT_FORBID_REUSE,   1);
  curl_easy_setopt(m_handle, CURLOPT_FOLLOWLOCATION, 1);
  curl_easy_setopt(m_handle, CURLOPT_MAXREDIRS,      5);

Changed 7 years ago by solanum0@gmail.com

  • status changed from new to closed
  • resolution set to fixed

Okay.. rtorrent/libtorrent does send the User-Agent correctly. But if I have a look at the details.php of the tracker code I think this ticket is about I read:

function getagent($httpagent)
{
	if (preg_match("/^Azureus ([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+)/", $httpagent, $matches))
		return "Azureus/$matches[1]";
	elseif (preg_match("/BitTorrent\\/S-([0-9]+\\.[0-9]+(\\.[0-9]+)*)/", $httpagent, $matches))
		return "Shadow's/$matches[1]";
	elseif (preg_match("/BitTorrent\\/U-([0-9]+\\.[0-9]+\\.[0-9]+)/", $httpagent, $matches))
		return "UPnP/$matches[1]";
	elseif (preg_match("/^BitTorrent\\/T-(.+)$/", $httpagent, $matches))
		return "BitTornado/$matches[1]";
	elseif (preg_match("/^BitTorrent\\/([0-9]+\\.[0-9]+(\\.[0-9]+)*)/", $httpagent, $matches))
		return "BitTorrent/$matches[1]";
	elseif (preg_match("/^Python-urllib\\/.+?, BitTorrent\\/([0-9]+\\.[0-9]+(\\.[0-9]+)*)/", $httpagent, $matches))
		return "BitTorrent/$matches[1]";
	elseif (ereg("^BitTorrent\\/BitSpirit$", $httpagent))
		return "BitSpirit";
	elseif (preg_match("/^BitTorrent\\/brst(.+)/", $httpagent, $matches))
		return "Burst/$matches[1]";
	elseif (preg_match("/^RAZA (.+)$/", $httpagent, $matches))
		return "Shareaza/$matches[1]";
	else
		return "---";
}

So it's a problem on the tracker-side. I'll do a request on their sf site to add rtorrent/libtorrent.

Changed 5 years ago by Gasinas

Sorry about the first entry. My fingers don't always go where they should.

Changed 20 months ago by neubcumoubaro

I enjoyed reading your blog. Keep it that way. psprwdfhdhbvchot

Note: See TracTickets for help on using tickets.