formatted

This commit is contained in:
Steffen Schröder 2014-07-17 20:02:23 +02:00
parent 545ee6bc25
commit f369af1358

View File

@ -3,7 +3,6 @@
namespace ManiaControl\Files; namespace ManiaControl\Files;
use cURL\Event; use cURL\Event;
use cURL\Exception;
use cURL\Request; use cURL\Request;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
@ -36,6 +35,18 @@ class AsynchronousFileReader {
$this->maniaControl = $maniaControl; $this->maniaControl = $maniaControl;
} }
public static function newRequestTest($url) {
$request = new Request($url);
$request->getOptions()
->set(CURLOPT_TIMEOUT, 60)
->set(CURLOPT_HEADER, false) // don't display response header
->set(CURLOPT_CRLF, true) // linux line feed
->set(CURLOPT_ENCODING, '') // accept encoding
->set(CURLOPT_USERAGENT, 'ManiaControl v' . ManiaControl::VERSION) // user-agent
->set(CURLOPT_RETURNTRANSFER, true); // return instead of output content
return $request;
}
/** /**
* Append available Data of active Requests * Append available Data of active Requests
*/ */
@ -43,7 +54,7 @@ class AsynchronousFileReader {
foreach ($this->requests as $key => $request) { foreach ($this->requests as $key => $request) {
if ($request->socketPerform()) { if ($request->socketPerform()) {
$request->socketSelect(); $request->socketSelect();
}else{ } else {
unset($this->requests[$key]); unset($this->requests[$key]);
} }
} }
@ -103,6 +114,8 @@ class AsynchronousFileReader {
return $request; return $request;
} }
//TODO remove, they are just for testing dedimania
/** /**
* Add a Request to the queue * Add a Request to the queue
* *
@ -112,19 +125,6 @@ class AsynchronousFileReader {
array_push($this->requests, $request); array_push($this->requests, $request);
} }
//TODO remove, they are just for testing dedimania
public static function newRequestTest($url){
$request = new Request($url);
$request->getOptions()
->set(CURLOPT_TIMEOUT, 60)
->set(CURLOPT_HEADER, false) // don't display response header
->set(CURLOPT_CRLF, true) // linux line feed
->set(CURLOPT_ENCODING, '') // accept encoding
->set(CURLOPT_USERAGENT, 'ManiaControl v' . ManiaControl::VERSION) // user-agent
->set(CURLOPT_RETURNTRANSFER, true); // return instead of output content
return $request;
}
public function postDataTest(Request $request, $url, callable $function, $content, $compression = false, public function postDataTest(Request $request, $url, callable $function, $content, $compression = false,
$contentType = 'text/xml; charset=UTF-8;') { $contentType = 'text/xml; charset=UTF-8;') {