diff --git a/lib/webdavlib.php b/lib/webdavlib.php index 4eddc7d..4f3a077 100644 --- a/lib/webdavlib.php +++ b/lib/webdavlib.php @@ -48,6 +48,7 @@ class webdav_client { private $_auth = false; private $_user; private $_pass; + private $_type; // ssl or not private $_socket_timeout = 5; private $_errno; @@ -79,7 +80,7 @@ class webdav_client { /** * Constructor - Initialise class variables */ - function __construct($server = '', $user = '', $pass = '', $auth = false) { + function __construct($server = '', $user = '', $pass = '', $auth = false, $type = '') { if (!empty($server)) { $this->_server = $server; } @@ -88,6 +89,7 @@ class webdav_client { $this->pass = $pass; } $this->_auth = $auth; + $this->_type = $type; } public function __set($key, $value) { $property = '_' . $key; @@ -154,7 +156,7 @@ class webdav_client { function open() { // let's try to open a socket $this->_error_log('open a socket connection'); - $this->sock = fsockopen($this->_server, $this->_port, $this->_errno, $this->_errstr, $this->_socket_timeout); + $this->sock = fsockopen("$this->_type$this->_server", $this->_port, $this->_errno, $this->_errstr, $this->_socket_timeout); set_time_limit(30); if (is_resource($this->sock)) { socket_set_blocking($this->sock, true); diff --git a/repository/webdav/lib.php b/repository/webdav/lib.php index a7284c5..43a312e 100644 --- a/repository/webdav/lib.php +++ b/repository/webdav/lib.php @@ -38,12 +38,12 @@ class repository_webdav extends repository { if ($this->options['webdav_auth'] == 'none') { $this->options['webdav_auth'] = false; } - $this->dav = new webdav_client($this->options['webdav_server'], $this->options['webdav_user'], $this->options['webdav_password'], $this->options['webdav_auth']); if (empty($this->options['webdav_type'])) { $this->webdav_type = ''; } else { $this->webdav_type = 'ssl://'; } + $this->dav = new webdav_client($this->options['webdav_server'], $this->options['webdav_user'], $this->options['webdav_password'], $this->options['webdav_auth'], $this->webdav_type); if (empty($this->options['webdav_port'])) { if (empty($this->webdav_type)) { $this->dav->port = 80;