From 60aa5e65342ae2fab277adb813c434ff6999b33d Mon Sep 17 00:00:00 2001 From: "Brian J. Miller" Date: Mon, 22 Aug 2016 12:40:31 -0500 Subject: [PATCH 1/2] Add `proxy` option to RemoteLRS --- src/RemoteLRS.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/RemoteLRS.php b/src/RemoteLRS.php index 83b6f35..62f0779 100644 --- a/src/RemoteLRS.php +++ b/src/RemoteLRS.php @@ -32,6 +32,7 @@ class RemoteLRS implements LRSInterface protected $endpoint; protected $version; protected $auth; + protected $proxy; protected $extended; public function __construct() { @@ -100,6 +101,9 @@ protected function sendRequest($method, $resource) { if (isset($this->auth)) { array_push($http['header'], 'Authorization: ' . $this->auth); } + if (isset($this->proxy)) { + $http['proxy'] = $this->proxy; + } if (isset($options['headers'])) { foreach ($options['headers'] as $k => $v) { @@ -1157,4 +1161,10 @@ public function setAuth() { return $this; } public function getAuth() { return $this->auth; } + + public function setProxy($value) { + $this->proxy = $value; + return $this; + } + public function getProxy() { return $this->proxy; } } From 3bdf96995dcce92cfcdee92f22c336064562e518 Mon Sep 17 00:00:00 2001 From: "Brian J. Miller" Date: Mon, 22 Aug 2016 13:58:24 -0500 Subject: [PATCH 2/2] Add `RemoteLRS` all request headers --- src/RemoteLRS.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/RemoteLRS.php b/src/RemoteLRS.php index 62f0779..c57e40d 100644 --- a/src/RemoteLRS.php +++ b/src/RemoteLRS.php @@ -33,6 +33,7 @@ class RemoteLRS implements LRSInterface protected $version; protected $auth; protected $proxy; + protected $headers; protected $extended; public function __construct() { @@ -105,6 +106,12 @@ protected function sendRequest($method, $resource) { $http['proxy'] = $this->proxy; } + if (isset($this->headers) && count($this->headers) > 0) { + foreach ($this->headers as $k => $v) { + array_push($http['header'], "$k: $v"); + } + } + if (isset($options['headers'])) { foreach ($options['headers'] as $k => $v) { array_push($http['header'], "$k: $v"); @@ -1167,4 +1174,10 @@ public function setProxy($value) { return $this; } public function getProxy() { return $this->proxy; } + + public function setHeaders($value) { + $this->headers = $value; + return $this; + } + public function getHeaders() { return $this->headers; } }