Skip to content

Commit

Permalink
Use TLS by default
Browse files Browse the repository at this point in the history
  • Loading branch information
tpyo committed Apr 27, 2015
1 parent f363dd4 commit 53e04ba
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions S3.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class S3
* @static
*/
private static $__accessKey = null;

/**
* AWS Secret Key
*
Expand All @@ -65,7 +65,7 @@ class S3
* @static
*/
private static $__secretKey = null;

/**
* SSL Client key
*
Expand All @@ -82,7 +82,7 @@ class S3
* @static
*/
public static $defDelimiter = null;

/**
* AWS URI
*
Expand All @@ -91,7 +91,7 @@ class S3
* @static
*/
public static $endpoint = 's3.amazonaws.com';

/**
* Proxy information
*
Expand All @@ -100,7 +100,7 @@ class S3
* @static
*/
public static $proxy = null;

/**
* Connect using SSL?
*
Expand All @@ -109,7 +109,7 @@ class S3
* @static
*/
public static $useSSL = false;

/**
* Use SSL validation?
*
Expand All @@ -118,7 +118,16 @@ class S3
* @static
*/
public static $useSSLValidation = true;


/**
* Use SSL version
*
* @var const
* @access public
* @static
*/
public static $useSSLVersion = CURL_SSLVERSION_TLSv1;

/**
* Use PHP exceptions?
*
Expand Down Expand Up @@ -210,6 +219,7 @@ public function setEndpoint($host)
self::$endpoint = $host;
}


/**
* Set AWS access key and secret key
*
Expand Down Expand Up @@ -2131,6 +2141,9 @@ public function getResponse()

if (S3::$useSSL)
{
// Set protocol version
curl_setopt($curl, CURLOPT_SSLVERSION, S3::$useSSLVersion);

// SSL Validation can now be optional for those with broken OpenSSL installations
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, S3::$useSSLValidation ? 2 : 0);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, S3::$useSSLValidation ? 1 : 0);
Expand Down

0 comments on commit 53e04ba

Please sign in to comment.