mirror of
https://github.com/Yetangitu/ampache
synced 2025-10-06 03:49:56 +02:00
Begin WebSocket support for Broadcast and Player control
This commit is contained in:
parent
2b128b122d
commit
6adf8307c4
516 changed files with 64260 additions and 18 deletions
89
modules/React/Http/Request.php
Normal file
89
modules/React/Http/Request.php
Normal file
|
@ -0,0 +1,89 @@
|
|||
<?php
|
||||
|
||||
namespace React\Http;
|
||||
|
||||
use Evenement\EventEmitter;
|
||||
use React\Stream\ReadableStreamInterface;
|
||||
use React\Stream\WritableStreamInterface;
|
||||
use React\Stream\Util;
|
||||
|
||||
class Request extends EventEmitter implements ReadableStreamInterface
|
||||
{
|
||||
private $readable = true;
|
||||
private $method;
|
||||
private $path;
|
||||
private $query;
|
||||
private $httpVersion;
|
||||
private $headers;
|
||||
|
||||
// metadata, implicitly added externally
|
||||
public $remoteAddress;
|
||||
|
||||
public function __construct($method, $path, $query = array(), $httpVersion = '1.1', $headers = array())
|
||||
{
|
||||
$this->method = $method;
|
||||
$this->path = $path;
|
||||
$this->query = $query;
|
||||
$this->httpVersion = $httpVersion;
|
||||
$this->headers = $headers;
|
||||
}
|
||||
|
||||
public function getMethod()
|
||||
{
|
||||
return $this->method;
|
||||
}
|
||||
|
||||
public function getPath()
|
||||
{
|
||||
return $this->path;
|
||||
}
|
||||
|
||||
public function getQuery()
|
||||
{
|
||||
return $this->query;
|
||||
}
|
||||
|
||||
public function getHttpVersion()
|
||||
{
|
||||
return $this->httpVersion;
|
||||
}
|
||||
|
||||
public function getHeaders()
|
||||
{
|
||||
return $this->headers;
|
||||
}
|
||||
|
||||
public function expectsContinue()
|
||||
{
|
||||
return isset($this->headers['Expect']) && '100-continue' === $this->headers['Expect'];
|
||||
}
|
||||
|
||||
public function isReadable()
|
||||
{
|
||||
return $this->readable;
|
||||
}
|
||||
|
||||
public function pause()
|
||||
{
|
||||
$this->emit('pause');
|
||||
}
|
||||
|
||||
public function resume()
|
||||
{
|
||||
$this->emit('resume');
|
||||
}
|
||||
|
||||
public function close()
|
||||
{
|
||||
$this->readable = false;
|
||||
$this->emit('end');
|
||||
$this->removeAllListeners();
|
||||
}
|
||||
|
||||
public function pipe(WritableStreamInterface $dest, array $options = array())
|
||||
{
|
||||
Util::pipe($this, $dest, $options);
|
||||
|
||||
return $dest;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue