Skip to content

Commit 53e04ba

Browse files
committed
Use TLS by default
1 parent f363dd4 commit 53e04ba

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

S3.php

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class S3
5656
* @static
5757
*/
5858
private static $__accessKey = null;
59-
59+
6060
/**
6161
* AWS Secret Key
6262
*
@@ -65,7 +65,7 @@ class S3
6565
* @static
6666
*/
6767
private static $__secretKey = null;
68-
68+
6969
/**
7070
* SSL Client key
7171
*
@@ -82,7 +82,7 @@ class S3
8282
* @static
8383
*/
8484
public static $defDelimiter = null;
85-
85+
8686
/**
8787
* AWS URI
8888
*
@@ -91,7 +91,7 @@ class S3
9191
* @static
9292
*/
9393
public static $endpoint = 's3.amazonaws.com';
94-
94+
9595
/**
9696
* Proxy information
9797
*
@@ -100,7 +100,7 @@ class S3
100100
* @static
101101
*/
102102
public static $proxy = null;
103-
103+
104104
/**
105105
* Connect using SSL?
106106
*
@@ -109,7 +109,7 @@ class S3
109109
* @static
110110
*/
111111
public static $useSSL = false;
112-
112+
113113
/**
114114
* Use SSL validation?
115115
*
@@ -118,7 +118,16 @@ class S3
118118
* @static
119119
*/
120120
public static $useSSLValidation = true;
121-
121+
122+
/**
123+
* Use SSL version
124+
*
125+
* @var const
126+
* @access public
127+
* @static
128+
*/
129+
public static $useSSLVersion = CURL_SSLVERSION_TLSv1;
130+
122131
/**
123132
* Use PHP exceptions?
124133
*
@@ -210,6 +219,7 @@ public function setEndpoint($host)
210219
self::$endpoint = $host;
211220
}
212221

222+
213223
/**
214224
* Set AWS access key and secret key
215225
*
@@ -2131,6 +2141,9 @@ public function getResponse()
21312141

21322142
if (S3::$useSSL)
21332143
{
2144+
// Set protocol version
2145+
curl_setopt($curl, CURLOPT_SSLVERSION, S3::$useSSLVersion);
2146+
21342147
// SSL Validation can now be optional for those with broken OpenSSL installations
21352148
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, S3::$useSSLValidation ? 2 : 0);
21362149
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, S3::$useSSLValidation ? 1 : 0);

0 commit comments

Comments
 (0)