Changeset View
Changeset View
Standalone View
Standalone View
plugins/libkolab/libkolab.php
Show First 20 Lines • Show All 229 Lines • ▼ Show 20 Lines | public static function http_request($url = '', $method = 'GET', $config = array()) | ||||
// force CURL adapter, this allows to handle correctly | // force CURL adapter, this allows to handle correctly | ||||
// compressed responses with SplObserver registered (kolab_files) (#4507) | // compressed responses with SplObserver registered (kolab_files) (#4507) | ||||
$http_config['adapter'] = 'HTTP_Request2_Adapter_Curl'; | $http_config['adapter'] = 'HTTP_Request2_Adapter_Curl'; | ||||
$key = md5(serialize($http_config)); | $key = md5(serialize($http_config)); | ||||
if (!($request = self::$http_requests[$key])) { | if (!($request = self::$http_requests[$key])) { | ||||
// load HTTP_Request2 | // load HTTP_Request2 (support both composer-installed and system-installed package) | ||||
if (!class_exists('HTTP_Request2')) { | |||||
require_once 'HTTP/Request2.php'; | require_once 'HTTP/Request2.php'; | ||||
} | |||||
try { | try { | ||||
$request = new HTTP_Request2(); | $request = new HTTP_Request2(); | ||||
$request->setConfig($http_config); | $request->setConfig($http_config); | ||||
} | } | ||||
catch (Exception $e) { | catch (Exception $e) { | ||||
rcube::raise_error($e, true, true); | rcube::raise_error($e, true, true); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 139 Lines • Show Last 20 Lines |