TBDev Forum
Programming board
Main Page Forum Rules Privacy Policy Members Contact Us
Welcome Guest (Login | Register)
TBDev Forum TBDev.net - Help *nix based Installations Strange Status in client

Strange Status in client

2006-05-24 22:52:00
Group: Member
Posts: 62
Topics participated: 20
Topics started: 9
First post: 2006-04-05 14:14:00
Last post: 2006-10-27 08:24:00
Strange Status in torrent client

Tracker error Response: gzip decode error Content:....


How to fix it?!
10x in advance

Edit://
????????
 
2006-05-29 19:16:00
Group: Member
Posts: 191
Topics participated: 103
Topics started: 18
First post: 2006-03-01 09:04:00
Last post: 2007-08-23 22:47:00
i had that once...
when i made a typo in my announce.php

Did you recently changed something there? Try a backup announce file
 
2006-05-29 21:41:00
Group: Member
Posts: 62
Topics participated: 20
Topics started: 9
First post: 2006-04-05 14:14:00
Last post: 2006-10-27 08:24:00
This is my announce.php somebody can help me?
10x in advance :)


ob_start("ob_gzhandler");

require_once("include/bittorrent.php");
require_once("include/benc.php");

hit_start();

function err($msg)
{
benc_resp(array("failure reason" => array(type => "string", value => $msg)));
hit_end();
exit();
}

function benc_resp($d)
{
benc_resp_raw(benc(array(type => "dictionary", value => $d)));
}

function benc_resp_raw($x)
{
header("Content-Type: text/plain");
header("Pragma: no-cache");
print($x);
}

foreach (array("passkey","info_hash","peer_id","ip","event") as $x)

$GLOBALS[$x] = "" . $_GET[$x];





foreach (array("port","downloaded","uploaded","left") as $x)

$GLOBALS[$x] = 0 + $_GET[$x];



if (strpos($passkey, "?")) {

$tmp = substr($passkey, strpos($passkey, "?"));

$passkey = substr($passkey, 0, strpos($passkey, "?"));

$tmpname = substr($tmp, 1, strpos($tmp, "=")-1);

$tmpvalue = substr($tmp, strpos($tmp, "=")+1);

$GLOBALS[$tmpname] = $tmpvalue;

}



foreach (array("passkey","info_hash","peer_id","port","downloaded","uploaded","left") as $x)

if (!isset($x)) err("Missing key: $x");



foreach (array("info_hash","peer_id") as $x)

if (strlen($GLOBALS[$x]) != 20) err("Invalid $x (" . strlen($GLOBALS[$x]) . " - " . urlencode($GLOBALS[$x]) . ")");



if (strlen($passkey) != 32) err("Invalid passkey (" . strlen($passkey) . " - $passkey)");



//if (empty($ip) || !preg_match('/^(d{1,3}.){3}d{1,3}$/s', $ip))

$ip = getip();
/*
$req = "info_hash:peer_id:!ip:port:uploaded:downloaded:left:!event";
foreach (explode(":", $req) as $x)
{
if ($x[0] == "!")
{
$x = substr($x, 1);
$opt = 1;
}
else
$opt = 0;
if (!isset($_GET[$x]))
{
if (!$opt)
err("missing key");
continue;
}
$GLOBALS[$x] = unesc($_GET[$x]);
}

foreach (array("info_hash","peer_id") as $x)
{
if (strlen($GLOBALS[$x]) != 20)
err("invalid $x (" . strlen($GLOBALS[$x]) . " - " . urlencode($GLOBALS[$x]) . ")");
}

//if (empty($ip) || !preg_match('/^(\d{1,3}\.){3}\d{1,3}$/s', $ip))
$ip = getip();

$port = 0 + $port;
$downloaded = 0 + $downloaded;
$uploaded = 0 + $uploaded;
$left = 0 + $left;
*/
$rsize = 50;
foreach(array("num want", "numwant", "num_want") as $k)
{
if (isset($_GET[$k]))
{
$rsize = 0 + $_GET[$k];
break;
}
}

$agent = $_SERVER["HTTP_USER_AGENT"];

// Deny access made with a browser...
if (ereg("^Mozilla\\/", $agent) || ereg("^Opera\\/", $agent) || ereg("^Links ", $agent) || ereg("^Lynx\\/", $agent))
err("torrent not registered with this tracker");

if (!$port || $port > 0xffff)
err("invalid port");

if (!isset($event))
$event = "";

$seeder = ($left == 0) ? "yes" : "no";

dbconn(false);

hit_count();

$valid = @mysql_fetch_row(@mysql_query("SELECT COUNT(*) FROM users WHERE passkey=" . sqlesc($passkey)));

if ($valid[0] != 1) err("Invalid passkey! Re-download the .torrent from $BASEURL");


$res = mysql_query("SELECT id, banned, seeders + leechers AS numpeers, UNIX_TIMESTAMP(added) AS ts FROM torrents WHERE " . hash_where("info_hash", $info_hash));

$torrent = mysql_fetch_assoc($res);
if (!$torrent)
err("torrent not registered with this tracker");

