Skip to content

Commit

Permalink
#106 #107 Allow to set curl params over client config
Browse files Browse the repository at this point in the history
  • Loading branch information
ruflin committed Jan 8, 2012
1 parent e32a30f commit ba88bd0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
1 change: 1 addition & 0 deletions lib/Elastica/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class Elastica_Client
'timeout' => self::TIMEOUT,
'headers' => array(),
'servers' => array(),
'curl' => array(),
'roundRobin' => false,
'log' => false,
);
Expand Down
13 changes: 7 additions & 6 deletions lib/Elastica/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,20 +135,21 @@ public function send() {

$servers = $this->getClient()->getConfig('servers');

/*$dir = sys_get_temp_dir();
/*
// Integration of temp file
$dir = sys_get_temp_dir();
$name = 'elasticaServers.json';
$file = $dir . DIRECTORY_SEPARATOR . $name;
error_log($file);
if (!file_exists($file)) {
file_put_contents($file, 'hh');
error_log(print_r($this->getClient()->getCluster(), true));
}*/

}
*/

if (empty($servers)) {
error_log(print_r($this->getClient()->getConfig('url'), true));
$params = array(
'url' => $this->getClient()->getConfig('url'),
'host' => $this->getClient()->getHost(),
Expand Down
3 changes: 3 additions & 0 deletions lib/Elastica/Transport/Http.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ public function exec(array $params) {
* @param resource $connection Curl connection
*/
protected function _setupCurl($connection) {
foreach ($this->_request->getClient()->getConfig('curl') as $key => $param) {
curl_setopt($connection, $key, $param);
}
}

/**
Expand Down
1 change: 0 additions & 1 deletion lib/Elastica/Transport/Https.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,5 @@ class Elastica_Transport_Https extends Elastica_Transport_Http {
*/
protected function _setupCurl($connection) {
parent::_setupCurl($connection);
curl_setopt($connection, CURLOPT_SSL_VERIFYPEER, false);
}
}

0 comments on commit ba88bd0

Please sign in to comment.