private function CurlFactory::applyHeaders in Lockr 7.3
1 call to CurlFactory::applyHeaders()
- CurlFactory::create in vendor/
guzzlehttp/ guzzle/ src/ Handler/ CurlFactory.php - Creates a cURL handle resource.
File
- vendor/
guzzlehttp/ guzzle/ src/ Handler/ CurlFactory.php, line 286
Class
- CurlFactory
- Creates curl resources from a request
Namespace
GuzzleHttp\HandlerCode
private function applyHeaders(EasyHandle $easy, array &$conf) {
foreach ($conf['_headers'] as $name => $values) {
foreach ($values as $value) {
$value = (string) $value;
if ($value === '') {
// cURL requires a special format for empty headers.
// See https://github.com/guzzle/guzzle/issues/1882 for more details.
$conf[CURLOPT_HTTPHEADER][] = "{$name};";
}
else {
$conf[CURLOPT_HTTPHEADER][] = "{$name}: {$value}";
}
}
}
// Remove the Accept header if one was not set
if (!$easy->request
->hasHeader('Accept')) {
$conf[CURLOPT_HTTPHEADER][] = 'Accept:';
}
}