Get raw message headers.

@return string
12727
public function getRawHeaders(): string
    {
        if (null === $this->rawHeaders) {
            $rawHeaders = \imap_fetchheader($this->resource->getStream(), $this->getNumber(), \FT_UID);

            if (false === $rawHeaders) {
                throw new ImapFetchheaderException('imap_fetchheader failed');
            }

            $this->rawHeaders = $rawHeaders;
        }

        return $this->rawHeaders;
    }
329735
private static function getHeadersFromInput ()
	{
		// getallheaders available, use that
		if (function_exists('getallheaders')) return getallheaders();

		// getallheaders not available: manually extract 'm
		$headers = [];
		foreach ($_SERVER as $name => $value)
		{
			if (substr($name, 0, 5) == 'HTTP_') {
			    $key = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))));
				$headers[$key] = $value;
			} else if (strtolower (substr ($name, 0, 7)) == 'content') {
                $key = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', $name))));
				$headers[$key] = $value;
			}
		}
		return $headers;
	}
1246248
public function getHeaders()
    {
        $headers = array_change_key_case($this->httpRequest->getHeaders(), CASE_LOWER);

        foreach ($headers as $header) {
            $header = array_map(function ($value) {
                return strtolower($value);
            }, $header);
        }

        return $headers;
    }
177982
public function getMailHeadersAsString()
    {
        $headerString = "";

        foreach ($this->getMailHeaders() as $header => $value) {
            $headerString .= $header . ": " . $value . "\r\n";
        }

        return trim($headerString);
    }
589438
public function getHeaders()
    {
        if (!isset($this->properties[MessageProperties::KEY_HEADERS])) {
            $this->properties[MessageProperties::KEY_HEADERS] = [];
        }

        return $this->properties[MessageProperties::KEY_HEADERS];
    }
7745
public function getHeaders()
    {
        if ($this->_headers === null) {
            $this->_headers = new HeaderCollection();
            foreach ($this->swooleRequest->server as $name => $value) {
                if (strncmp($name, 'HTTP_', 5) === 0) {
                    $name = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))));
                    $this->_headers->add($name, $value);
                }
            }
        }
        return $this->_headers;
    }
515899
public function headers()
    {
        $headers = [];
        foreach ($this->headers as $header) {
            $headers[$header->name()] = $header->value();
        }

        return $headers;
    }
628095
public function generateRawHeaders(array $headers)
    {
        $rawHeaders = array();
        foreach ($headers as $key => $values) {
            if (!is_array($values)) {
                $values = array($values);
            }
            foreach ($values as $value) {
                if ($key !== 0) {
                    $rawHeader =  $key . ': ' . $value;
                } else {
                    $rawHeader = $value;
                }
                foreach (explode("\r\n", $rawHeader) as $singleLineRawHeader) {
                    $rawHeaders[] = $singleLineRawHeader;
                }
            }
        }
        return $rawHeaders;
    }
460569
public function getHeaders()
    {
        $headers = array();
        foreach ((array)$this->getResponse()->getHeaders() as $header => $headerObject) {
            $headers[strtolower($header)] = implode(';', $headerObject);
        }

        return $headers;
    }
910571
public function getHeadersAsString()
    {
        $headerString = '';
        foreach ($this->getHeaders() as $name => $header) {
            // build up a header string
            $headerString .= $name . ': ' . $header . PHP_EOL;
        }

        return $headerString;
    }
