Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion system/HTTP/CURLRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,12 @@ protected function parseOptions(array $options)

if (array_key_exists('headers', $options) && is_array($options['headers'])) {
foreach ($options['headers'] as $name => $value) {
$this->setHeader($name, $value);
// fix issue #5041 by taking into account multiple headers with the same name
if($this->hasHeader($name)) {
$this->appendHeader($name, $value);
} else {
$this->setHeader($name, $value);
}
}

unset($options['headers']);
Expand Down
10 changes: 9 additions & 1 deletion system/HTTP/ResponseTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,15 @@ public function sendHeaders()

// Send all of our headers
foreach (array_keys($this->getHeaders()) as $name) {
header($name . ': ' . $this->getHeaderLine($name), false, $this->getStatusCode());
// fix issue #5041 by taking into account multiple headers with the same name
$headerValue = $this->getHeader($name)->getValue();
if(is_array($headerValue)) {
foreach($headerValue as $h_value) {
header($name . ': ' . $h_value, false, $this->getStatusCode());
}
} else {
header($name . ': ' . $this->getHeaderLine($name), false, $this->getStatusCode());
}
}

return $this;
Expand Down