Skip to content

Commit de484ab

Browse files
authored
Fix #329: Added curlOptions attribute for advanced configuration of curl session
1 parent a32cca4 commit de484ab

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Yii Framework 2 Elasticsearch extension Change Log
33

44
2.1.4 under development
55
-----------------------
6-
6+
- Enh #329: Added `curlOptions` attribute for advanced configuration of curl session (yuniorsk)
77

88
2.1.3 August 07, 2022
99
-----------------------

Connection.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@ class Connection extends Component
9595
* If not set, no explicit timeout will be set for curl.
9696
*/
9797
public $dataTimeout = null;
98+
/**
99+
* @var array additional options used to configure curl session
100+
* @since 2.1.4
101+
*/
102+
public $curlOptions = [];
98103
/**
99104
* @var integer version of the domain-specific language to use with the server.
100105
* This must be set to the major version of the Elasticsearch server in use, e.g. `5` for Elasticsearch 5.x.x,
@@ -454,6 +459,10 @@ protected function httpRequest($method, $url, $requestBody = null, $raw = false)
454459
CURLOPT_FORBID_REUSE => false,
455460
];
456461

462+
if (!empty($this->curlOptions)) {
463+
$options = array_merge($options, $this->curlOptions);
464+
}
465+
457466
if (!empty($this->auth) || isset($this->nodes[$this->activeNode]['auth']) && $this->nodes[$this->activeNode]['auth'] !== false) {
458467
$auth = isset($this->nodes[$this->activeNode]['auth']) ? $this->nodes[$this->activeNode]['auth'] : $this->auth;
459468
if (empty($auth['username'])) {

composer.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@
3030
"autoload": {
3131
"psr-4": { "yii\\elasticsearch\\": "" }
3232
},
33+
"config": {
34+
"allow-plugins": {
35+
"yiisoft/yii2-composer": true
36+
}
37+
},
3338
"repositories": [
3439
{
3540
"type": "composer",

0 commit comments

Comments
 (0)