From b6b4c4c9201af1539c07f611f3e24ec0de5e0667 Mon Sep 17 00:00:00 2001
From: Frank Karlitschek <frank@owncloud.org>
Date: Fri, 14 Dec 2012 18:52:16 +0100
Subject: [PATCH] add curl proxy support. Fixes #504
 https://github.com/owncloud/core/issues/504

---
 config/config.sample.php | 6 ++++++
 lib/util.php             | 2 ++
 2 files changed, 8 insertions(+)

diff --git a/config/config.sample.php b/config/config.sample.php
index f531d5f146..c915a87729 100644
--- a/config/config.sample.php
+++ b/config/config.sample.php
@@ -42,6 +42,12 @@ $CONFIG = array(
 /* Time in seconds how long an user is authenticated without entering his password again before performing sensitive actions like creating or deleting users etc...*/
 "enhancedauthtime" => 15 * 60,
 
+/* A proxy to use to connect to the internet. For example "myproxy.org:88" */
+"curlproxy" => "",
+
+/* The optional authentication for the proxy to use to connect to the internet. The format is: [username]:[password] */
+"curlproxyuserpwd" => "",
+
 /* Theme to use for ownCloud */
 "theme" => "",
 
diff --git a/lib/util.php b/lib/util.php
index 34c4d4f9b1..370e5dc13f 100755
--- a/lib/util.php
+++ b/lib/util.php
@@ -696,6 +696,8 @@ class OC_Util {
                 curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 10);
                 curl_setopt($curl, CURLOPT_URL, $url);
 		curl_setopt($curl, CURLOPT_USERAGENT, "ownCloud Server Crawler");
+                if(OC_Config::getValue('curlproxy','')=='') curl_setopt($curl, CURLOPT_PROXY, OC_Config::getValue('curlproxy'));
+                if(OC_Config::getValue('curlproxyuserpwd','')=='') curl_setopt($curl, CURLOPT_PROXYUSERPWD, OC_Config::getValue('curlproxyuserpwd'));
                 $data = curl_exec($curl);
                 curl_close($curl);
 
-- 
GitLab