I checked code in that file, /var/www/magento/vendor/magento/framework/HTTP/Client/Curl.php
the code is already like advised
protected function parseHeaders($ch, $data)
{
if ($this->_headerCount == 0) {
$line = explode(" ", trim($data), 3);
if (count($line) < 2) {
$this->doError("Invalid response line returned from server: " . $data);
}
$this->_responseStatus = (int)$line[1];
} else {
$name = $value = '';
$out = explode(": ", trim($data), 2);
if (count($out) == 2) {
$name = $out[0];
$value = $out[1];
}
if (strlen($name)) {
if ("Set-Cookie" == $name) {
if (!isset($this->_responseHeaders[$name])) {
$this->_responseHeaders[$name] = [];
}
$this->_responseHeaders[$name][] = $value;
} else {
$this->_responseHeaders[$name] = $value;
}
}
}
$this->_headerCount++;
return strlen($data);
}