Refactor getProxyUri
Get proxyuserpwd only if proxy not empty. Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
This commit is contained in:
parent
2708d26407
commit
fd1d85365c
|
@ -96,21 +96,18 @@ class Client implements IClient {
|
|||
*/
|
||||
private function getProxyUri(): ?string {
|
||||
$proxyHost = $this->config->getSystemValue('proxy', null);
|
||||
$proxyUserPwd = $this->config->getSystemValue('proxyuserpwd', null);
|
||||
|
||||
if ($proxyHost === null && $proxyUserPwd === null) {
|
||||
if ($proxyHost === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$proxyUri = '';
|
||||
if ($proxyUserPwd !== null) {
|
||||
$proxyUri .= $proxyUserPwd . '@';
|
||||
}
|
||||
if ($proxyHost !== null) {
|
||||
$proxyUri .= $proxyHost;
|
||||
$proxyUserPwd = $this->config->getSystemValue('proxyuserpwd', null);
|
||||
|
||||
if ($proxyUserPwd === null) {
|
||||
return $proxyHost;
|
||||
}
|
||||
|
||||
return $proxyUri;
|
||||
return $proxyUserPwd . '@' . $proxyHost;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue