Skip to content

Commit

Permalink
Merge pull request #1915 from alexeyshockov/empty-headers-support
Browse files Browse the repository at this point in the history
Empty headers support
  • Loading branch information
sagikazarmark committed Mar 26, 2018
2 parents 21f5dde + 2dd96c9 commit 5d340a9
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Handler/CurlFactory.php
Expand Up @@ -287,7 +287,14 @@ private function applyHeaders(EasyHandle $easy, array &$conf)
{
foreach ($conf['_headers'] as $name => $values) {
foreach ($values as $value) {
$conf[CURLOPT_HTTPHEADER][] = "$name: $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";
}
}
}

Expand Down

0 comments on commit 5d340a9

Please sign in to comment.