Skip to content

Commit ba88bd0

Browse files
committed
#106 #107 Allow to set curl params over client config
1 parent e32a30f commit ba88bd0

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

lib/Elastica/Client.php

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class Elastica_Client
4545
'timeout' => self::TIMEOUT,
4646
'headers' => array(),
4747
'servers' => array(),
48+
'curl' => array(),
4849
'roundRobin' => false,
4950
'log' => false,
5051
);

lib/Elastica/Request.php

+7-6
Original file line numberDiff line numberDiff line change
@@ -135,20 +135,21 @@ public function send() {
135135

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

138-
/*$dir = sys_get_temp_dir();
138+
/*
139+
140+
// Integration of temp file
141+
$dir = sys_get_temp_dir();
139142
$name = 'elasticaServers.json';
140143
$file = $dir . DIRECTORY_SEPARATOR . $name;
141-
142-
error_log($file);
143144
144145
if (!file_exists($file)) {
145146
file_put_contents($file, 'hh');
146147
error_log(print_r($this->getClient()->getCluster(), true));
147-
}*/
148-
148+
}
149+
150+
*/
149151

150152
if (empty($servers)) {
151-
error_log(print_r($this->getClient()->getConfig('url'), true));
152153
$params = array(
153154
'url' => $this->getClient()->getConfig('url'),
154155
'host' => $this->getClient()->getHost(),

lib/Elastica/Transport/Http.php

+3
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ public function exec(array $params) {
112112
* @param resource $connection Curl connection
113113
*/
114114
protected function _setupCurl($connection) {
115+
foreach ($this->_request->getClient()->getConfig('curl') as $key => $param) {
116+
curl_setopt($connection, $key, $param);
117+
}
115118
}
116119

117120
/**

lib/Elastica/Transport/Https.php

-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,5 @@ class Elastica_Transport_Https extends Elastica_Transport_Http {
2020
*/
2121
protected function _setupCurl($connection) {
2222
parent::_setupCurl($connection);
23-
curl_setopt($connection, CURLOPT_SSL_VERIFYPEER, false);
2423
}
2524
}

0 commit comments

Comments
 (0)