Skip to content

Commit 6d186c0

Browse files
authored
Add cURL proxy type configuration (#519)
1 parent 0601219 commit 6d186c0

File tree

4 files changed

+21
-0
lines changed

4 files changed

+21
-0
lines changed

src/Configuration/AbstractConfiguration.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ abstract class AbstractConfiguration implements ConfigurationInterface
6464
*/
6565
protected ?string $proxyPort = null;
6666

67+
/**
68+
* Proxy type.
69+
*/
70+
protected ?int $proxyType = null;
71+
6772
/**
6873
* Proxy user.
6974
*/
@@ -198,6 +203,11 @@ public function getProxyPort(): ?string
198203
return $this->proxyPort;
199204
}
200205

206+
public function getProxyType(): ?int
207+
{
208+
return $this->proxyType;
209+
}
210+
201211
public function getProxyUser(): ?string
202212
{
203213
return $this->proxyUser;

src/Configuration/ConfigurationInterface.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@ public function getProxyServer(): ?string;
9696
*/
9797
public function getProxyPort(): ?string;
9898

99+
/**
100+
* Proxy type.
101+
*/
102+
public function getProxyType(): ?int;
103+
99104
/**
100105
* Proxy user.
101106
*/

src/Configuration/DotEnvConfiguration.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public function __construct(string $path = '.')
3737
$this->curlOptVerbose = $this->env('CURLOPT_VERBOSE', false);
3838
$this->proxyServer = $this->env('PROXY_SERVER');
3939
$this->proxyPort = $this->env('PROXY_PORT');
40+
$this->proxyType = $this->env('PROXY_TYPE');
4041
$this->proxyUser = $this->env('PROXY_USER');
4142
$this->proxyPassword = $this->env('PROXY_PASSWORD');
4243

src/JiraClient.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,11 @@ private function proxyConfigCurlHandle(\CurlHandle $ch): void
605605
$password = $this->getConfiguration()->getProxyPassword();
606606
curl_setopt($ch, CURLOPT_PROXYUSERPWD, "$username:$password");
607607
}
608+
609+
// Set the proxy type for curl, default is CURLPROXY_HTTP (0)
610+
if ($this->getConfiguration()->getProxyType()) {
611+
curl_setopt($ch, CURLOPT_PROXYTYPE, $this->getConfiguration()->getProxyType());
612+
}
608613
}
609614

610615
/**

0 commit comments

Comments
 (0)