$torrentid = $torrent["id"];

$fields = "seeder, peer_id, ip, port, uploaded, downloaded, userid, UNIX_TIMESTAMP(last_action) AS ts ";

#$fields = "seeder, peer_id, ip, port, uploaded, downloaded, userid, last_action";

$numpeers = $torrent["numpeers"];
$limit = "";
if ($numpeers > $rsize)
$limit = "ORDER BY RAND() LIMIT $rsize";
$res = mysql_query("SELECT $fields FROM peers WHERE torrent = $torrentid AND connectable = 'yes' $limit");

$resp = "d" . benc_str("interval") . "i" . $announce_interval . "e" . benc_str("peers") . "l";
unset($self);
while ($row = mysql_fetch_assoc($res))
{
$row["peer_id"] = hash_pad($row["peer_id"]);

if ($row["peer_id"] === $peer_id)
{
$userid = $row["userid"];
$self = $row;
continue;
}

$resp .= "d" .
benc_str("ip") . benc_str($row["ip"]) .
benc_str("peer id") . benc_str($row["peer_id"]) .
benc_str("port") . "i" . $row["port"] . "e" .
"e";
}

$resp .= "ee";

$selfwhere = "torrent = $torrentid AND " . hash_where("peer_id", $peer_id);

if (!isset($self))
{
$res = mysql_query("SELECT $fields FROM peers WHERE $selfwhere");
$row = mysql_fetch_assoc($res);
if ($row)
{
$userid = $row["userid"];
$self = $row;
}
}
// Force the peer to wait for the announce time.
//$announce_wait = 30;
//if( isset($self) && ($self['last_action'] > get_date_time( time() - $announce_wait )) )
//{
//error_msg('There is a minimum announce time of ' . $announce_wait . ' seconds');
//}

//// Up/down stats ////////////////////////////////////////////////////////////

/*if (!isset($self))
{
$rz = mysql_query("SELECT id, uploaded, downloaded, class FROM users WHERE ip='$ip' AND enabled = 'yes' ORDER BY last_access DESC LIMIT 1") or err("Tracker error 2");
if ($MEMBERSONLY && mysql_num_rows($rz) == 0)
err("Unrecognized host ($ip). Please go to $BASEURL to sign-up or login."); */
if (!isset($self))

{

$valid = @mysql_fetch_row(@mysql_query("SELECT COUNT(*) FROM peers WHERE torrent=$torrentid AND passkey=" . sqlesc($passkey)));

//if ($valid[0] >= 1 && $seeder == 'no') err("Connection limit exceeded! You may only leech from one location at a time.");

//if ($valid[0] >= 3 && $seeder == 'yes') err("Connection limit exceeded!");



$rz = mysql_query("SELECT id, uploaded, downloaded, class FROM users WHERE passkey=".sqlesc($passkey)." AND enabled = 'yes' ORDER BY last_access DESC LIMIT 1") or err("Tracker error 2");

if ($MEMBERSONLY && mysql_num_rows($rz) == 0)

err("Unknown passkey. Please redownload the torrent from $BASEURL.");
$az = mysql_fetch_assoc($rz);
$userid = $az["id"];

// if ($left > 0 && $az["class"] < UC_VIP)
if ($az["class"] < UC_VIP)
{
$gigs = $az["uploaded"] / (1024*1024*1024);
$elapsed = floor((gmtime() - $torrent["ts"]) / 3600);
$ratio = (($az["downloaded"] > 0) ? ($az["uploaded"] / $az["downloaded"]) : 1);
if ($ratio < 0.5 || $gigs < 5) $wait = 48;
elseif ($ratio < 0.65 || $gigs < 6.5) $wait = 24;
elseif ($ratio < 0.8 || $gigs < 8) $wait = 12;
elseif ($ratio < 0.95 || $gigs < 9.5) $wait = 6;
else $wait = 0;
//if ($elapsed < $wait)
// err("Not authorized (" . ($wait - $elapsed) . "h) - READ THE FAQ!");
}
}
else
{
$upthis = max(0, $uploaded - $self["uploaded"]);
$downthis = max(0, $downloaded - $self["downloaded"]);

if ($upthis > 0 || $downthis > 0)
mysql_query("UPDATE users SET uploaded = uploaded + $upthis, downloaded = downloaded + $downthis WHERE id=$userid") or err("Tracker error 3");
}

///////////////////////////////////////////////////////////////////////////////

function portblacklisted($port)
{
// direct connect
if ($port >= 411 && $port <= 413) return true;

// bittorrent
if ($port >= 6881 && $port <= 6889) return true;

// kazaa
if ($port == 1214) return true;

// gnutella
if ($port >= 6346 && $port <= 6347) return true;

// emule
if ($port == 4662) return true;

// winmx
if ($port == 6699) return true;

return false;
}

$updateset = array();

