Skip to content

Commit 9cba2f3

Browse files
authored
Merge pull request #68 from brianjmiller/remotelrs-proxy
Add `proxy` option to RemoteLRS
2 parents 027759c + 3bdf969 commit 9cba2f3

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/RemoteLRS.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ class RemoteLRS implements LRSInterface
3232
protected $endpoint;
3333
protected $version;
3434
protected $auth;
35+
protected $proxy;
36+
protected $headers;
3537
protected $extended;
3638

3739
public function __construct() {
@@ -100,6 +102,15 @@ protected function sendRequest($method, $resource) {
100102
if (isset($this->auth)) {
101103
array_push($http['header'], 'Authorization: ' . $this->auth);
102104
}
105+
if (isset($this->proxy)) {
106+
$http['proxy'] = $this->proxy;
107+
}
108+
109+
if (isset($this->headers) && count($this->headers) > 0) {
110+
foreach ($this->headers as $k => $v) {
111+
array_push($http['header'], "$k: $v");
112+
}
113+
}
103114

104115
if (isset($options['headers'])) {
105116
foreach ($options['headers'] as $k => $v) {
@@ -1169,4 +1180,16 @@ public function setAuth() {
11691180
return $this;
11701181
}
11711182
public function getAuth() { return $this->auth; }
1183+
1184+
public function setProxy($value) {
1185+
$this->proxy = $value;
1186+
return $this;
1187+
}
1188+
public function getProxy() { return $this->proxy; }
1189+
1190+
public function setHeaders($value) {
1191+
$this->headers = $value;
1192+
return $this;
1193+
}
1194+
public function getHeaders() { return $this->headers; }
11721195
}

0 commit comments

Comments
 (0)