]> source.dussan.org Git - nextcloud-server.git/commitdiff
Refactor getProxyUri
authorDaniel Kesselberg <mail@danielkesselberg.de>
Sun, 24 Feb 2019 18:24:13 +0000 (19:24 +0100)
committerDaniel Kesselberg <mail@danielkesselberg.de>
Tue, 16 Apr 2019 19:13:29 +0000 (21:13 +0200)
Get proxyuserpwd only if proxy not empty.

Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
lib/private/Http/Client/Client.php

index baa358f2fea9f2199814678498ae73242f4a6677..ad51feca0bed71e69bcc6b4c32a1340580156cad 100644 (file)
@@ -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;
        }
 
        /**