additional headers in asynchronousfilereader

This commit is contained in:
kremsy 2015-07-29 14:35:19 +02:00
parent 30945a17e6
commit 6a8087cd95
4 changed files with 21 additions and 20 deletions

View File

@ -1,6 +1,8 @@
###v0.162###
#Additions
- added typhinting ladderStat in Player object
- added optional AsynchronousFileReader Parameter for loadFile and postFile to set additional Headers
- added ServerLogin header for Mania-Exchange downloads
###v0.161###
#Additions

View File

@ -66,9 +66,9 @@ class AsynchronousFileReader {
* @param callable $function
* @param string $contentType
* @param int $keepAlive
* @param array $headers Additional Headers
*/
public function loadFile($url, callable $function, $contentType = 'UTF-8', $keepAlive = 0) {
$headers = array();
public function loadFile($url, callable $function, $contentType = 'UTF-8', $keepAlive = 0, $headers = array()) {
array_push($headers, 'Content-Type: ' . $contentType);
if ($keepAlive) {
array_push($headers, 'Keep-Alive: ' . $keepAlive);
@ -161,10 +161,9 @@ class AsynchronousFileReader {
* @param string $content
* @param bool $compression
* @param string $contentType
* @param array $headers Additional Headers
*/
public function postData($url, callable $function, $content, $compression = false, $contentType = 'text/xml; charset=UTF-8;') {
$headers = array();
public function postData($url, callable $function, $content, $compression = false, $contentType = 'text/xml; charset=UTF-8;', $headers = array()) {
array_push($headers, 'Content-Type: ' . $contentType);
array_push($headers, 'Keep-Alive: timeout=600, max=2000');
array_push($headers, 'Connection: Keep-Alive');

View File

@ -47,7 +47,7 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener,
/*
* Constants
*/
const VERSION = '0.161';
const VERSION = '0.162';
const API_VERSION = '2013-04-16';
const MIN_DEDIVERSION = '2014-04-02_18_00';
const SCRIPT_TIMEOUT = 10;

View File

@ -366,7 +366,7 @@ class MapManager implements CallbackListener, CommunicationListener {
return;
}
$this->processMapFile($file, $mapInfo, $login, $update);
});
}, 'UTF-8', 0, array("X-ManiaPlanet-ServerLogin: " . $this->maniaControl->getServer()->login));
});
}
return;