if ($event == "stopped")
{
if (isset($self))
{
mysql_query("DELETE FROM peers WHERE $selfwhere");
if (mysql_affected_rows())
{
if ($self["seeder"] == "yes")
$updateset[] = "seeders = seeders - 1";
else
$updateset[] = "leechers = leechers - 1";
}
}
}
else
{
////// Completed_by hack ///////

if ($event == "completed")

{

$updateset[] = "times_completed = times_completed + 1";

mysql_query("INSERT INTO snatched (torrentid,userid) VALUES ($torrentid,$userid)");

$res = mysql_query("SELECT completed_by FROM torrents WHERE id='$torrentid'");

$current = mysql_fetch_array($res);

$name = $current["completed_by"];

$space = " ";

$res = mysql_query("SELECT id FROM users WHERE ip='$ip'");

$current = mysql_fetch_array($res);

$name2 = $current["id"];

$sql = "UPDATE torrents SET completed_by='$name' '$space' '$name2' '$space' WHERE id='$torrentid'";

$result = mysql_query($sql);

}

///// end /////

/*
if (isset($self))
{
mysql_query("UPDATE peers SET uploaded = $uploaded, downloaded = $downloaded, to_go = $left, last_action = NOW(), seeder = '$seeder'"
. ($seeder == "yes" && $self["seeder"] != $seeder ? ", finishedat = " . time() : "")
. ", ip = " . sqlesc($ip) . " WHERE $selfwhere");
// Initial sanity check xMB/s for 1 second
if( $upthis > 2097152 ){
// Work out time difference
$rrr = @mysql_query( "SELECT UNIX_TIMESTAMP(last_action) AS ts FROM peers WHERE $selfwhere" );
$aaa = @mysql_fetch_assoc( $rrr );
$endtime = $aaa['ts'];
$diff = $endtime - $starttime;
// Normalise to prevent divide by zero.
$rate = $upthis / ( $diff + 1 );
// Currently 2MB/s. Increase to 5MB/s once finished testing.
if( $rate > 2097152 ){
$rrr = @mysql_query( "SELECT username,class FROM users WHERE id=$userid" );
$aaa = @mysql_fetch_assoc( $rrr );
$username = $aaa['username'];
$class = $aaa['class'];
if( $class <= UC_SYSOP ){
$rrr = @mysql_query( "SELECT name FROM torrents WHERE id=$torrentid" );
$aaa = @mysql_fetch_assoc( $rrr );
$torrentname = $aaa['name'];
$subject = sqlesc( "Upload - $username" );
$rate = mksize( $rate );
$client = $self['agent'];
$body = sqlesc(
" just uploaded at $rate/s. (".
mksize( $upthis )." in $diff seconds.)\n".
"On Torrent \n".
"Using $client from $ip\n\n".
"This members last actual recorded total uploaded was " . mksize( $last_up ) );
mysql_query("INSERT INTO messages (id, sender, receiver, msg, unread, poster, location) VALUES ('', '
 
2006-06-10 20:38:00
Group: Member
Posts: 62
Topics participated: 20
Topics started: 9
First post: 2006-04-05 14:14:00
Last post: 2006-10-27 08:24:00
Anybody???!?!
 
2006-06-16 09:54:00
Group: Member
Posts: 62
Topics participated: 20
Topics started: 9
First post: 2006-04-05 14:14:00
Last post: 2006-10-27 08:24:00
:( i will kill myself :)
 
2006-06-16 00:56:00
Group: Member
Posts: 1378
Topics participated: 601
Topics started: 11
First post: 2006-02-25 01:34:00
Last post: 2008-12-22 14:17:00
remove this line
ob_start("ob_gzhandler");
 
2006-06-16 16:24:00
Group: Member
Posts: 328
Topics participated: 151
Topics started: 9
First post: 2006-02-25 02:06:00
Last post: 2008-11-14 07:15:00
that'd be a quick fix, right laffin, to remove gzip all together?

--

were you actively editing your announce when it stopped working? if so try a back-up copy.

or was this something that started out of nowhere?

possibly there was an update or something with your server, which changed or turned off your gzip support.

check your httpd.conf file(s) to make sure that gzip wasn't removed from the conf.

just some random thoughts. i hope you get it sorted out.
 
2006-06-16 23:29:00
Group: Member
Posts: 62
Topics participated: 20
Topics started: 9
First post: 2006-04-05 14:14:00
Last post: 2006-10-27 08:24:00
10x i 10Q so much :)
 
2006-06-17 01:53:00
Group: Member
Posts: 1378
Topics participated: 601
Topics started: 11
First post: 2006-02-25 01:34:00
Last post: 2008-12-22 14:17:00
Well decoding shud be the browser/client end
encoding shud be done by the server.
so could be the gzip in yer users client is broken.
this shudn be the case for all users is it?
 
2006-06-18 21:18:00
Group: Member
Posts: 62
Topics participated: 20
Topics started: 9
First post: 2006-04-05 14:14:00
Last post: 2006-10-27 08:24:00
i can't understand you but WORK :)
 

Similar threads

Topic Posts Last post
Help with client 1 2008-12-08 15:50:00
bt client 5 2008-08-30 08:12:00
client 8 2008-08-18 18:16:00
What is this client?? 3 2006-09-09 00:06:00
Client 9 2006-07-22 14:59:00