diff --git a/application/core/Files/AsynchronousFileReader.php b/application/core/Files/AsynchronousFileReader.php index 46d5301d..ea8bbf2b 100644 --- a/application/core/Files/AsynchronousFileReader.php +++ b/application/core/Files/AsynchronousFileReader.php @@ -126,10 +126,16 @@ class AsynchronousFileReader { return false; } + $content = str_replace(array("\r", "\n"), '', $content); + if ($compression) { $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->getOptions()->set(CURLOPT_HEADER, false) //don't display response header ->set(CURLOPT_CRLF, true) //linux linefeed @@ -137,7 +143,7 @@ class AsynchronousFileReader { //->set(CURLOPT_AUTOREFERER, true)//accept link reference ->set(CURLOPT_POST, true) //post 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_USERAGENT, 'ManiaControl v' . ManiaControl::VERSION) // ->set(CURLOPT_RETURNTRANSFER, true); diff --git a/application/plugins/Dedimania/Dedimania.php b/application/plugins/Dedimania/Dedimania.php index ed8ea0ac..143e738c 100644 --- a/application/plugins/Dedimania/Dedimania.php +++ b/application/plugins/Dedimania/Dedimania.php @@ -16,6 +16,7 @@ use ManiaControl\Maps\MapManager; use ManiaControl\Players\Player; use ManiaControl\Players\PlayerManager; use ManiaControl\Plugins\Plugin; +use Maniaplanet\DedicatedServer\Xmlrpc\Base64; class Dedimania implements CallbackListener, TimerListener, Plugin { /** @@ -304,11 +305,8 @@ class Dedimania implements CallbackListener, TimerListener, Plugin { $replays['Top1GReplay'] = ''; } - $replays['VReplay'] = base64_encode($replays['VReplay']); - $replays['Top1GReplay'] = base64_encode($replays['Top1GReplay']); - - xmlrpc_set_type($replays['VReplay'], 'string'); - xmlrpc_set_type($replays['Top1GReplay'], 'string'); + xmlrpc_set_type($replays['VReplay'], 'base64'); + xmlrpc_set_type($replays['Top1GReplay'], 'base64'); //var_dump($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); } /**