From b71fced02309ad3cde276ff990c7b5da5d48cba4 Mon Sep 17 00:00:00 2001 From: kremsy Date: Sat, 15 Feb 2014 00:47:42 +0100 Subject: [PATCH] fix --- .../core/Files/AsynchronousFileReader.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/application/core/Files/AsynchronousFileReader.php b/application/core/Files/AsynchronousFileReader.php index c15fb613..3c157141 100644 --- a/application/core/Files/AsynchronousFileReader.php +++ b/application/core/Files/AsynchronousFileReader.php @@ -76,7 +76,7 @@ class AsynchronousFileReader { * @param string $contentType * @return bool */ - public function loadFile($url, $function, $contentType = 'UTF-8') { + public function loadFile($url, $function, $contentType = 'UTF-8', $customHeader = '') { if (!is_callable($function)) { $this->maniaControl->log("Function is not callable"); return false; @@ -94,11 +94,15 @@ class AsynchronousFileReader { return false; } - $query = 'GET ' . $urlData['path'] . $urlQuery . ' HTTP/1.0' . PHP_EOL; - $query .= 'Host: ' . $urlData['host'] . PHP_EOL; - $query .= 'Content-Type: ' . $contentType . PHP_EOL; - $query .= 'User-Agent: ManiaControl v' . ManiaControl::VERSION . PHP_EOL; - $query .= PHP_EOL; + if ($customHeader == '') { + $query = 'GET ' . $urlData['path'] . $urlQuery . ' HTTP/1.0' . PHP_EOL; + $query .= 'Host: ' . $urlData['host'] . PHP_EOL; + $query .= 'Content-Type: ' . $contentType . PHP_EOL; + $query .= 'User-Agent: ManiaControl v' . ManiaControl::VERSION . PHP_EOL; + $query .= PHP_EOL; + } else { + $query = $customHeader; + } fwrite($socket, $query);