[Pkg-owncloud-commits] [owncloud] 73/103: Check if cURL supports the desired features

David Prévot taffit at moszumanska.debian.org
Sun May 31 12:32:39 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to annotated tag v8.0.4RC1
in repository owncloud.

commit 62e7696aed4f8ad77fde32deae18bdf84bb4be31
Author: Lukas Reschke <lukas at owncloud.com>
Date:   Tue May 12 12:00:56 2015 +0200

    Check if cURL supports the desired features
    
    Older versions of cURL that are unfortunately still bundled by distributors don't support these features which will result in errors and other possibly unpredictable behaviour.
    
    Fixes https://github.com/owncloud/core/issues/16179 for stable8
---
 lib/private/files/storage/dav.php | 16 ++++++++++++----
 lib/private/httphelper.php        |  9 ++++++---
 lib/private/user/http.php         |  8 ++++++--
 3 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/lib/private/files/storage/dav.php b/lib/private/files/storage/dav.php
index 15d9c92..9734d36 100644
--- a/lib/private/files/storage/dav.php
+++ b/lib/private/files/storage/dav.php
@@ -185,8 +185,12 @@ class DAV extends \OC\Files\Storage\Common {
 				curl_setopt($curl, CURLOPT_URL, $this->createBaseUri() . $this->encodePath($path));
 				curl_setopt($curl, CURLOPT_FILE, $fp);
 				curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
-				curl_setopt($curl, CURLOPT_PROTOCOLS,  CURLPROTO_HTTP | CURLPROTO_HTTPS);
-				curl_setopt($curl, CURLOPT_REDIR_PROTOCOLS,  CURLPROTO_HTTP | CURLPROTO_HTTPS);
+				if(defined('CURLOPT_PROTOCOLS')) {
+					curl_setopt($curl, CURLOPT_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS);
+				}
+				if(defined('CURLOPT_REDIR_PROTOCOLS')) {
+					curl_setopt($curl, CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS);
+				}
 				if ($this->secure === true) {
 					curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, true);
 					curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2);
@@ -295,8 +299,12 @@ class DAV extends \OC\Files\Storage\Common {
 		curl_setopt($curl, CURLOPT_INFILESIZE, filesize($path));
 		curl_setopt($curl, CURLOPT_PUT, true);
 		curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
-		curl_setopt($curl, CURLOPT_PROTOCOLS,  CURLPROTO_HTTP | CURLPROTO_HTTPS);
-		curl_setopt($curl, CURLOPT_REDIR_PROTOCOLS,  CURLPROTO_HTTP | CURLPROTO_HTTPS);
+		if(defined('CURLOPT_PROTOCOLS')) {
+			curl_setopt($curl, CURLOPT_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS);
+		}
+		if(defined('CURLOPT_REDIR_PROTOCOLS')) {
+			curl_setopt($curl, CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS);
+		}
 		if ($this->secure === true) {
 			curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, true);
 			curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2);
diff --git a/lib/private/httphelper.php b/lib/private/httphelper.php
index 08c35e4..88e9ac7 100644
--- a/lib/private/httphelper.php
+++ b/lib/private/httphelper.php
@@ -68,9 +68,12 @@ class HTTPHelper {
 			curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
 			curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 10);
 			curl_setopt($curl, CURLOPT_URL, $url);
-			curl_setopt($curl, CURLOPT_PROTOCOLS,  CURLPROTO_HTTP | CURLPROTO_HTTPS);
-			curl_setopt($curl, CURLOPT_REDIR_PROTOCOLS,  CURLPROTO_HTTP | CURLPROTO_HTTPS);
-
+			if(defined('CURLOPT_PROTOCOLS')) {
+				curl_setopt($curl, CURLOPT_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS);
+			}
+			if(defined('CURLOPT_REDIR_PROTOCOLS')) {
+				curl_setopt($curl, CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS);
+			}
 			curl_setopt($curl, CURLOPT_USERAGENT, self::USER_AGENT);
 			if ($proxy !== null) {
 				curl_setopt($curl, CURLOPT_PROXY, $proxy);
diff --git a/lib/private/user/http.php b/lib/private/user/http.php
index 8375c4e..10c95ed 100644
--- a/lib/private/user/http.php
+++ b/lib/private/user/http.php
@@ -72,8 +72,12 @@ class OC_User_HTTP extends OC_User_Backend implements \OCP\IUserBackend {
 		curl_setopt($ch, CURLOPT_URL, $url);
 		curl_setopt($ch, CURLOPT_USERPWD, $user.':'.$password);
 		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
-		curl_setopt($ch, CURLOPT_PROTOCOLS,  CURLPROTO_HTTP | CURLPROTO_HTTPS);
-		curl_setopt($ch, CURLOPT_REDIR_PROTOCOLS,  CURLPROTO_HTTP | CURLPROTO_HTTPS);
+		if(defined('CURLOPT_PROTOCOLS')) {
+			curl_setopt($curl, CURLOPT_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS);
+		}
+		if(defined('CURLOPT_REDIR_PROTOCOLS')) {
+			curl_setopt($curl, CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS);
+		}
 
 		curl_exec($ch);
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list