Merge pull request #1891 from owncloud/set_timeout

use a 5 sec timeout for the webdav check
This commit is contained in:
Bernhard Posselt 2013-02-25 08:27:20 -08:00
commit 946a064fc6
1 changed files with 9 additions and 1 deletions

View File

@ -556,11 +556,16 @@ class OC_Util {
if (!function_exists('curl_init')) {
return true;
}
$settings = array(
'baseUri' => OC_Helper::linkToRemote('webdav'),
);
// save the old timeout so that we can restore it later
$old_timeout=ini_get("default_socket_timeout");
// use a 5 sec timeout for the check. Should be enough for local requests.
ini_set("default_socket_timeout", 5);
$client = new \Sabre_DAV_Client($settings);
$return = true;
@ -574,6 +579,9 @@ class OC_Util {
$return = false;
}
// restore the original timeout
ini_set("default_socket_timeout", $old_timeout);
return $return;
}