This commit is contained in:
thefosk
2014-01-06 20:57:02 +01:00
parent 389b90a47e
commit 42edc2b2e3
3 changed files with 26 additions and 11 deletions

View File

@@ -146,3 +146,13 @@ You can clear the default headers anytime with:
```php
Unirest::clearDefaultHeaders();
```
### SSL validation
You can esplicitly enable or disable SSL certificate validation
```php
Unirest::verifiyPeer(false);
```
By default is `true`.

View File

@@ -5,15 +5,20 @@
class Unirest
{
/**
* Verify SSL peer
* @var bool
*/
public static $verifyPeer = true;
private static $verifyPeer = true;
private static $socketTimeout = null;
private static $defaultHeaders = array();
/**
* Verify SSL peer
* @param bool $enabled enable SSL verification, by default is true
*/
public static function verifyPeer($enabled) {
Unirest::$verifyPeer = $enabled;
}
/**
* Set a timeout
* @param integer $seconds timeout value in seconds

View File

@@ -6,18 +6,18 @@ echo "Running the Unirest-PHP bindings test suite.\n".
$ok = @include_once(dirname(__FILE__).'/simpletest/autorun.php');
if (!$ok) {
$ok = @include_once(dirname(__FILE__).'/../vendor/vierbergenlars/simpletest/autorun.php');
$ok = @include_once(dirname(__FILE__).'/../vendor/vierbergenlars/simpletest/autorun.php');
}
if (!$ok) {
echo "MISSING DEPENDENCY: The Unirest-PHP test cases depend on SimpleTest. ".
"Download it at <http://www.simpletest.org/>, and either install it ".
"in your PHP include_path or put it in the test/ directory.\n";
exit(1);
echo "MISSING DEPENDENCY: The Unirest-PHP test cases depend on SimpleTest. ".
"Download it at <http://www.simpletest.org/>, and either install it ".
"in your PHP include_path or put it in the test/ directory.\n";
exit(1);
}
// Throw an exception on any error
function exception_error_handler($errno, $errstr, $errfile, $errline) {
throw new ErrorException($errstr, $errno, 0, $errfile, $errline);
throw new ErrorException($errstr, $errno, 0, $errfile, $errline);
}
set_error_handler('exception_error_handler');