forked from reactphp/http
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRequest.php
More file actions
89 lines (72 loc) · 1.75 KB
/
Request.php
File metadata and controls
89 lines (72 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
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;
}
}