@@ -48,6 +48,7 @@ class DAV extends Common {
4848 protected $ host ;
4949 /** @var bool */
5050 protected $ secure ;
51+ protected bool $ verify ;
5152 /** @var string */
5253 protected $ root ;
5354 /** @var string */
@@ -102,12 +103,14 @@ public function __construct($params) {
102103 $ this ->authType = $ params ['authType ' ];
103104 }
104105 if (isset ($ params ['secure ' ])) {
106+ $ this ->verify = $ params ['verify ' ] ?? true ;
105107 if (is_string ($ params ['secure ' ])) {
106108 $ this ->secure = ($ params ['secure ' ] === 'true ' );
107109 } else {
108110 $ this ->secure = (bool ) $ params ['secure ' ];
109111 }
110112 } else {
113+ $ this ->verify = false ;
111114 $ this ->secure = false ;
112115 }
113116 if ($ this ->secure === true ) {
@@ -151,6 +154,9 @@ protected function init() {
151154 $ this ->client ->setThrowExceptions (true );
152155
153156 if ($ this ->secure === true ) {
157+ if ($ this ->verify === false ) {
158+ $ this ->client ->addCurlSetting (CURLOPT_SSL_VERIFYPEER , false );
159+ }
154160 $ certPath = $ this ->certManager ->getAbsoluteBundlePath ();
155161 if (file_exists ($ certPath )) {
156162 $ this ->certPath = $ certPath ;
@@ -162,13 +168,13 @@ protected function init() {
162168
163169 $ lastRequestStart = 0 ;
164170 $ this ->client ->on ('beforeRequest ' , function (RequestInterface $ request ) use (&$ lastRequestStart ) {
165- $ this ->logger ->debug ('sending dav ' . $ request ->getMethod () . ' request to external storage: ' . $ request ->getAbsoluteUrl (), ['app ' => 'dav ' ]);
171+ $ this ->logger ->debug ('sending dav ' . $ request ->getMethod () . ' request to external storage: ' . $ request ->getAbsoluteUrl (), ['app ' => 'dav ' ]);
166172 $ lastRequestStart = microtime (true );
167173 $ this ->eventLogger ->start ('fs:storage:dav:request ' , 'Sending dav request to external storage ' );
168174 });
169175 $ this ->client ->on ('afterRequest ' , function (RequestInterface $ request ) use (&$ lastRequestStart ) {
170176 $ elapsed = microtime (true ) - $ lastRequestStart ;
171- $ this ->logger ->debug ('dav ' . $ request ->getMethod () . ' request to external storage: ' . $ request ->getAbsoluteUrl () . ' took ' . round ($ elapsed * 1000 , 1 ) . 'ms ' , ['app ' => 'dav ' ]);
177+ $ this ->logger ->debug ('dav ' . $ request ->getMethod () . ' request to external storage: ' . $ request ->getAbsoluteUrl () . ' took ' . round ($ elapsed * 1000 , 1 ) . 'ms ' , ['app ' => 'dav ' ]);
172178 $ this ->eventLogger ->end ('fs:storage:dav:request ' );
173179 });
174180 }
@@ -338,7 +344,8 @@ public function fopen($path, $mode) {
338344 'auth ' => [$ this ->user , $ this ->password ],
339345 'stream ' => true ,
340346 // set download timeout for users with slow connections or large files
341- 'timeout ' => $ this ->timeout
347+ 'timeout ' => $ this ->timeout ,
348+ 'verify ' => $ this ->verify ,
342349 ]);
343350 } catch (\GuzzleHttp \Exception \ClientException $ e ) {
344351 if ($ e ->getResponse () instanceof ResponseInterface
@@ -494,7 +501,8 @@ protected function uploadFile($path, $target) {
494501 'body ' => $ source ,
495502 'auth ' => [$ this ->user , $ this ->password ],
496503 // set upload timeout for users with slow connections or large files
497- 'timeout ' => $ this ->timeout
504+ 'timeout ' => $ this ->timeout ,
505+ 'verify ' => $ this ->verify ,
498506 ]);
499507
500508 $ this ->removeCachedFile ($ target );
0 commit comments