Upgrade to Kirby 3.3.2

This commit is contained in:
Bastian Allgeier
2019-12-17 10:31:21 +01:00
parent 3a82406bed
commit 91919964db
20 changed files with 361 additions and 181 deletions

View File

@@ -22,16 +22,17 @@ class Remote
* @var array
*/
public static $defaults = [
'agent' => null,
'body' => true,
'data' => [],
'encoding' => 'utf-8',
'file' => null,
'headers' => [],
'method' => 'GET',
'progress' => null,
'test' => false,
'timeout' => 10,
'agent' => null,
'basicAuth' => null,
'body' => true,
'data' => [],
'encoding' => 'utf-8',
'file' => null,
'headers' => [],
'method' => 'GET',
'progress' => null,
'test' => false,
'timeout' => 10,
];
/**
@@ -170,7 +171,22 @@ class Remote
// add all headers
if (empty($this->options['headers']) === false) {
$this->curlopt[CURLOPT_HTTPHEADER] = $this->options['headers'];
// convert associative arrays to strings
$headers = [];
foreach ($this->options['headers'] as $key => $value) {
if (is_string($key) === true) {
$headers[] = $key . ': ' . $value;
} else {
$headers[] = $value;
}
}
$this->curlopt[CURLOPT_HTTPHEADER] = $headers;
}
// add HTTP Basic authentication
if (empty($this->options['basicAuth']) === false) {
$this->curlopt[CURLOPT_USERPWD] = $this->options['basicAuth'];
}
// add the user agent