From a525f18839e68f610a68e062f4b43cd65ad68f93 Mon Sep 17 00:00:00 2001 From: Marcin Haba Date: Mon, 28 Apr 2014 04:04:44 +0200 Subject: [PATCH] Moved auth params to curl opts --- gui/baculum/protected/Class/API.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/gui/baculum/protected/Class/API.php b/gui/baculum/protected/Class/API.php index d5831b9de3..f86f4aa7d8 100644 --- a/gui/baculum/protected/Class/API.php +++ b/gui/baculum/protected/Class/API.php @@ -35,6 +35,8 @@ class API extends TModule { curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY); + curl_setopt($ch, CURLOPT_USERPWD, $this->appCfg['baculum']['login'] . ':' . $this->appCfg['baculum']['password']); return $ch; } @@ -42,12 +44,15 @@ class API extends TModule { return 'X-Baculum-API: ' . self::API_VERSION; } - private function getURL() { + public function init($config) { $this->appCfg = $this->Application->getModule('configuration')->getApplicationConfig(); + } + + private function getURL() { $protocol = !empty($_SERVER['HTTPS']) ? 'https' : 'http'; $host = $_SERVER['SERVER_NAME']; $port = $_SERVER['SERVER_PORT']; - $url = sprintf('%s://%s:%s@%s:%d/', $protocol, $this->appCfg['baculum']['login'], $this->appCfg['baculum']['password'], $host, $port); + $url = sprintf('%s://%s:%d/', $protocol, $host, $port); return $url; } -- 2.39.5