mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Revert "FIX: allow CURLOPT_CONNECTTIMEOUT to be configured."
This reverts commit 0d493d4eff
.
This commit is contained in:
parent
6d3f7887a6
commit
87bb99667e
@ -1,21 +1,17 @@
|
||||
<?php
|
||||
/**
|
||||
* RestfulService class allows you to consume various RESTful APIs.
|
||||
*
|
||||
* Through this you could connect and aggregate data of various web services.
|
||||
*
|
||||
* @see http://doc.silverstripe.org/framework/en/reference/restfulservice
|
||||
* For more info visit wiki documentation - http://doc.silverstripe.org/doku.php?id=restfulservice
|
||||
*
|
||||
* @package framework
|
||||
* @subpackage integration
|
||||
*/
|
||||
class RestfulService extends ViewableData {
|
||||
|
||||
protected $baseURL;
|
||||
protected $queryString;
|
||||
protected $errorTag;
|
||||
protected $checkErrors;
|
||||
protected $connectTimeout = 5;
|
||||
protected $cache_expire;
|
||||
protected $authUsername, $authPassword;
|
||||
protected $customHeaders = array();
|
||||
@ -217,6 +213,7 @@ class RestfulService extends ViewableData {
|
||||
*/
|
||||
public function curlRequest($url, $method, $data = null, $headers = null, $curlOptions = array()) {
|
||||
$ch = curl_init();
|
||||
$timeout = 5;
|
||||
$sapphireInfo = new SapphireInfo();
|
||||
$useragent = 'SilverStripe/' . $sapphireInfo->Version();
|
||||
$curlOptions = $curlOptions + (array)$this->config()->default_curl_options;
|
||||
@ -224,7 +221,7 @@ class RestfulService extends ViewableData {
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
|
||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $this->getConnectTimeout());
|
||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
|
||||
if(!ini_get('open_basedir')) curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);
|
||||
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
|
||||
|
||||
@ -556,31 +553,6 @@ class RestfulService extends ViewableData {
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the connection timeout for the curl request in seconds.
|
||||
*
|
||||
* @see http://curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTCONNECTTIMEOUT
|
||||
*
|
||||
* @param int
|
||||
*
|
||||
* @return RestfulService
|
||||
*/
|
||||
public function setConnectTimeout($timeout) {
|
||||
$this->connectTimeout = $timeout;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the connection timeout value.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getConnectTimeout() {
|
||||
return $this->connectTimeout;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user