From 3009b43e3d54c3191f9282e626d6fcaf9cd042e7 Mon Sep 17 00:00:00 2001 From: Frank Karlitschek Date: Mon, 25 Feb 2013 16:30:11 +0100 Subject: [PATCH] use a 5 sec timeout for the webdav check --- lib/util.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/util.php b/lib/util.php index 87facda1804..f2a43e42106 100755 --- a/lib/util.php +++ b/lib/util.php @@ -569,11 +569,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; @@ -587,6 +592,9 @@ class OC_Util { $return = false; } + // restore the original timeout + ini_set("default_socket_timeout", $old_timeout); + return $return; }