summaryrefslogtreecommitdiff
path: root/plugins/kolab_files/lib/kolab_files_engine.php
diff options
context:
space:
mode:
authorAleksander Machniak <machniak@kolabsys.com>2013-09-26 12:53:52 (GMT)
committerAleksander Machniak <machniak@kolabsys.com>2013-09-26 12:53:52 (GMT)
commit5327dfc64139839479d76fe76bef039b3075142e (patch)
treec1d18252ff7ff924f8eae870f55f0dbf39f6f375 /plugins/kolab_files/lib/kolab_files_engine.php
parent83edac179ad73323fbd3058695ba1fb2c8b64666 (diff)
downloadroundcubemail-plugins-kolab-5327dfc64139839479d76fe76bef039b3075142e.tar.gz
Implemented unified cross-plugin HTTP_Request2 object configuration (Request #2149)
Diffstat (limited to 'plugins/kolab_files/lib/kolab_files_engine.php')
-rw-r--r--plugins/kolab_files/lib/kolab_files_engine.php34
1 files changed, 11 insertions, 23 deletions
diff --git a/plugins/kolab_files/lib/kolab_files_engine.php b/plugins/kolab_files/lib/kolab_files_engine.php
index 419dcb0..fc14e80 100644
--- a/plugins/kolab_files/lib/kolab_files_engine.php
+++ b/plugins/kolab_files/lib/kolab_files_engine.php
@@ -581,35 +581,23 @@ class kolab_files_engine
$url = $this->url . '/api/';
if (!$this->request) {
- require_once 'HTTP/Request2.php';
+ $config = array(
+ 'store_body' => true,
+ 'follow_redirects' => true,
+ );
+ $this->request = libkolab::http_request($url, 'GET', $config);
+ }
+ else {
+ // cleanup
try {
- $request = new HTTP_Request2();
- $request->setConfig(array(
- 'store_body' => true,
- 'follow_redirects' => true,
- 'ssl_verify_peer' => $this->rc->config->get('kolab_ssl_verify_peer', true),
- 'ssl_verify_host' => $this->rc->config->get('kolab_ssl_verify_host', true),
- ));
-
- $this->request = $request;
+ $this->request->setBody('');
+ $this->request->setUrl($url);
+ $this->request->setMethod(HTTP_Request2::METHOD_GET);
}
catch (Exception $e) {
rcube::raise_error($e, true, true);
}
-
- // proxy User-Agent string
- $this->request->setHeader('user-agent', $_SERVER['HTTP_USER_AGENT']);
- }
-
- // cleanup
- try {
- $this->request->setBody('');
- $this->request->setUrl($url);
- $this->request->setMethod(HTTP_Request2::METHOD_GET);
- }
- catch (Exception $e) {
- rcube::raise_error($e, true, true);
}
if ($token) {