first working dedi verison

This commit is contained in:
kremsy 2014-02-21 16:07:36 +01:00 committed by Steffen Schröder
parent 4c360c41de
commit 7cfac4fa19
2 changed files with 11 additions and 7 deletions

View File

@ -126,10 +126,16 @@ class AsynchronousFileReader {
return false; return false;
} }
$content = str_replace(array("\r", "\n"), '', $content);
if ($compression) { if ($compression) {
$content = gzencode($content); $content = gzencode($content);
$header = array("Content-Type: " . $contentType, "Keep-Alive: 300", "Connection: Keep-Alive", "Content-Encoding: gzip");
} else {
$header = array("Content-Type: " . $contentType, "Keep-Alive: 300", "Connection: Keep-Alive");
} }
$request = new Request($url); $request = new Request($url);
$request->getOptions()->set(CURLOPT_HEADER, false) //don't display response header $request->getOptions()->set(CURLOPT_HEADER, false) //don't display response header
->set(CURLOPT_CRLF, true) //linux linefeed ->set(CURLOPT_CRLF, true) //linux linefeed
@ -137,7 +143,7 @@ class AsynchronousFileReader {
//->set(CURLOPT_AUTOREFERER, true)//accept link reference //->set(CURLOPT_AUTOREFERER, true)//accept link reference
->set(CURLOPT_POST, true) //post field ->set(CURLOPT_POST, true) //post field
->set(CURLOPT_POSTFIELDS, $content) //post content field ->set(CURLOPT_POSTFIELDS, $content) //post content field
->set(CURLOPT_HTTPHEADER, array("Content-Type: " . $contentType, "Keep-Alive: 300", "Connection: Keep-Alive", "Content-Encoding: gzip")) // ->set(CURLOPT_HTTPHEADER, $header) //
//->set(CURLOPT_HTTPHEADER, array("Content-Type: " . $contentType, "Keep-Alive: 300", "Connection: Keep-Alive")) // //->set(CURLOPT_HTTPHEADER, array("Content-Type: " . $contentType, "Keep-Alive: 300", "Connection: Keep-Alive")) //
->set(CURLOPT_USERAGENT, 'ManiaControl v' . ManiaControl::VERSION) // ->set(CURLOPT_USERAGENT, 'ManiaControl v' . ManiaControl::VERSION) //
->set(CURLOPT_RETURNTRANSFER, true); ->set(CURLOPT_RETURNTRANSFER, true);

View File

@ -16,6 +16,7 @@ use ManiaControl\Maps\MapManager;
use ManiaControl\Players\Player; use ManiaControl\Players\Player;
use ManiaControl\Players\PlayerManager; use ManiaControl\Players\PlayerManager;
use ManiaControl\Plugins\Plugin; use ManiaControl\Plugins\Plugin;
use Maniaplanet\DedicatedServer\Xmlrpc\Base64;
class Dedimania implements CallbackListener, TimerListener, Plugin { class Dedimania implements CallbackListener, TimerListener, Plugin {
/** /**
@ -304,11 +305,8 @@ class Dedimania implements CallbackListener, TimerListener, Plugin {
$replays['Top1GReplay'] = ''; $replays['Top1GReplay'] = '';
} }
$replays['VReplay'] = base64_encode($replays['VReplay']); xmlrpc_set_type($replays['VReplay'], 'base64');
$replays['Top1GReplay'] = base64_encode($replays['Top1GReplay']); xmlrpc_set_type($replays['Top1GReplay'], 'base64');
xmlrpc_set_type($replays['VReplay'], 'string');
xmlrpc_set_type($replays['Top1GReplay'], 'string');
//var_dump($replays); //var_dump($replays);
$data = array($this->dedimaniaData->sessionId, $this->getMapInfo(), $gameMode, $times, $replays); $data = array($this->dedimaniaData->sessionId, $this->getMapInfo(), $gameMode, $times, $replays);
@ -344,7 +342,7 @@ class Dedimania implements CallbackListener, TimerListener, Plugin {
} }
} }
} }
}, $content, true); }, $content, false);
} }
/** /**