1326795
public static function http_parse_headers($raw_headers)
    {
        $headers = [];
        $key     = ''; // [+]

        foreach (explode("\n", $raw_headers) as $i => $h) {
            $h = explode(':', $h, 2);

            if (isset($h[1])) {
                if (!isset($headers[$h[0]])) {
                    $headers[$h[0]] = trim($h[1]);
                } elseif (is_array($headers[$h[0]])) {
                    // $tmp = array_merge($headers[$h[0]], array(trim($h[1]))); // [-]
                    // $headers[$h[0]] = $tmp; // [-]
                    $headers[$h[0]] = array_merge($headers[$h[0]], [trim($h[1])]); // [+]
                } else {
                    // $tmp = array_merge(array($headers[$h[0]]), array(trim($h[1]))); // [-]
                    // $headers[$h[0]] = $tmp; // [-]
                    $headers[$h[0]] = array_merge([$headers[$h[0]]], [trim($h[1])]); // [+]
                }

                $key = $h[0]; // [+]
            } else {
                // [+]
                // [+]
                if (substr($h[0], 0, 1) == "\t") {
                    // [+]
                    $headers[$key] .= "\r\n\t" . trim($h[0]);
                } // [+]
                elseif (!$key) {
                    // [+]
                    $headers[0] = trim($h[0]);
                }
                trim($h[0]); // [+]
            } // [+]
        }

        return $headers;
    }
135193
public function getHeaders(): array
	{
		$headers = [];

		foreach($this->parameters as $key => $value)
		{
			if(strpos($key, 'HTTP_') === 0)
			{
				$headers[substr($key, 5)] = $value;
			}
			elseif(in_array($key, ['CONTENT_LENGTH', 'CONTENT_MD5', 'CONTENT_TYPE']))
			{
				$headers[$key] = $value;
			}
		}

		return $headers;
	}
370718
public static function getRequestHeaders()
    {
        if (function_exists('getallheaders')) {
            $headers = array();
            foreach (getallheaders() as $name => $value) {
                $headers[str_replace(' ', '-', ucwords(strtolower(str_replace('-', ' ', $name))))] = $value;
            }
            return $headers;
        }
        $headers = array();
        foreach ($_SERVER as $name => $value) {
            if (substr($name, 0, 5) == 'HTTP_') {
                $headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value;
            }
        }
        return $headers;
    }
256582
public function getHeaders(): array
    {
        if ($this->headers === null && $this->headersText !== null) {
            $this->headers = [];

            foreach (explode("\n", $this->headersText) as $line) {
                $pos = strpos($line, ':');

                if ($pos === false) {
                    // this is one-line header
                    $this->headers[$line] = null;
                } else {
                    $name = substr($line, 0, $pos);
                    $value = substr($line, $pos + 1);
                    $this->headers[$name] = trim($value);
                }
            }
        }

        return $this->headers ?? [];
    }
584613
public function parseRawHeaders(array $rawHeaders)
    {
        $headers = array();
        $key = '';
        foreach ($rawHeaders as $rawHeader) {
            $rawHeaderLineParts = explode(':', $rawHeader, 2);
            if (isset($rawHeaderLineParts[1])) {
                $key = $rawHeaderLineParts[0];
                $value = trim($rawHeaderLineParts[1]);
                if (!isset($headers[$key])) {
                    $headers[$key] = $value;
                } elseif (is_array($headers[$key])) {
                    $headers[$key][] = $value;
                } else {
                    $headers[$key] = array($headers[$key], $value);
                }
            } elseif (strlen($rawHeaderLineParts[0]) > 0) {
                if (!$key) {
                    $headers[0] = trim($rawHeaderLineParts[0]);
                } elseif (in_array(substr($rawHeaderLineParts[0], 0, 1), array(' ', "\t"))) {
                    if (is_array($headers[$key])) {
                        $lastValue = array_pop($headers[$key]);
                        $headers[$key][] = $lastValue . "\r\n" . rtrim($rawHeaderLineParts[0]);
                    } else {
                        $headers[$key] .= "\r\n" . rtrim($rawHeaderLineParts[0]);
                    }
                }
            }
        }
        return $headers;
    }
1010696
public function getHeaders()
    {
        $headers = array();
        foreach ($this->servers as $name => $value) {
            if (0 === strpos($name, 'HTTP_')) {
                $headers[substr($name, 5)] = $value;
            }
        }
        return $headers;
    }
43113
public function getRequestHeaders()
  {
    $headers = parent::getRequestHeaders();
    if (!is_null($this->modifiedSince)) {
      $headers['If-Modified-Since'] = $this->modifiedSince->format('r');
    }

    return $headers;
  }