This commit is contained in:
kremsy 2014-02-15 00:47:42 +01:00 committed by Steffen Schröder
parent 6717039e91
commit b71fced023

View File

@ -76,7 +76,7 @@ class AsynchronousFileReader {
* @param string $contentType * @param string $contentType
* @return bool * @return bool
*/ */
public function loadFile($url, $function, $contentType = 'UTF-8') { public function loadFile($url, $function, $contentType = 'UTF-8', $customHeader = '') {
if (!is_callable($function)) { if (!is_callable($function)) {
$this->maniaControl->log("Function is not callable"); $this->maniaControl->log("Function is not callable");
return false; return false;
@ -94,11 +94,15 @@ class AsynchronousFileReader {
return false; return false;
} }
if ($customHeader == '') {
$query = 'GET ' . $urlData['path'] . $urlQuery . ' HTTP/1.0' . PHP_EOL; $query = 'GET ' . $urlData['path'] . $urlQuery . ' HTTP/1.0' . PHP_EOL;
$query .= 'Host: ' . $urlData['host'] . PHP_EOL; $query .= 'Host: ' . $urlData['host'] . PHP_EOL;
$query .= 'Content-Type: ' . $contentType . PHP_EOL; $query .= 'Content-Type: ' . $contentType . PHP_EOL;
$query .= 'User-Agent: ManiaControl v' . ManiaControl::VERSION . PHP_EOL; $query .= 'User-Agent: ManiaControl v' . ManiaControl::VERSION . PHP_EOL;
$query .= PHP_EOL; $query .= PHP_EOL;
} else {
$query = $customHeader;
}
fwrite($socket, $query); fwrite($socket, $query);